Campaigns

List of properties of the Campaign resource

Property

Description

id

Campaign id

name

Name/Label for the campaign

reference

Free text (can be for example an external id given by the creator of the campaign)

listId

Id of the list of contacts associated with the campaign

listName

Name of the list of contacts associated with the campaign

listCount

Number of contacts in the list of contacts associated with the campaign

nbSteps

Number of steps in the campaign

type

Campaign type

STANDARD: Conventional marketing sending campaign;

TRIGGERED: Campaign based on the date in the contacts for the sending;

RECURRING: Campaign sent at regular intervals across the entire list of contacts;

TRANSACTIONAL: Campaign without a list of contacts, to which can be added new contacts after it is created.

dateStart

Start date for the campaign

dateEnd

End date for the campaign

cancelled

Cancellation indicator for the campaign (1 if the campaign has been canceled, 0 otherwise)

status

Campaign status

  • created: campaign ready to be built (default status)

  • canceled: campaign canceled before its start date (so no message has been sent)

  • interrupted: campaign canceled after its start date (so a portion of the messages may have been sent)

  • ended: campaign ended (each mailing has exceeded the timeout for its media)

comment

Comment concerning the campaign

dateCreated

Creation date for the campaign

 

Listing campaigns

List of available filters

Property

Description

id

Filter according to one or more campaign ids

reference

Filter according to the customer reference of the campaign

type

Filter allowing for selections according to the type of campaign

cancelled

Filter allowing for selection only of canceled or non-canceled campaigns

status

Filter according to the status of the campaign

dateStart

Allow you to filter campaigns that are more recent than dateStart

dateEnd

Allow you to filter campaigns that are older than dateEnd

 

Example

List the campaigns for which the id is either 24 or 25

GET /rest/campaigns HTTP/1.1

Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJpZCI6ImYyMzE2…
Host: api.messengeo.net
Content-Type: application/x-www-form-urlencoded

id=24,25

 

or in POST (but by specifying the action)

POST /rest/campaigns HTTP/1.1

Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJpZCI6ImYyMzE2…
Host: api.messengeo.net
Content-Type: application/x-www-form-urlencoded

action=read&id=24,25

 

And with Curl

curl -H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJpZCI6ImYyMzE2…" https://api.messengeo.net/rest/campaigns?id=24,25

 

Return

This method sends back as return campaigns encapsulated in a structure that also contains:

{
	"size": 2,        // Nombre campagnes renvoyées
	"total": 2,       // Nombre total de campagnes si la requête n’était pas limitée
	"list": [         // Liste des ressources campaigns
   	{
            "id": "24",
            "name": "Campagne 15/10/2013 11:50",
       	"cancelled": "0",
             ...
       	"status": "ended",
       	"type": "STANDARD"
       	"dateCreated": "2014-06-09 10:51:59",
   	},
   	{
            "id": "25",
            "name": "Campagne 09/06/2014 10:50",
       	"cancelled": "0",
             ...
       	"status": "ended",
       	"type": "STANDARD"
       	"dateCreated": "2014-06-09 10:51:59",
   	}
	]
}
 

Creating a campaign

List of parameters to supply in order to create a campaign

Parameter

Type

Description

Required?

name

string

Name of the campaign

yes

listId

integer

Id of the list of contacts

if at least 1 PUSH mailing (EMAIL, SMS, VOICE, VOICEMAIL)

steps

array

Table of the steps that the campaign will contain. For details on the list of parameters to supply for each step, cf. #3.1.3.2.

yes

reference

string

Free text (can be for example an external id given by the creator of the campaign)

no

type

string

Campaign type:

STANDARD: Conventional marketing sending campaign

TRIGGERED: Campaign based on the date in the contacts for the sending

RECURRING: Campaign sent at regular intervals across the entire list of contacts

TRANSACTIONAL: Campaigns to which new contacts can be added (single-step campaigns)

no

(default: STANDARD)

comment

text

Comment concerning the campaign

no

 

List of parameters for the steps table

Parameter

Type

Description

Required?

mode

string

Sending mode

  • combined: combined sending across all the channels

  • prioritized: prioritized sending

if at least 2 PUSH mailings (EMAIL, SMS, VOICE, VOICEMAIL)

date

string

Send date for the step

Note: Only for STANDARD campaigns (if omitted or in the past, immediate sending)

no

mailings

array

Table of the mailings that the step will contain. For details on the list of parameters to supply for each mailing, cf. 3.1.3.3.

yes

priorities

Array or string

List of PUSH channels (EMAIL, SMS, VOICE, VOICEMAIL) to prioritize in the framework of substitution

Note: 2 equivalent examples:

array('SMS','EMAIL')

"SMS,EMAIL"

