Update a campaign

    Update a 10DLC campaign from your account. This action is only allowed for campaigns that failed to register previously β€” that is, current registration_status = failed

    API Endpoint

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

    Arguments

    You can update only these fields of a campaign. You can pass one or more of the fields during the update.

    campaign_aliasstring

    A friendly name for your campaign. This name appears on the Plivo console.

    description string

    A brief description of the campaign and how it’s relevant to your business β€” minimum of 40 characters. 

    sample1 stringThe 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. 
    sample2 stringThe content of the second sample message. 
    message_flow stringDescribes 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 string

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

    Check documentation for samples. 

    optout_message stringIndicates 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. 
    optout_keywords stringOpt-out keywords associated with the campaign. If more than one, provide a comma-separated list with no special characters or embedded spaces.  
    optin_message stringMessage sent to subscribers to confirm their opt-in to the campaign. 
    optin_keywords stringOpt-in keywords associated with the campaign. If more than one, provide a comma-separated list with no special characters or embedded spaces. 
    help_keywords stringHelp 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. 

    Returns

    api_id and the campaign object for the campaign in question.

    Response

    HTTP Status Code: 200

    {
    "api_id": "6739b738-80ff-11ed-95f2-xxxxxxxxxxxxx",
    "campaign": {
    "brand_id": "BSJXPJH",
    "campaign_attributes": {
    "affiliate_marketing": false,
    "age_gated": false,
    "direct_lending": false,
    "embedded_link": false,
    "embedded_phone": false,
    "subscriber_help": true,
    "subscriber_optin": true,
    "subscriber_optout": true
    },
    "campaign_id": "CDB3KGW",
    "description": "for creating campaign description should have minimum 40 characteristics to perform the request",
    "help_keywords": "HELP,INFO,MORE",
    "help_message": "help message is mandatory param and minimum 20 character",
    "message_flow": "message flow is mandatory param and minimum 40 characters",
    "mno_metadata": {
    "AT&T": {
    "tpm": 4500
    },
    "T-Mobile": {
    "brand_tier": "TOP"
    },
    "US Cellular": {
    "tpm": 4500
    },
    "Verizon Wireless": {
    "tpm": 4500
    }
    },
    "optin_keywords": "YES,SUBSCRIBE",
    "optin_message": "optin message should have minimum 20 characters",
    "optout_keywords": "NO,STOP",
    "optout_message": "optout message should have minimum 20 characters",
    "registration_status": "FAILED",
    "reseller_id": "",
    "sample1": "sample message 1 should have minimum 20 characters",
    "sample2": "sample message 2 should have minimum 20 characters",
    "usecase": "2FA"
    }
    }
    

    Example Request

    1
    2
    3
    4
    5
    6
    7
    
    import sys
    sys.path.append("../plivo-python")
    import plivo
    client = plivo.RestClient(""<auth_id>", "<auth_token>")
    
    response = client.campaign.update('<Campaign_ID>', sample1='update sample1 on plivo and tcr', message_flow='message flow is mandatory param and minimum 40 characters', help_message='help messgae is mandatory param and minimum 20 character')
    print(response)
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    
    require "rubygems"
    require "/etc/plivo-ruby/lib/plivo.rb"
    include Plivo
    
    api = RestClient.new(""<auth_id>", "<auth_token>")
    
    begin
    
    puts("Update Campaign")
    response = api.campaign.update("<Campaign_ID>", params={sample1: "update sample1 on plivo and tcr", message_flow:"message flow is mandatory param and minimum 40 characters", help_message:"help messgae is mandatory param and minimum 20 character"})
    
    puts response
    rescue PlivoRESTError => e
    puts 'Exception: ' + e.message
    end
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    
    let plivo = require('plivo');
    let fs = require('fs');
    let client = new plivo.Client("<auth_id>", "<auth_token>");
    client.campaign.update("<Campaign_id>","","campaign discription should have minimum 40 charecterstics to perform the request","sample message 1 should have minimum 20 characters","sample 2 should be 20 minimum character","message flow is mandatory param and minimum 40 characters","help messgae is mandatory param and minimum 20 character","YES,SUBSCRIBE","optin message should have minimum 20 characters","NO,STOP","optout message should have minimum 20 characters","HELP,INFO,MORE").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
    
    <?php
    require '/etc/plivo-php/vendor/autoload.php';
    use Plivo\RestClient;
    $client = new RestClient("<auth_id>", "<auth_token>");
    $client->client->setTimeout(60);
    try {
    $res = $client->campaign->update("<Campaign_ID>", "update campaign discription should have minimum 40 charecterstics to perform the request","","sample 1 should be 20 minimum character","sample message 2 should have minimum 20 characters","message flow is mandatory param and minimum 40 characters","help messgae is mandatory param and minimum 20 character","YES,SUBSCRIBE","optin message should have minimum 20 characters","NO,STOP","optout message should have minimum 20 characters","HELP,INFO,MORE");
    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
    
    import java.io.IOException;
    
    import com.fasterxml.jackson.databind.ObjectMapper;
    import java.io.FileWriter;
    import java.util.Collections;
    import java.util.Iterator;
    import java.util.List;
    import java.util.Random;
    import java.net.URL;
    
    import com.plivo.api.Plivo;
    import com.plivo.api.exceptions.*;
    import com.plivo.api.models.campaign.Campaign;
    import com.plivo.api.models.campaign.CampaignUpdateResponse;
    
    public class GetCampaignTest {
    public static void main(String[] args) {
    Plivo.init("<auth_id>", "<auth_token>");
    // Update Campaign
    try
    {
    CampaignUpdateResponse response = Campaign.updater("<Campaign_ID>","","update campaign discription should have minimum 40 charecterstics to perform the request","sample 1 should be 20 minimum character","sample message 2 should have minimum 20 characters","message flow is mandatory param and minimum 40 characters","help messgae is mandatory param and minimum 20 character","YES,SUBSCRIBE","optin message should have minimum 20 characters","NO,STOP","optout message should have minimum 20 characters","HELP,INFO,MORE").update();
    System.out.println(response);
    }
    catch (PlivoRestException | IOException| PlivoValidationException 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
    
    using System;
    using Plivo;
    using Plivo.Exception;
    using Plivo.Utilities;
    using Newtonsoft.Json;
    using Newtonsoft.Json.Linq;
    
    namespace test
    {
    class Program
    {
    static void Main(string[] args)
    {
    var api = new PlivoApi("<auth_id>", "<auth_token>");
    try
    {
    Console.WriteLine("-------------------------------------campaign_update-------------------------------------");
    var campaign_update_response = api.Campaign.Update("<Campaign_ID>", description:"campaign discription should have minimum 40 charecterstics to perform the request", sample1: "sample message 1 should have minimum 20 characters", sample2: "sample message 2 should have minimum 20 characters", message_flow:"message flow is mandatory param and minimum 40 characters", help_message:"help messgae is mandatory param and minimum 20 character", optin_keywords:"YES,SUBSCRIBE", optin_message:"optin message should have minimum 20 characters", optout_keywords:"NO,STOP", optout_message:"optout message should have minimum 20 characters", help_keywords:"HELP,INFO,MORE");
    Console.WriteLine(campaign_update_response);
    
    }
    catch (PlivoRestException e)
    {
    Console.WriteLine("Exception: " + e.Message);
    }
    }
    
    }
    }
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    
    curl --location --request POST 'https://api.plivo.com/v1/Account/<Auth_id>/10dlc/Campaign/<Campaign_id>/' \
    --header 'Authorization: Basic XXXX==' \
    --header 'Content-Type: application/json' \
    --data-raw '{
    "description":"for creating campaign discription should have minimum 40 charecterstics to perform the request",
    "sample1": "sample message 1 should have minimum 20 characters",
    "sample2": "sample message 2 should have minimum 20 characters",
    "message_flow":"message flow is mandatory param and minimum 40 characters",
    "help_message":"help messgae is mandatory param and minimum 20 character",
    "optout_message":"optout message should have minimum 20 characters",
    "optout_keywords":"NO,STOP",
    "optin_message":"optin message should have minimum 20 characters",
    "optin_keywords":"YES,SUBSCRIBE",
    "help_keywords":"HELP,INFO,MORE"
    }'
    
    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
    
    package main
    import (
    "fmt"
    "os"
    plivo "github.com/plivo/plivo-go/v7"
    )
    func main() {
    client, err := plivo.NewClient("<auth_id>", "<auth_token>", &plivo.ClientOptions{})
    if err != nil {
    panic(err)
    }
    // Update Campaign
            description:= "creating  campaign discription should have minimum 40 charecterstics to perform the request"
            sample1:= "sample message 1 should have minimum 20 characters"
            sample2:= "sample message 2 should have minimum 20 characters"
            message_flow:= "message flow is mandatory param and minimum 40 characters"
            help_message:= "help messgae is mandatory param and minimum 20 character"
            optin_keywords:= "YES,SUBSCRIBE"
            optin_message:= "optin message should have minimum 20 characters"
            optout_keywords:= "NO,STOP"
            optout_message:= "optout message should have minimum 20 characters"
            help_keywords:= "HELP,INFO,MORE"
    response, err := client.Campaign.Update("<Campaign_id>", plivo.CampaignUpdateParams{
            Description:description,
            Sample1: sample1,
            Sample2: sample2,
            MessageFlow: message_flow,
            HelpMessage: help_message,
            OptinKeywords: optin_keywords,
            OptinMessage: optin_message,
            OptoutKeywords: optout_keywords,
            OptoutMessage: optout_message,
            HelpKeywords: help_keywords,
    })
    if err != nil {
    fmt.Printf("Error occurred while deleting camapign. error:%+v\n", err)
    os.Exit(1)
    } else {
    fmt.Printf("%+v\n", response)
    }
    }