Latest Legacy

Retrieve all campaigns

This API lets you fetch all the campaigns associated with an account.

API Endpoint

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

Arguments

limitinteger

Denotes the number of results per page. The maximum number of results that can be fetched is 20.

Defaults to 20.

offset integer

Denotes the number of value items by which the results should be offset. Defaults to 0. Read more about offset-based pagination.

usecasestring

Filter by 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.

brand_idstring

Filters results by a brand_id

registration_statusstring

Filter by registration status of a campaign.

Allowed values:Active,Failed,Processing,Expired

campaign_sourcestring

Filters results by campaign source.

Allowed values:plivo,shared

Returns

api_id and a dictionary with an objects property that contains up to 20 campaigns. Each tuple in the list is a separate Campaign object.

Response

HTTP Status Code: 200

{
    "api_id": "f5013b11-8d0e-4156-b7a2-feeea076b6fb",
    "meta": {
        "limit": 1,
        "offset": 0,
        "next": "/v1/Account/<auth_id>/10dlc/Campaign/?limit=1&offset=1",
        "previous": null,
        "total_count": 16
    },
    "campaigns": [
        {
            "campaign_id": "CY2UXXX",
            "registration_status": "FAILED",
            "reseller_id": "",
            "brand_id": "BANGXXX",
            "usecase": "2FA",
            "campaign_alias": "campaign name",
            "mno_metadata": {
                "AT&T": {
                    "tpm": 4500
                },
                "T-Mobile": {
                    "brand_tier": "TOP"
                },
                "US Cellular": {
                    "tpm": 4500
                },
                "Verizon Wireless": {
                    "tpm": 4500
                }
            },
            "sample1": "Your one-time passcode is 6. Please do not reply to this message.",
            "sample2": "Your one-time passcode is 6.",
            "description": "We use this campaign to send multi factor authentication 6 digit codes to end users and customers.",
            "campaign_attributes": {
                "embedded_link": false,
                "embedded_phone": false,
                "age_gated": false,
                "direct_lending": false,
                "subscriber_optin": true,
                "subscriber_optout": true,
                "subscriber_help": true,
                "affiliate_marketing": false
            },
            "message_flow": "Agents and customers using our service daily. Agents login required to validate the MFA code. Customers login required to validate the MFA code. ",
            "help_message": "Please call {800 number} if you're having issues with login.",
            "optout_message": "You are not going to receive MFA codes by SMS moving forward.",
            "created_at": "2023-09-25T20:36:00.83971Z",
            "vertical": "ENTERNTAINMENT"
            "campaign_source": "plivo"
        }
    ]
}

Example Request

1
2
3
4
5
6
7
8
9
import sys  
sys.path.append("../plivo-python")  
import plivo 

client = plivo.RestClient("<auth_id>", "<auth_token>")
response = client.campaign.get_number(
    campaign_id="<campaign_id>", number="14845197139"
)
print(response)
1
2
3
4
5
6
7
8
9
10
11
12
13
require "rubygems"
require "/etc/plivo-ruby/lib/plivo.rb"
include Plivo

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

begin
        response = api.campaign.get("<campaign_id>")

        puts response
rescue PlivoRESTError => e
        puts 'Exception: ' + e.message
end
1
2
3
4
5
6
7
8
9
10
11
12
let plivo = require('plivo');

let client = new plivo.Client("<auth_id>", "<auth_token>");
client.campaign.list(param = {
        limit: 20,
        offset: 0
    })
    .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
<?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->getNumber("<campaign_id>","14845197716");
     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
package com.plivo.examples;

import com.plivo.api.Plivo;
import com.plivo.api.models.base.ListResponse;
import com.plivo.api.models.campaign.Campaign;

public class PlivoTest {

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

        // List Campaign
        try {
            ListResponse < Campaign > response = Campaign.lister().limit(1).offset(0).list();
            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
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.List();
                Console.WriteLine(response);
            }
            catch (PlivoRestException e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }
        }
    }
}
1
2
curl -i --user auth_id:auth_token \
    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
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)
	}
	//List All Campaigns
	response, err := client.Campaign.List(plivo.CampaignListParams{Limit: 2, Offset: 0})
	if err != nil {
		fmt.Printf("Error occurred while listing campaigns. error:%+v\n", err)
		os.Exit(1)
	} else {
		fmt.Printf("%+v\n", response)
	}
}