if "prioritized" mode

autoPeriod

string

String of characters representing the periodicity at which the campaign is to be sent in the framework of automated or recurring campaigns

Note: See syntax hereinbelow

if campaign of the TRIGGERED or RECURRING type

autoField

string

Contact field used as a basis in the framework of automated campaigns

if campaign of the TRIGGERED type

reference

string

Free text (can be for example an external id given by the creator of the campaign)

no

 

List of parameters for the mailings table

Parameter

Type

Description

Required?

text

string

Content in TEXT format

  • SMS: content of the SMS

  • EMAIL: text version

if EMAIL, SMS media

html

string

Content in HTML format

Notes:

  • Only for the EMAIL media

  • At least one of the two "text" and "html" fields must be present

if EMAIL media

link

string

Link representing the content:

  • VOICE: link to a VXML, WAV or MP3 file

  • VOICEMAIL: link to a WAV or MP3 file

if VOICE, VOICEMAIL media

subject

string

Subject of the e-mailing

Note: Only for the EMAIL media

if EMAIL media

replyContact

string

Reply means of the e-mailing

Note: Only for the EMAIL media

no

sender

string

Name of the sender

  • SMS: value of the TPOA

  • EMAIL: name of the sender

no

media

string

Media used to send messages

SMS, EMAIL, VOICE, VOICEMAIL

yes

type

string

Type associated with the media

Possible types:

  • VOICE: "vxml","wav" (choose "wav" for WAV and MP3 files)

  • SMS: "response"

if VOICE media

pingUrl

string

Notification url for a status change on one or more messages.

no

batchVolume2

int

If the mailing has to be sent in packets, batchVolume defines the number of messages of each packet.

Note: The programming rate for messages per minute cannot exceed the maximum sending rate per minute of the various providers.

no

batchDelay

int

If the mailing has to be sent in packets, batchDelay defines the number of minutes between the programming dates of the various message packets

Note: If one of the fields "batchVolume" or "batchDelay" is present, the second one must also be present

no

 

So that the recipient of emails can unsubscribe from the service, a link for unsubscribing must be present in the body of the email (HTML and TEXT). This link must be inserted via the #OPTOUTLINK# field which will be replaced with the link for unsubscribing that is proper to each recipient.

The #OPTOUTLINK# field in the HTML and TEXT portions is required in order to save the mailing.

For example

<html>

...

Si vous souhaitez vous désabonner,

rendez-vous sur ce <a href='#OPTOUTLINK#'>lien</a>.

...

</html>

 

Just like the link for unsubscribing, there is also a customized field allowing a preview link to be inserted into the HTML creation. This link must be inserted via the #PREVIEWLINK# field which will be replaced with the preview link.

For example

<html>

...

Si le message ne s'affiche pas,

merci de suivre ce <a href='#OPTOUTLINK#'>lien</a>.

...

</html>

 

When mailings are created, the links present in the HTML and TEXT portions are detected in order to be tracked. For each link, an id corresponding to both the link and to the contact is added which allows us to know when link was clicked, by whom, when, etc.

To deactivate link tracking, simply add the attribute rel= "notrack" in each of the links.

For example, to not track a link present in an image

<html>

...

<a rel="notrack" href="http://monurl.com">

 <img src="http://monimage.com" />

</a>

...

</html>

 

Specifying a URL or PING

Instead of regularly polling the status of a message until it is received ("pull" mode), you can be informed ("push" mode) of the arrival of a status linked to the messages that you have sent.

For this, you supply, when the mailing is created, an address on your server ‘http://myserver.com/ping.php ?id=#id# ’ for example, and the Digitaleo platform will call this address with the id of the email when its status changes.

This URL is passed in the pingUrl parameter.

Cumulating changes in status ("batch") is possible by using the #ids# pattern instead of #id#. The ids are then separated by commas.

Syntax of the period for automated or recurring campaigns

The expected syntax is inspired by the crontab format

<minute> <hour> <day> <month> <dayWeek>
 

Note: dayWeek is a series of indexes (0=Sunday, 1=Monday, etc)

For recurring campaigns, the possible values are:

  • minute & hour: value

  • day: value, interval, every day ("*")

  • month: value, interval, every month ("*")

  • dayWeek: value, interval, every day of the week ("*")

For triggered campaigns, a reference to the day and to the month of the autoField can be used with the values "D" and "M". The possible values are:

  • minute & hour: value

  • day: reference to the day of the "autoField" field ("D") - a number of days

  • month: all months ("*") or reference to the month of the "autoField" field ("M") - a number of months

  • dayWeek: value, interval, every day of the week ("*")

Example for recurring campaigns

00 12 1 * *

Every 1st day of the month at 12:00, regardless of the day of the week

 

