Latest Legacy

Register a campaign

This API lets you register a campaign using a preexisting brand.

API Endpoint

POST https://api.plivo.com/v1/Account/{auth_id}/10dlc/Campaign/

Arguments

campaign_aliasstringrequiredA friendly name for your campaign. This name appears on the Plivo console.
brand_idstringrequiredID of the for which campaign creation request is being submitted.
verticalstringrequiredIndicates the industry specific to the message use case.

Allowed values: PROFESSIONAL, REAL_ESTATE, HEALTHCARE,HUMAN_RESOURCES, ENERGY, ENTERTAINMENT, RETAIL, TRANSPORTATION, AGRICULTURE, INSURANCE, POSTAL, EDUCATION, HOSPITALITY, FINANCIAL, POLITICAL, GAMBLING, LEGAL, CONSTRUCTION, NGO,MANUFACTURING, GOVERNMENT, TECHNOLOGY,COMMUNICATION

descriptionstringrequiredA brief description of the campaign and how it’s relevant to your business — minimum of 40 characters.
usecasestringrequiredIndicates your messaging use case.

Allowed values: 2FA, ACCOUNT_NOTIFICATION, CUSTOMER_CARE, DELIVERY_NOTIFICATION, FRAUD_ALERT, HIGHER_EDUCATION, LOW_VOLUME, MARKETING, MIXED, POLLING_VOTING, PUBLIC_SERVICE_ANNOUNCEMENT, SECURITY_ALERT, STARTER.

STARTER brands can only use STARTER as their use case.

 

sample1stringrequiredThe content of a sample message that you will send through this campaign. You must provide at least two samples, each with a minimum of 20 characters.
sample2stringrequiredThe content of the second sample message.
subscriber_optinbooleanrequiredA confirmation that you are collecting and processing customer opt-ins.

Allowed value: true

subscriber_optoutbooleanrequiredA confirmation that you are collecting and processing customer opt-outs.

Allowed value: true

subscriber_helpbooleanrequiredA confirmation that you have implemented a message reply that tells customers how they can contact the message sender when they reply with the “HELP” keyword.

Allowed value: true

direct_lendingbooleanrequiredIndicates whether this campaign includes content related to direct lending or other loan arrangements.

Allowed values: true, false

embedded_linkbooleanrequiredIndicates whether embedded links are being used. Operators do not accept public URL shorteners.

Allowed values: true, false

embedded_phonebooleanrequiredIndicates whether the campaign is using an embedded phone number other than the required HELP contact number.

Allowed values: true, false

age_gatedbooleanrequiredIndicates whether the campaign includes any age-gated content as defined by operator and CTIA guidelines.

Allowed values: true, false

affiliate_marketingbooleanrequiredIndicates whether affiliate marketing was used in the construction of this campaign.

Allowed values: true, false

sub_usecaseslistOnly applicable when use case is STARTER, MIXED, or LOW_VOLUME. Indicates two to five comma-separated use cases.

Allowed values: 2FA, ACCOUNT_NOTIFICATION,CUSTOMER_CARE, DELIVERY_NOTIFICATION, FRAUD_ALERT, HIGHER_EDUCATION, MARKETING, POLLING_VOTING, PUBLIC_SERVICE_ANNOUNCEMENT, SECURITY_ALERT

message_flow stringrequiredDescribes how a customer opts in to a campaign, thereby giving consent to the sender to send messages. The message flow must be clear and inform customers about the nature of the campaign. If a campaign supports multiple opt-in mechanisms, you must mention all of them here.

Check documentation for samples.

help_message stringrequiredIndicates the response to the HELP keyword. It may include the brand name and support contact information.

Check documentation for samples.

optout_message stringrequiredIndicates the response to the STOP keyword. It must include acknowledgement of the opt-out request and confirmation that no further messages will be sent, and may include the brand name.

Check documentation for samples.

optin_messagestringMessage sent to subscribers to confirm their opt-in to the campaign.
optin_keywordsstringOpt-in keywords associated with the campaign. If more than one, provide a comma-separated list with no special characters or embedded spaces.
help_keywordsstringHelp keywords associated with the campaign, in all capital letters. If more than one, provide a comma-separated list with no special characters or embedded spaces.
urlstringThe fully qualified URL to which status update callbacks for the message should be sent.
methodstringThe HTTP method to be used when calling the URL defined above.

Allowed values: GET, POST
Defaults to POST

Returns

api_id for the request, unique campaign_id, and success message

Response

HTTP Status Code: 200

{
    "apiId": "a640fba2-3b14-11ed-95d8-0242ac110004",
    "campaignId": "CVWMV6V",
    "message": "Request to create campaign was received and is being processed."
}

Example Request

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import sys
sys.path.append("../plivo-python")
import plivo

