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.

    Starting November 17, the description must have a 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.

    Starting November 17, the sample fields must have a minimum of 20 characters.

    sample2stringrequiredThe content of a sample message that you will send through this campaign. You must provide at least two samples.

    Starting November 17, the sample fields must have a minimum of 20 characters.

    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-separates 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 stringrequired beginning November 17Describes 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 stringrequired beginning November 17Indicates the response to the HELP keyword. It may include the brand name and support contact information.

    Check documentation for samples.

    optout_message stringrequired beginning November 17Indicates 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.

    campaign_aliasstringrequiredA friendly name for your campaign. This name appears on the Plivo console.
    brand_id stringrequiredID of the brand with which the campaign is to be associated.
    vertical stringrequiredIndustry 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

    usecase stringrequiredMessaging 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.

    description stringrequiredA brief description of the campaign and how it’s relevant to your business.

    Starting November 17, the description must have a minimum of 40 characters.

    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
    
    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="sample description  is mandatory param and minimum 40 character,sample description  is mandatory param and minimum 40 character",
        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 ",
        sample2="sample message 2",
        url="http://example.com/test",
        method="POST",
        message_flow="sample message_flow text",
        help_message="sample help_message text",
        optin_keywords="YES,SUBSCRIBE",
        optin_message="sample optin_message text",
        optout_message="sample optout_message text",
        optout_keywords="NO,STOP",
        help_keywords="HELP,INFO,MORE",
    )
    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"
    include Plivo
    
    api = RestClient.new("<auth_id>", "<auth_token>")
    
    begin# Create Campaign
    response = api.campaign.create(brand_id: "BX83LFU",
        campaign_alias: "<Campaign Name>",
        vertical: "ENTERTAINMENT",
        usecase: "MIXED",
        sub_usecases: ["2FA", "MARKETING"],
        description: "sample description",
        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>",
        sample2: "<sample message 2>",
        url: "<https://<yourdomain>.com/create_campaign_status/>",
        method: "POST",
        message_flow: "sample message_flow text",
        help_message: "sample help_message text",
        optout_message: "sample optin_message text",
        optin_keywords: "YES,SUBSCRIBE",
        optout_keywords: "NO,STOP",
        help_keywords: "HELP,INFO,MORE",
        optin_message: "sample optin_message text",
    )
    
    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
    17
    18
    19
    20
    
    let plivo = require('plivo');
    
    let client = new plivo.Client("<auth_id>", "<auth_token>");
    var optional = {
        "url": "https://<yourdomain>.com/tendlc_status/",
        "method": "POST",
        "optout_keywords": "optoutkeyword,characters",
        "optin_keywords": "optinkeywords character",
        "help_keywords": "helpkeywords",
        "optin_message": "optin message"
    }
    client.campaign.create("BWER8ZK", "all 7 fields optional", "INSURANCE", "MIXED", [
            "CUSTOMER_CARE",
            "2FA"
        ], "sample description text should 40 character", false, false, false, false, true, true, true, true, "sample1", "sample2", "message_flow", "help_flow", "optout_message", optional)
        .then(function(response) {
            console.log(JSON.stringify(response));
        }).catch(function(error) {
            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" => "optin message"
        );
        $res = $client
            ->campaign
            ->create("<Brand_ID>", "campaign name sssample", "INSURANCE", "MIXED", ["CUSTOMER_CARE", "2FA"], "sample description text should be 40 characters", False, False, False, False, True, True, True, true, "sample test 1 ", "sample test 2 ", "message_flow", "help_flow", "optout_message", $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 description text should 20 character"
    	sample2 := "sample description text should 20 character"
    	response, err := client.Campaign.Create(plivo.CampaignCreationParams{
    		BrandID:          "<Brand_id>",
    		CampaignAlias:    &campaignAlias,
    		Vertical:         "INSURANCE",
    		Usecase:          "MIXED",
    		SubUsecases:      &subUsecases,
    		Description:      "sample description text",
    		EmbeddedLink:     &embeddedLink,
    		EmbeddedPhone:    &embeddedPhone,
    		AgeGated:         &ageGated,
    		DirectLending:    &directLending,
    		SubscriberOptin:  true,
    		SubscriberOptout: true,
    		SubscriberHelp:   true,
    		Sample1:          &sample1,
    		Sample2:          &sample2,
    		MessageFlow:      "sample message_flow text",
    		HelpMessage:      "sample help_message text",
    		OptinKeywords:    "YES,SUBSCRIBE",
    		OptinMessage:     "sample optin_message text",
    		OptoutMessage:    "sample optout_message text",
    		OptoutKeywords:   "NO,STOP",
    		HelpKeywords:     "HELP,INFO,MORE",
    	},
    	)
    	if err != nil {
    		fmt.Print("Error", err.Error())
    		return
    	}
    	fmt.Printf("Response: %#v\n", response)
    }