Example for triggered campaigns

30 11 D-1 M 1,2,3,4,5,6

Once a year at 11:30 the day before the date in the contact field, with a shift to Saturday if the date falls on a Sunday

 

Example 1: Creating a campaign comprising 2 steps, of one is prioritized and one combined

$myNewCampaign = $messengeo->campaignsCreate(
 array(
   'name'       	=> 'Soldes du 10 juillet',
   'reference'  	=> '12',
   'listId'     	=> '2674',
   'steps'      	=> array(
       array(
           'mode'   	=> 'prioritized',
           'priorities' => 'EMAIL,SMS',
           'date'   	=> '2013-07-10 12:00:00',
           'mailings'   => array(
               array(
                   'name'     	=> 'mailing email du 10 juillet',
                   'text'     	=> 'Bientôt les soldes',
                   'html'     	=> '

Titre de la page

Bientôt les soldes

', 'subject' => "Info soldes", 'replyContact' => 'sender@gmail.com', 'media' => 'EMAIL', ), array( 'name' => 'mailing sms du 10 juillet', 'text' => 'Bientôt les soldes', 'media' => 'SMS', ), ), 'reference' => 'Ref1', ), array( 'mode' => 'combined', 'date' => '2013-07-15 12:00:00', 'mailings' => array( array( 'name' => 'mailing email du 15 juillet', 'text' => 'Profitez des soldes', 'html' => 'Titre de la pageProfitez des soldes', 'subject' => "Rappel des soldes", 'replyContact' => 'sender@gmail.com', 'media' => 'EMAIL', ), array( 'name' => 'mailing sms du 15 juillet', 'text' => 'Profitez des soldes', 'media' => 'SMS', ), ), ), ) ) );

 

Example 2: How to create an automated campaign

Creating an automated campaign using the birthDate field knowing that the message must be sent once a year at 11:45 the day before the birthday, with a shift to Saturday if the date falls on a Sunday.

$autoCampaign = $messengeo->campaignsCreate(
  array(
    'type'  => 'TRIGGERED',
    'steps' => array(
       array(
         ...
         'autoField'  => 'birthDate',
         'autoPeriod' => '45 11 D-1 M 1,2,3,4,5,6',
         ...
      )
    )
  )
);
 

Example 3: How to create an automated campaign - II

Creating an automated campaign using the field03 field knowing that the message has to be sent every month at 12:30 two days before the date mentioned in the contact.

$autoCampaign = $messengeo->campaignsCreate(
 array(
   'type'  => 'TRIGGERED',
   'steps' => array(
      array(
        ...
        'autoField'  => 'field03',
        'autoPeriod' => '30 12 D-2 * *',
        ...
      )
    )
  )
);
 

Example 4: How to create an automated campaign - III

Creating an automated campaign using the field06 field knowing that the message has to be sent every year at 12:30 1 month before the date mentioned in the contact.

$autoCampaign = $messengeo->campaignsCreate(
 array(
   'type'  => 'TRIGGERED',
   'steps' => array(
     array(
        ...
        'autoField'	=> 'field06',
        'autoPeriod'   => '30 12 D M-1 *',
        ...
     )
   )
 )
);
 

Example 5: How to create a recurring campaign

Creating a recurring campaign knowing that the message has to be sent (to all of the contacts) on the 10th of every month at 12:30. If the 10th falls on a Sunday, the message will be sent on the 9th.

$autoCampaign = $messengeo->campaignsCreate(
 array(
   'type'  => 'RECURRING',
   'steps' => array(
     array(
        ...
        'autoPeriod'   => '30 12 10 * 1,2,3,4,5,6',
        ...
     )
   )
 )
);
 

Example 6: How to create a transactional campaign

Creating a transactional campaign of which the message will be sent to each new recipient that is associated with it.

$myNewCampaign = $messengeo->campaignsCreate(
 array(
   'name'       	=> 'Campagne nouveau client',
   'type'          => 'TRANSACTIONAL',
   'steps'      	=> array(
       array(
           'priorities' => 'EMAIL',
           'mailings'   => array(
               array(
                   'name'     	=> 'mailing pour les nouveaux clients',
                   'html'     	=> '

Titre de la pageBienvenue en tant que nouveau client', 'subject' => "Bienvenue", 'replyContact' => 'sender@gmail.com', 'media' => 'EMAIL', ), ) )) ));

 

Creation of two new contacts associated with the previously created transactional campaign, having 15 for id. In the following example, the messages will be sent to the contacts on the date of 16/02/2015 at 5 o'clock. If no date is defined, the messages will then be sent automatically.

$myNewContacts = $messengeo->campaigncontactsCreate(
 array(
   'campaignId'     => 15,
   'date'          => '2015-02-16 05:00:00',
   'contacts'       => array(
       array(
           'email'     => 'contact1@digitaleo.com',
           'firstName' => 'Contact1 FirstName',
           'LastName'  => 'Contact1 LastName'
       ),
       array(
           'email'     => 'contact2@digitaleo.com',
           'firstName' => 'Contact2 FirstName',
           'LastName'  => 'Contact2 LastName'
       )
   )
 )
);
 

Example 7: Spreading out the sending

Creating an SMS campaign in packets of 100 messages every 20 minutes.

$myNewCampaign = $messengeo->campaignsCreate(
 array(
   'name'       	=> 'appel conseiller',
   'reference'  	=> '12',
   'listId'     	=> '2674',
   'steps'      	=> array(
       array(
           'date'   	=> '2013-07-10 12:00:00',
           'mailings'   => array(
               array(
                   'text'     	=> 'Bonjour, appelez votre conseiller au 06... pour discuter de votre contrat',
                   'media'    	=> 'SMS',
                   'batchVolume'    	=> 100, // nombre de messages
                   'batchDelay'    	=> 20, // nombre de minutes entre chaque paquet
               ),
           ),
       ),
   )
 )
);
 

Canceling a campaign

List of parameters to supply

 

Notes

  • The end date of the campaign takes the date of cancellation

  • The status of the campaign is modified ("canceled" if the cancellation occurs before the start date of the campaign, "interrupted" otherwise)

Return

A resource of which the only property is success is returned. 1 in case of a successful cancellation 0 otherwise.

{
  success: 1,
}
 

Example

<table class="api-table>

Parameter

Type

Description

Required?

action

string

=cancel

allows you to specify the action to be carried out

yes (action=cancel)

id

int

Id of the campaign to be canceled

yes

POST /rest/campaigns HTTP/1.1

Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJpZCI6ImYyMzE2…
Host: api.messengeo.net
Content-Type: application/x-www-form-urlencoded

action=cancel&id=24

 

Updating a campaign

List of parameters to supply

Parameter

Type

Description

Required?

action

string

=update

allows you to specify the action to be carried out

no if the verb http PUT is used, Otherwise yes (action=update)

id

int

List of campaign Ids to be updated

yes

metaData

array

List of fields of the campaign Ids be updated. cf. 3.1.5.2

yes

 

List of fields of a campaign Ids that can be updated

Parameter

Type

Description

name

string

Name of the campaign

reference

string

Client reference of the campaign

comment

array

Comment on the campaign

 

Return

This method returns the number of campaigns affected by the filter passed as input

{
  count: 1,
}
 

Example

POST /rest/campaigns HTTP/1.1

Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJpZCI6ImYyMzE2…
Host: api.messengeo.net
Content-Type: application/x-www-form-urlencoded

action=update&id=24&metaData={"name":"Le nouveau nom de la campagne","comment":"Le nouveau commentaire de la campagne"}

 

With Curl

curl

-X PUT

-H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbG...ccOqbVow8xOQyQ"

-d id=24

-d metaData='{"name":"Le nouveau nom de la campagne","comment":"Le nouveau commentaire de la campagne"}'

https://api.messengeo.net/rest/campaigns

 

Retrieving statistics for a campaign

List of available filters

Property

Description

mailingId

Filter according to one or more mailing ids

dateStart

Filter according to a start date of the mailing

dateEnd

Filter according to an end date of the mailing

messageId

Filter according to one or more message ids

media

Filter according to a media

mailingName

Filter according to a mailing name

period

Filter according to a period (statistics group: year, month, day)

 

Return

{
	total: 45554,
	wait: 0,
	on: 45554,
	ok: 0,
	ko: 0,
	no: 0,
	optout: 0,
	opened: 0,
	clicked: 0,
	hb: 0,
	sb: 0,
	rep: 0,
	date: null
}
 

Examples

Example 1: Retrieving the statistics of two mailings

GET /rest/statistics HTTP/1.1

Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJpZCI6ImYyMzE2…
Host: api.messengeo.net
Content-Type: application/x-www-form-urlencoded

mailingId=8374,8375

 

With Curl

curl

-X GET

-H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbG...ccOqbVow8xOQyQ"

-d mailingId=8374,8375

 

https://api.messengeo.net/rest/statistics

 

Example 2: Retrieving the statistics of a mailing per day

GET /rest/statistics HTTP/1.1

Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJpZCI6ImYyMzE2…
Host: api.messengeo.net
Content-Type: application/x-www-form-urlencoded

mailingId=8374

period=day

 

With Curl

curl

-X GET

-H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbG...ccOqbVow8xOQyQ"

-d mailingId=8374

-d period=day

 

https://api.messengeo.net/rest/statistics