×

While you can update all the parameters of a campaign that has not started. For a campaign that is in progress you can 'pause' or 'resume' or 'mark as completed' specified by the parameter below. Additionally, any completed campaign can be marked as 'archived'.

PUT

https://<your_api_key>:<your_api_token><subdomain>/v2/accounts/<your_sid>/message-campaigns/<id>

Replace <your_api_key> and <your_api_token> with the API key and token created by you. Similarly, replace <your_sid> with your “Account sid” value. These values are available in the API settings page of your Exotel Dashboard. Replace <id> with the campaign id.

Parameter Name

Type & Value

action

A parameter which can control the action of a created campaign. The below values (string) can be passed:

  • pause - Stop calling more numbers as part of the campaign that is in progress. We can pause only created and in-progress campaign
  • resume - Resume calling numbers that were not called. We can resume only paused campaign
  • complete - Mark the entire campaign as Completed. Remaining numbers are marked as Failed. We can mark only paused campaign as completed
  • archive - Mark a campaign as archived. Only completed campaign can be marked as archived
curl --location --request PUT 'https://<your_api_key>:<your_api_token><subdomain>/v2/accounts/<your_sid>/message-campaigns/<id>'  
--header 'content-type: application/json'  
--data-raw '{     "action":"archive" }'
var request = require('request');

var options = {

'method': 'PUT',

'url': 'https://<your_api_key>:<your_api_token><subdomain>/v2/accounts/<your_sid>/message-campaigns/<id>',

'headers': {

'content-type': 'application/json'

},

body: JSON.stringify({

"action": "archive"

})

};

request(options, function (error, response) {

if (error) thrownewError(error);

console.log(response.body);

});
<?php

$curl = curl_init();

curl_setopt_array($curl, array(

CURLOPT_URL => 'https://%3Cyour_api_key%3E:%3Cyour_api_token%3E%3Csubdomain%3E/v2/accounts/%3Cyour_sid%3E/message-campaigns/%3Cid%3E',

CURLOPT_RETURNTRANSFER => true,

CURLOPT_ENCODING => '',

CURLOPT_MAXREDIRS => 10,

CURLOPT_TIMEOUT => 0,

CURLOPT_FOLLOWLOCATION => true,

CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,

CURLOPT_CUSTOMREQUEST => 'PUT',

CURLOPT_POSTFIELDS =>'{

"action":"archive"

}',

CURLOPT_HTTPHEADER => array(

'content-type: application/json'

),

));

$response = curl_exec($curl);

curl_close($curl);

echo $response;
import requests

import json

url = "https://<your_api_key>:<your_api_token><subdomain>/v2/accounts/<your_sid>/message-campaigns/<id>"

payload = json.dumps({

"action": "archive"

})

headers = {

'content-type': 'application/json'

}

response = requests.request("PUT", url, headers=headers, data=payload)

print(response.text)
package main

import (

"fmt"

"strings"

"net/http"

"io/ioutil"

)

func main() {

url := "https://%3Cyour_api_key%3E:%3Cyour_api_token%3E%3Csubdomain%3E/v2/accounts/%3Cyour_sid%3E/message-campaigns/%3Cid%3E"

method := "PUT"

payload := strings.NewReader(`{

"action":"archive"

}`)

client := &http.Client {

}

req, err := http.NewRequest(method, url, payload)

if err != nil {

fmt.Println(err)

return

}

req.Header.Add("content-type", "application/json")

res, err := client.Do(req)

if err != nil {

fmt.Println(err)

return

}

defer res.Body.Close()

body, err := ioutil.ReadAll(res.Body)

if err != nil {

fmt.Println(err)

return

}

fmt.Println(string(body))

}
{
"request_id": "cb8733a7c65a4a8586d6d4e8a3357088",
"method": "PUT",
"http_code": 200,
"response": {
"code": 200,
"status": "success",
"data": {
"name": "camp1",
"content_type": "static",
"sid": "90dad70b939f469fbf8b801660148272",
"account_sid": "Exotel",
"lists": [
"f2284e77ea5a4224911251b08f861af2"
],
"schedule": {
"start_time": "2022-08-10T21:57:00+05:30",
"end_time": "2022-09-09T21:57:00+05:30"
},
"status_callback": null,
"sms_status_callback": "https://www.test-campaign.com",
"status": "archived",
"report_url": "https://exotelreports.s3.ap-southeast-1.amazonaws.com/sms-campaign-report/account_sid=Exotel/_timestamp=1660170935/8220cbfd56b04f3db7d885316158fc1f.csv",
"dlt_template_id": "1107160016142600511",
"dlt_entitiy_id": "1101428740000012125",
"sender_id": "EXOTEL",
"channel": "SMS",
"sms_type": "transactional",
"template": "12345 is your One Time Password (OTP) for logging into Exotel dashboard.",
"estimated_cost": 0.17,
"date_created": "2022-08-10T21:47:52+05:30",
"date_updated": "2022-08-19T12:21:34+05:30",
"stats": {
"scheduled": 0,
"submitted": 0,
"failed": 0,
"failed-dnd": 0,
"invalid": 0,
"failed-no-attempt": 0,
"sent": 1,
"failed-expired": 0,
"failed-no-balance": 0
}
}
}
}
  • On success, the HTTP response status code will be 200
  • HTTP body will contain an JSON with details of the updated resource
  • Response parameters are described above