client = plivo.RestClient("<auth_id>", "<auth_token>")
sub_usecase = ["CUSTOMER_CARE", "2FA"]
response = client.campaign.create(
    brand_id="<brand_id>",
    campaign_alias="campaign_sample message",
    vertical="INSURANCE",
    usecase="MIXED",
    sub_usecases=sub_usecase,
    description="Campaign description is a mandatory parameter, minimum 40 characters",
    embedded_link=False,
    embedded_phone=False,
    age_gated=False,
    subscriber_optin=True,
    subscriber_optout=True,
    subscriber_help=True,
    affiliate_marketing=False,
    sample1="Sample message 1 should have a minimum of 20 characters",
    sample2="Sample message 2 should have a minimum of 20 characters",
    url="https://<yoursite>.com/test",
    method="POST",
    message_flow="Message flow is a mandatory parameter, minimum 40 characters",
    help_keywords="HELP,INFO,MORE",
    help_message="Help message is a mandatory parameter, minimum 20 characters",
    optin_keywords="YES,SUBSCRIBE",
    optin_message="Opt-in message should have a minimum of 20 characters",
    optout_keywords="NO,STOP",
    optout_message="Opt-out message should have a minimum of 20 characters",
)
print(response)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
require "rubygems"
require "/etc/plivo-ruby/lib/plivo.rb"
include Plivo

api = RestClient.new("<auth_id>", "<auth_token>")

begin# Create Campaign
response = api.campaign.create(brand_id: "<brand_id>",
    campaign_alias: "rubytest-1",
    vertical: "ENTERTAINMENT",
    usecase: "MIXED",
    sub_usecases: ["2FA", "MARKETING"],
    description: "Campaign description should have minimum of 40 characters",
    direct_lending: false,
    affiliate_marketing: false,
    embedded_link: false,
    embedded_phone: false,
    age_gated: false,
    subscriber_optin: true,
    subscriber_optout: true,
    subscriber_help: true,
    sample1: "Sample message 1 should have a inimum of 20 characters",
    sample2: "Sample message 2 should have a minimum of 20 characters",
    url: "<https://<yourdomain>.com/create_campaign_status/>",
    method: "POST",
    message_flow: "Message flow is a mandatory parameter, minimum 40 characters",
    help_keywords: "HELP,INFO,MORE",
    help_message: "Help message is a mandatory parameter, minimum 20 characters",
    optin_keywords: "YES,SUBSCRIBE",
    optin_message: "Opt-in message should have a minimum of 20 characters",
    optout_keywords: "NO,STOP",
    optout_message: "Opt-out message should have a minimum of 20 characters",
)
puts response
rescue PlivoRESTError => e
    puts 'Exception: ' + e.message
end
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
let plivo = require('plivo');
let fs = require('fs');

let client = new plivo.Client("<auth_id>", "<auth_token>");
var callback = {"url":"http://plivobin.non-prod.plivops.com/xvm5fsxv", "method":"POST", "optout_keywords":"NO,STOP", "optin_keywords":"YES,SUBSCRIBE", "help_keywords":"HELP,INFO,MORE", "optin_message":"Opt-in message should have a minimum of 20 characters"}
console.log('test');
client.campaign.create("<brand_id>","all 7 fields optional","INSURANCE","MIXED",[
    "CUSTOMER_CARE",
    "2FA"
],"sample description text should 40 character following attributes that were specified at the time", false,false,false,false,true,true,true,true, "Sample message 1 should have a minimum of 20 characters", "Sample message 2 should have a minimum of 20 characters","Message flow is a mandatory parameter, minimum 40 characters ","Help message is a mandatory parameter, minimum 20 characters","Opt-out message should have a minimum of 20 characters", callback )
 .then(function (response) {
    console.log(JSON.stringify(response));
}).catch(function (error) {
  console.log("err");
  console.log(error);
 });
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?php
require '/etc/plivo-php/vendor/autoload.php';
use Plivo\RestClient;
$client = new RestClient("<auth_id>", "<auth_token>");
$client
    ->client
    ->setTimeout(60);
try
{
    $callback = array(
        "url" => "https://<yourdomain>.com/tendlc_status/",
        "method" => "POST",
        "optout_keywords" => "optout,keyword",
        "help_keywords" => "helpkeywords",
        "optin_keywords" => "optinkeywords",
        "optin_message" => "In case you want to use optin"
    );
    $res = $client
        ->campaign
        ->create("<brand_id>", "campaign name sample", "INSURANCE", "MIXED", ["CUSTOMER_CARE", "2FA"], "sample description text should be 40 characters", False, False, False, False, True, True, True, true, "sample test - 1 description text should be 40 characters ", "sample test 2 description text should be 40 characters ", "message_flow description text should be 40 characters", "help_message description text should be 40 characters", "optout_message description text should be 40 characters", $callback);
    print_r($res);
}
catch(PlivoRestException $ex)
{
    print_r($ex);
}
?>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package com.plivo.examples;

import com.plivo.api.Plivo;
import com.plivo.api.models.campaign.Campaign;
import com.plivo.api.models.campaign.CampaignCreateResponse;

