Loading...

Basic Campaign Setup


The following tutorials (Basic Campaign) will guide you through the process of creating a campaign, and a keyword and then finally, assigning that campaign to the keyword. At the end of this tutorial, you will be able to send a text message to the keyword and receive the response you created back from the system.

NOTE You need to have an account to send any messages. Click here to go to Account Creation Tutorials.

Step 1 : Create new Basic Campaign

A Basic Campaign (type = 1) will allow you to send a message to contacts and/or auto-respond to incoming SMS messages when attached to a keyword.

ContentTemplates contain the actual message. 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 LongCode SMS channel (22) and in English (0). See the API Overview for a complete description of channel types and languages supported. Send an HTTP/1.1 POST to the campaign endpoint:

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": "0",
        "Template": "Welcome to our mobile club!"
        }
    ]
    }
}

Response:

201 CREATED
Content-Type: application/json
  {
    "Id": "{CampaignId}",
    "AccountId": "{AccountId}",
    "SubscriptionId": {SubscriptionId},
    "Name": "Welcome Message",
    "CampaignTypeId": 1,
    "StatusId": 0,
    "StatusReason": null,
    "ContentId": {ContentId},
    "Session": false,
    "SessionLength": null,
    "Created": "2013-06-19T19:04:18.47",
    "Modified": "2013-06-19T19:04:18.47",
    "CreatedBy": null,
    "ModifiedBy": null
  }

NOTE

Template encoding must be set to 0 (plain text).

Content templates can be modified sending a PUT with a new ContentTemplate resource. Also, new content templates can be added to the campaign by sending a POST to request with a ContentTemplate resource.

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": "0","Template": "Welcome to our mobile club!"}]}}'

Step 2: Verify new campaign

To verify that the campaign was created, perform a HTTP/1.1 GET operation on the new resouce.

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

Verify the new campaign with curl

curl -v --user {apiKey}:{Secret} "https://api.3seventy.com/api/v2.1/account/{AccountId}/campaign/{CampaignId}" \
-H "Content-Type: application/json" \
-H "Accept: application/json"

Step 3: Create new keyword

Please refer to the Keyword Creation Tutorial.


Step 4: Attach Keyword to Campaign

When a Keyword is attached to a Campaign, anyone who texts into the short code associated with the channel will receive the message included in the Campaign resource. Send an HTTP/1.1 POST requests to the resource:

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

POST Body

"{CampaignId}"

Attach a keyword to a campaign with curl

curl -v --user {apiKey}:{Secret} "https://api.3seventy.com/api/v2.1/account/{AccountId}/channel/{ChannelId}/keyword/{KeywordId}/campaign" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '"{CampaignId}"'

Setp 5: Verify Campaign Attachment

To verify that the keyword has been attached to the campaign, simply send an HTTP/1.1 GET request to the following resource and note the CampaignId:

GET   https://api.3seventy.com/api/v2.1/account/{AccountId}/channel/{ChannelId}/keyword/{KeywordId}

Verify the keyword attachment with curl

curl -v --user {apiKey}:{Secret} "https://api.3seventy.com/api/v2.1/account/{AccountId}/channel/{ChannelId}/keyword/{KeywordId}" \
-H "Content-Type: application/json" \
-H "Accept: application/json"

Step 6: Live test!

Send a text message containing your new keyword to the Channel Code associated with the channel. You should receive the response contained in the message template of the campaign!