Update campaign
Edit a draft campaign. Takes the same fields as Create campaign; recipients are rebuilt.
Scope: sms:send.
PATCH
/
sms
/
campaigns
/
{id}
Update campaign
curl --request PATCH \
--url https://app.telaven.com/api/v1/sms/campaigns/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "November offer v2",
"message": "Hi {first_name}, 25% off until Friday.",
"contactListIds": [
"c51e…"
]
}
'const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'November offer v2',
message: 'Hi {first_name}, 25% off until Friday.',
contactListIds: ['c51e…']
})
};
fetch('https://app.telaven.com/api/v1/sms/campaigns/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://app.telaven.com/api/v1/sms/campaigns/{id}"
payload = {
"name": "November offer v2",
"message": "Hi {first_name}, 25% off until Friday.",
"contactListIds": ["c51e…"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.telaven.com/api/v1/sms/campaigns/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'November offer v2',
'message' => 'Hi {first_name}, 25% off until Friday.',
'contactListIds' => [
'c51e…'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}using RestSharp;
var options = new RestClientOptions("https://app.telaven.com/api/v1/sms/campaigns/{id}");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "Bearer <token>");
request.AddJsonBody("{\n \"name\": \"November offer v2\",\n \"message\": \"Hi {first_name}, 25% off until Friday.\",\n \"contactListIds\": [\n \"c51e…\"\n ]\n}", false);
var response = await client.PatchAsync(request);
Console.WriteLine("{0}", response.Content);
{
"success": true,
"data": {
"id": "6f1c…",
"status": "draft"
}
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}Body
application/json
Response
Success
⌘I
Update campaign
curl --request PATCH \
--url https://app.telaven.com/api/v1/sms/campaigns/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "November offer v2",
"message": "Hi {first_name}, 25% off until Friday.",
"contactListIds": [
"c51e…"
]
}
'const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'November offer v2',
message: 'Hi {first_name}, 25% off until Friday.',
contactListIds: ['c51e…']
})
};
fetch('https://app.telaven.com/api/v1/sms/campaigns/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://app.telaven.com/api/v1/sms/campaigns/{id}"
payload = {
"name": "November offer v2",
"message": "Hi {first_name}, 25% off until Friday.",
"contactListIds": ["c51e…"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.telaven.com/api/v1/sms/campaigns/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'November offer v2',
'message' => 'Hi {first_name}, 25% off until Friday.',
'contactListIds' => [
'c51e…'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}using RestSharp;
var options = new RestClientOptions("https://app.telaven.com/api/v1/sms/campaigns/{id}");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "Bearer <token>");
request.AddJsonBody("{\n \"name\": \"November offer v2\",\n \"message\": \"Hi {first_name}, 25% off until Friday.\",\n \"contactListIds\": [\n \"c51e…\"\n ]\n}", false);
var response = await client.PatchAsync(request);
Console.WriteLine("{0}", response.Content);
{
"success": true,
"data": {
"id": "6f1c…",
"status": "draft"
}
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}