public class GetCampaign {
  public static void main(String[] args) {
    Plivo.init("<auth_id>", "<auth_token>");

    try {
      String[] sub_usecase = new String[] {
        "2FA",
        "MARKETING"
      };
      CampaignCreateResponse response = Campaign.creator("<brand_id>",
        "java campaign",
        "ENTERTAINMENT",
        "MIXED",
        sub_usecase,
        "description",
        false,
        false,
        false,
        false,
        false,
        true,
        true,
        true,
        "sample message 1",
        "sample message 2",
        "http://plivobin.non-prod.plivops.com/y27a0hy2",
        "POST",
        "sample message_flow text",
        "sample help_message text",
        "sample optout_message text",
        "YES,SUBSCRIBE",
        "sample optin_message text",
        "NO,STOP",
        "HELP,INFO,MORE").create();
      System.out.println(response);
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
using System;
using System.Collections.Generic;
using Plivo;
using Plivo.Exception;

namespace dotnet_project {
  class Ten_dlc {
    static void Main(string[] args) {

      var api = new PlivoApi("<auth_id>", "<auth_token>");

      // Create Campaign
      string[] sub_usecase = {
        "CUSTOMER_CARE",
        "2FA"
      };

      Console.WriteLine("Create Campaign");
      try {
        var response = api.Campaign.Create(
          campaign_alias: "camapaign_ren_1",
          description: "Dotnet_Test_Ren",
          brand_id: "BHXDNDJ",
          vertical: "INSURANCE",
          usecase: "MIXED",
          embedded_link: false,
          embedded_phone: false,
          direct_lending: false,
          age_gated: false,
          affiliate_marketing: false,
          subscriber_optin: true,
          subscriber_optout: true,
          subscriber_help: true,
          sample1: "sample message 1",
          sample2: "sample message 2",
          message_flow: "",
          help_message: "empty case for message flow",
          optout_message: "test optout message",
          sub_usecases: sub_usecase,
          url: "https://<yourdomain>.com/tendlc_status/",
          method: "POST",
          optin_keywords: "",
          optin_message: "In case you want to use optin",
          optout_keywords: "stop, info",
          help_keywords: "HELP,info,more"
        );
        Console.WriteLine(response);
      } catch (PlivoRestException e) {
        Console.WriteLine("Exception: " + e.Message);
      }

    }
  }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
curl -i --user auth_id:auth_token \
    -H "Content-Type: application/json" \
    -d '{
            "brand_id": "{brand_id}",
            "vertical": "INSURANCE",
            "usecase": "MIXED",
            "sub_usecases":["2FA","ACCOUNT_NOTIFICATION", "CUSTOMER_CARE", "DELIVERY_NOTIFICATION", "FRAUD_ALERT"],
            "description": "OTP registration",
            "direct_lending": true,
            "affiliate_marketing": false,
            "embedded_link": false,
            "embedded_phone": false,
            "age_gated": false,
            "subscriber_optin": true,
            "subscriber_optout": true,
            "subscriber_help": true,
            "sample1": "Your OTP is 1234",
            "sample2": "Your order {ID} is out for delivery",
            "url": "https://<yourdomain>.com/tendlc_status/",
            "method": "POST"
        }' \
    https://api.plivo.com/v1/Account/{auth_id}/10dlc/Campaign/
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package main

import (
        "fmt"

        "github.com/plivo/plivo-go/v7"
)

func main() {
        client, err := plivo.NewClient("<auth_id>", "<auth_token>", &plivo.ClientOptions{})
        if err != nil {
                fmt.Print("Error", err.Error())
                return
        }
        campaignAlias := "campaign name sample"
        embeddedLink := false
        embeddedPhone := false
        ageGated := false
        directLending := false
        subUsecases := []string{"CUSTOMER_CARE", "2FA"}
        sample1 := "Sample message 1 should have a minimum of 20 characters"
        sample2 := "Sample message 2 should have a minimum of 20 characters"
        response, err := client.Campaign.Create(plivo.CampaignCreationParams{
                BrandID:          "<brand_id>",
                CampaignAlias:    &campaignAlias,
                Vertical:         "INSURANCE",
                Usecase:          "MIXED",
                SubUsecases:      &subUsecases,
                Description:      "Campaign description should have minimum of 40 characters",
                EmbeddedLink:     &embeddedLink,
                EmbeddedPhone:    &embeddedPhone,
                AgeGated:         &ageGated,
                DirectLending:    &directLending,
                SubscriberOptin:  true,
                SubscriberOptout: true,
                SubscriberHelp:   true,
                Sample1:          &sample1,
                Sample2:          &sample2,
                MessageFlow:      "Message flow is a mandatory parameter, minimum 40 characters",
                HelpKeywords:     "HELP,INFO,MORE",
                HelpMessage:      "Help message is a mandatory parameter, minimum 20 characters",
                OptinKeywords:    "YES,SUBSCRIBE",
                OptinMessage:     "Opt-in message should have a minimum of 20 characters",
                OptoutKeywords:   "NO,STOP",
                OptoutMessage:    "Opt-out message should have a minimum of 20 characters",
        },
)
if err != nil {
        fmt.Print("Error", err.Error())
        return
}
fmt.Printf("Response: %#v\n", response)
}