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 (limit: 100 characters) of the campaign and how it’s relevant to your business.
    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.
    sample2stringrequiredThe content of a sample message that you will send through this campaign. You must provide at least two samples.
    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

    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

    {
       "api_id": "02de04b2-bafb-11ec-bb91-0242ac110003",
       "campaign_id": "CFE3MUZ",
       "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
    
    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 name sssample",
                   vertical = "INSURANCE",
                   usecase = "MIXED",
                   sub_usecases = sub_usecase,
                   description = "sample description text",
                   embedded_link = False,
                   embedded_phone = False,
                   age_gated = False,
                   direct_lending = False,
                   subscriber_optin = True,
                   subscriber_optout = True,
                   subscriber_help = True,
                   sample1 = "test 1",
                   sample2 = "test 2",
                   url="https://example.com/test",
                   method="POST")
    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
    
    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: "<Campaign Name>",
                                        vertical: "ENTERTAINMENT",
                                        usecase: "MIXED",
                                        sub_usecases: ["2FA","MARKETING"],
                                        description: "<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"
    
                                )
    
    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
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    
    let plivo = require('plivo');
    
    let client = new plivo.Client("<auth_id>", "<auth_token>");
    
    var callback = {"url":"https://<yourdomain>.com/tendlc_status/", "method":"POST"}
    client.campaign.create(
            "<brand_id>", //brand_id
            "campaign name sssample", //campaign_alias
            "INSURANCE", //vertical
            "MIXED", //usecase
            [
                "CUSTOMER_CARE", //sub_usecases
                "2FA" //sub_usecases
            ],
            "sample description text", //description
            false, //embedded_link
            false, //embedded_phone
            false, //age_gated
            false, //direct_lending 
            true, //subscriber_optin
            true, //subscriber_optout
            true, //subscriber_help
            "hey", //sample1
            "test", //sample2
            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
    
    <?php
    
    # Available in versions >= 4.29.0 (https://github.com/plivo/plivo-php/releases/tag/v4.29.0)
    
    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");
        $res = $client
            ->campaign
            ->create("<brand_id>", "campaign name sssample", "INSURANCE", "MIXED", ["CUSTOMER_CARE", "2FA"], "sample description text", False, False, False, False, True, True, True, "test 1", "test 2", $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
    
    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 PlivoTest {
    
        public static void main(String[] args) {
    
            Plivo.init("<auth_id>", "<auth_token>");
    
            // Create Campaign
    
            String[] sub_usecase = new String[] {
                "2FA",
                "MARKETING"
            };
            try {
                CampaignCreateResponse response = Campaign.creator("<Brand_ID>",
                    "campaign name",
                    "ENTERTAINMENT",
                    "MIXED",
                    sub_usecase,
                    "description",
                    false,
                    false,
                    false,
                    false,
                    false,
                    true,
                    true,
                    true,
                    "sample1",
                    "sample2",
                    "https://plivobin.non-prod.plivops.com/y27a0hy2",
                    "POST").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
    
    // Available in versions >= 5.9.0 (https://github.com/plivo/plivo-dotnet/releases/tag/v5.9.0)
    
    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>");
                try
                {
                    var response = api.Campaign.Create(
                    brand_id: "BMIORKY",
                    vertical: "INSURANCE",
                    usecase: "2FA",
                    sub_usecases:  new List<string>() {"2FA","MARKETING"},
                    description: "OTP Campaign",
                    embedded_link: false,
                    embedded_phone: false,
                    direct_lending: true,
                    age_gated: false,
                    subscriber_optin: true,
                    subscriber_optout: true,
                    subscriber_help: true,
                    sample1: "sample message 1",
                    sample2: "sample message 2",
                    url: "https://<yourdomain>.com/tendlc_status/",
                    method: "POST"
            );
                    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
    
    package main
    
    import (
    	"fmt"
    	"os"
    
    	plivo "github.com/plivo/plivo-go"
    )
    
    func main() {
    	client, err := plivo.NewClient("<auth_id>", "<auth_token>", &plivo.ClientOptions{})
    	if err != nil {
    		panic(err)
    	}
    	campaignAlias := "campaign_name_sample"
    	embeddedLink := false
    	embeddedPhone := false
    	ageGated := false
    	directLending := false
    	subUsecases := []string{"CUSTOMER_CARE"}
    	sample1 := "test1"
    	sample2 := "test2"
    	params := plivo.CampaignCreationParams{
    		BrandID:          "<BrandID>",
    		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,
    		Method:           "POST",
    		URL:              "https://example.com/test",
    	}
    	// Create Campaign
    	response, err := client.Campaign.Create(params)
    
    	if err != nil {
    		fmt.Printf("Error occurred while creating brand. error:%+v\n", err)
    		os.Exit(1)
    	} else {
    		fmt.Printf("%+v\n", response)
    	}
    }