Loading...

Personalized Campaign


Step 1 : Create Contact Attribute

Personalized campaigns use Contact Attributes to insert dynamic content – specific text – into the message body. See the tutorial for Creating a Contact List to setup an attribute and a contact list for this campaign.


Step 2: Create New Basic Campaign

A Basic campaign (type = 1) will allow you to send a message to contacts or auto-respond to incoming SMS messages when attached to a keyword. Content templates contain the actual message text. One Content template can be added for each channel type - language combination supported by the campaign. For this example, we'll create a campaign with 1 message template for the SMS channel (0) and in English (0). See the API Overview for a complete description of channel types and languages supported.

Send a HTTP/1.1 POST request to the resource:

POST   https://api.3seventy.com/api/v2.1/account/{AccountId}/campaign

POST Body

{
"Name": "Welcome Message",
"CampaignTypeId": 1,
"Content":{
    "Name": "Welcome Message Content",
    "Templates":
        [{
        "ChannelTypeId": "0",
        "LanguageId": "0",
        "EncodingTypeId": "1",
        "Template": "@(Contact.FirstName), welcome to our mobile club! Text STOP to end"
        }]
    }
}
    

Create a Basic campaign with curl

curl -v --user  {apiKey}:{Secret} "https://api.3seventy.com/api/v2.1/account/{AccountId}/campaign" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"Name": "Welcome Message","CampaignTypeId": 1,"Content":{"Name": "Welcome Message Content","Templates":[{"ChannelTypeId": "0","LanguageId": "0","EncodingTypeId": "1","Template": "@(Contact.FirstName), welcome to our mobile club! Text STOP to end"}]}}'

Step 3: Insert Contact Attribute

To personalize the message and include a contact attribute such as FirstName or PreferredLocation, first use Encoding TypeID=1 on the message template and create the campaign like such.

"EncodingTypeId": "1",         
"Template": "@(Contact.FirstName), welcome to our mobile club! Text STOP to end"