Documentation de l'API JavaScript PUBLITRAC
1. Synchroniser un ou plusieurs leads en même temps par l'API JavaScript PUBLITRAC. Si le lead existe déjà (courriel existant) une mise à jour sera effectuée.
Nom de l'objet: PubliPage.Api. SyncLead
Configuration: apiKey
Attributs: fields (contient les attributs du lead et leurs valeurs, voir la description complète des champs leads ici).
Champs personalisés: fields.customFields (contient les champs personalisées et leurs valeurs)
Callbacks: OnSuccess, OnError
Méthodes: post
Exemple d'implémentation:
<script type="text/javascript">
$('document').ready(function()
{
$('#synclead').click(function()
{
/* Form identification */
PubliPage.Api.SyncLead.config.apiKey = '87af7062-c756-11e0-9d7a-12313d018224';
/*Sync Lead Attributs */
PubliPage.Api.SyncLead.config.fields.token = '_nl-yourdomain.com-1323891914130-53205';
PubliPage.Api.SyncLead.config.fields.crmLeadId = 'CRM_ID134';
PubliPage.Api.SyncLead.config.fields.firstName = 'John';
PubliPage.Api.SyncLead.config.fields.lastName = 'Smith';
PubliPage.Api.SyncLead.config.fields.middleName = '';
PubliPage.Api.SyncLead.config.fields.company = 'ACME';
PubliPage.Api.SyncLead.config.fields.phone = '555-423-2453';
PubliPage.Api.SyncLead.config.fields.email = 'johnsmith@mydomain.com';
PubliPage.Api.SyncLead.config.fields.mailingAddress = '134 Ocean Street';
PubliPage.Api.SyncLead.config.fields.leadSource = 'New Production ABC';
PubliPage.Api.SyncLead.config.fields.originalSource = 'New Production ABC';
PubliPage.Api.SyncLead.config.fields.originalSourceType = 'Organic';
PubliPage.Api.SyncLead.config.fields.jobTitle = 'Software Engineer';
PubliPage.Api.SyncLead.config.fields.score ='10';
PubliPage.Api.SyncLead.config.fields.postalCode ='90211';
PubliPage.Api.SyncLead.config.fields.country ='USA';
PubliPage.Api.SyncLead.config.fields.city ='Compton';
PubliPage.Api.SyncLead.config.fields.state ='CA';
PubliPage.Api.SyncLead.config.fields.doNotCall = '0';
PubliPage.Api.SyncLead.config.fields.doNotCallReason = '';
PubliPage.Api.SyncLead.config.fields.unsubscribed = '0';
PubliPage.Api.SyncLead.config.fields.unsubscribeCause = '';
PubliPage.Api.SyncLead.config.fields.unsubscribeReason = '';
PubliPage.Api.SyncLead.config.fields.fax = '555-324-2134';
PubliPage.Api.SyncLead.config.fields.mobile = '555-432-1242';
PubliPage.Api.SyncLead.config.fields.isCustomer = '0';
PubliPage.Api.SyncLead.config.fields.isAnonymous = '0';
PubliPage.Api.SyncLead.config.fields.emailInvalid = '0';
PubliPage.Api.SyncLead.config.fields.emailInvalidCause = '0';
PubliPage.Api.SyncLead.config.fields.notes = 'This lead is very interest in product ABC';
PubliPage.Api.SyncLead.config.fields.suspended = '0';
PubliPage.Api.SyncLead.config.fields.suspendedReason = '';
PubliPage.Api.SyncLead.config.fields.blacklisted = '0';
PubliPage.Api.SyncLead.config.fields.blacklistedCause = '';
PubliPage.Api.SyncLead.config.fields.customerId = '';
PubliPage.Api.SyncLead.config.fields.website = 'http://www.acme.com';
PubliPage.Api.SyncLead.config.fields.language = 'fr';
PubliPage.Api.SyncLead.config.fields.nbrEmployees = '4';
PubliPage.Api.SyncLead.config.fields.revenue = '400000';
PubliPage.Api.SyncLead.config.fields.customFields = [{carColor : 'Red'},{carMaker:'Infiniti'},
{carPackagesInterestedIn : [{name: 'Premium', desc: 'Lorem', price: '55000'},
{name: 'Best Value', desc: 'Lorem',price: '35000'}]}
];
/* Application callbacks (optionals) */
PubliPage.Api.SyncLead.onSuccess.callback = function(status,message)
{
if(console != undefined)
console.log("Status:" + status + "\n" + "Message:" + message);
}
PubliPage.Api.SyncLead.onError.callback = function(message)
{
if(console != undefined)
console.log("Error:" + message);
}
/* End of application callbacks (optionals) */
/* Post the form */
PubliPage.Api.SyncLead.post();
});
});
</script>
2. Ajouter un lead à une liste statique (non filtrée) par l'API JavaScript PUBLITRAC.
Nom de l'objet: PubliPage.Api.AddLeadsToList
Configuration: apiKey
Attributs: fields (contient les attributs du lead et leurs valeurs, voir la description complète des champs leads ici).
Champs personalisés: fields.customFields (contient les champs personalisés et leurs valeurs)
Callbacks: OnSuccess, OnError
Méthodes: post
Exemple d'implémentation:
<script type="text/javascript">
$('document').ready(function()
{
$('#addleadstolist').click(function()
{
/* Form identification */
PubliPage.Api.AddLeadsToList.config.apiKey = '6221e616-180c-102e-9711-12313b072c51';
/* Add Lead To List attributes */
PubliPage.Api.AddLeadsToList.config.fields.name = 'The name of the list to add to';
PubliPage.Api.AddLeadsToList.config.fields.lead = [{email:'someone1@publitrac.com'},{email:'someone2@publitrac.com'}];
/* Application callbacks (optionals) */
PubliPage.Api.AddLeadsToList.onSuccess.callback = function(status,message) {
if(console != undefined)
{
console.log("Status:" + status + "\n" + "Message:" + message);
}
}
PubliPage.Api.AddLeadsToList.onError.callback = function(message) {
if(console != undefined) {
console.log("Error:" + message);
}
}
/* End of application callbacks (optionals) */
/* Post the form */
PubliPage.Api.AddLeadsToList.post();
});
});
</script>
10. Ajouter un formulaire soumis à un lead existant par l'API JavaScript PUBLITRAC.
Nom de l'objet: PubliPage.Api.AddFillOutFormHistory
Configuration: apiKey, email
Attributs: fields (contient les attributs du lead et leurs valeurs, voir la description complète des champs leads ici).
Champs personalisés: fields.customFields (contient les champs personalisés et leurs valeurs)
Callbacks: OnSuccess, OnError
Méthodes: post
Exemple d'implémentation:
<script type="text/javascript">
$('document').ready(function()
{
$('#addfilloutformhistory').click(function()
{
/* Form identification */
PubliPage.Api.AddFillOutFormHistory.config.apiKey = '6221e616-180c-102e-9711-12313b072c51';
PubliPage.Api.AddFillOutFormHistory.config.email = 'someone@publipage.com';
/* Add Fill Out Form History attributes */
PubliPage.Api.AddFillOutFormHistory.config.fields.information = 'Registration Form';
PubliPage.Api.AddFillOutFormHistory.config.fields.context = '';
PubliPage.Api.AddFillOutFormHistory.config.fields.formName = 'Infolettre';
PubliPage.Api.AddFillOutFormHistory.config.fields.url = '/infolettre.php';
PubliPage.Api.AddFillOutFormHistory.config.fields.values = 'Firstname: Claude <![CDATA[ Firstname: Claude Lastname: Sage Email: claude@sage.com Phone: 555-666-7777]]>';
PubliPage.Api.AddFillOutFormHistory.config.fields.sessionId = '2192c0f3802f8e0744e9940788121624';
/* Application callbacks (optionals) */
PubliPage.Api.AddFillOutFormHistory.onSuccess.callback = function(status,message) {
if(console != undefined)
{
console.log("Status:" + status + "\n" + "Message:" + message);
}
}
PubliPage.Api.AddFillOutFormHistory.onError.callback = function(message) {
if(console != undefined) {
console.log("Error:" + message);
}
}
/* End of application callbacks (optionals) */
/* Post the form */
PubliPage.Api.AddFillOutFormHistory.post();
});
});
</script>
3. Exécuter une campagne donnée sur un lead par l'API JavaScript PUBLITRAC.
Nom de l'objet: PubliPage.Api.ExecuteCampaigns
Configuration: apiKey
Attributs: fields (contient les attributs du lead et leurs valeurs, voir la description complète des champs leads ici).
Champs personalisés: fields.customFields (contient les champs personalisés et leurs valeurs)
Callbacks: OnSuccess, OnError
Méthodes: post
Exemple d'implémentation:
<script type="text/javascript">
$('document').ready(function()
{
$('#executecampaigns').click(function()
{
/* Form identification */
PubliPage.Api.ExecuteCampaigns.config.apiKey = '6221e616-180c-102e-9711-12313b072c51';
/* Execute Campaigns attributes */
PubliPage.Api.ExecuteCampaigns.config.fields.leads = [
{lead:[{email:'johnsmith@acme.com'}]},
{lead:[{email:'johnsmith@acme.com'}]}];
PubliPage.Api.ExecuteCampaigns.config.fields.campaigns = [
{campaign:[{name:'Trade Show May'}]}];
/* Application callbacks (optionals) */
PubliPage.Api.ExecuteCampaigns.onSuccess.callback = function(status,message) {
if(console != undefined)
{
console.log("Status:" + status + "\n" + "Message:" + message);
}
}
PubliPage.Api.ExecuteCampaigns.onError.callback = function(message) {
if(console != undefined) {
console.log("Error:" + message);
}
}
/* End of application callbacks (optionals) */
/* Post the form */
PubliPage.Api.ExecuteCampaigns.post();
});
});
</script>
4. Exécuter une campagne de marketing par courriel sur un ou des leads par l'API JavaScript PUBLITRAC
Nom de l'objet: PubliPage.Api.AddEmailCampaign
Configuration: apiKey
Attributs: fields (contient les attributs du lead et leurs valeurs, voir la description complète des champs leads ici).
Champs personalisés: fields.customFields (contient les champs personalisées et leurs valeurs)
Callbacks: OnSuccess, OnError
Méthodes: post
Exemple d'implémentation:
<script type="text/javascript">
$('document').ready(function()
{
$('#addemailcampaign').click(function()
{
/* Form identification */
PubliPage.Api.AddEmailCampaign.config.apiKey = '6221e616-180c-102e-9711-12313b072c51';
/* Add Email Campaign attributes */
PubliPage.Api.AddEmailCampaign.config.fields.information = [{name:'Promotion January 2014'}];
PubliPage.Api.AddEmailCampaign.config.fields.email = [
{
fromName:'PUBLITRAC',
fromEmail:'no-reply@publipage.com',
subject:'January Promotion',
message:[
{
html:'<![CDATA[<html><body>Hello <strong>{{FirstName;Default=}}</strong>.<br /><br />There is a new promotion this year…<br /><br /><br /></body></html>]]>',
text:'<![CDATA[Hello {{FirstName;Default=}}.There is a new promotion this year…]]>'
}],
options:[{sendAsSalesRep:false}]
}];
PubliPage.Api.AddEmailCampaign.config.fields.leads = [
{
lead:[
{
firstName:'John',lastName:'Carmack',company:'ID Software',phone:'555-423-2453',email:'jsmith@acme.com',leadSource:'New Production ABC',originalSource:'New Production ABC',
originalSourceType:'Web',
customFields:[{GamePreferences:'Action',GamePlayed:'121'}]
},{
firstName:'John',lastName:'Smith',company:'ACME',phone:'555-423-2453',email:'jcarmack@idsoftware.ca',leadSource:'New Production ABC',originalSource:'New Production ABC',
originalSourceType:'Web',
customFields:[{GamePreferences:'Strategy',GamePlayed:'23'}]
}
]}];
/* Application callbacks (optionals) */
PubliPage.Api.AddEmailCampaign.onSuccess.callback = function(status,message) {
if(console != undefined)
{
console.log("Status:" + status + "\n" + "Message:" + message);
}
}
PubliPage.Api.AddEmailCampaign.onError.callback = function(message) {
if(console != undefined) {
console.log("Error:" + message);
}
}
/* End of application callbacks (optionals) */
/* Post the form */
PubliPage.Api.AddEmailCampaign.post();
});
});
</script>