Add recipient to phone campaign


Add recipient to phone campaign with HTTP POST request.

POST

/phone-campaign/:id/scheduled_call_create/

Parameters
Type
Description
id
integer
Unique ID of phone campaign that you want to add recipients to
Data
Type
Description
client_user
int
ID of your client that you want to call to
scheduled_at
timestamp
Time that you want to trigger call
curl -X POST \
  https://app.userengage.com/api/public/phone-campaign/1/scheduled_call_create/ \
  -H 'Authorization: Token oPIexKlydeziKDeUjwTkTB6VsOULin2ERaeoX7Wn8iR7T6NTZLr8DQVd4NSwlDpu' \
  -H 'Cache-Control: no-cache' \
  -H 'Content-Type: application/json' \
  -H 'Postman-Token: c3a799d9-01d2-b476-5b1b-cde38f646491' \
  -d '{
  "client_user": 21,
  "scheduled_at": "2018-02-19T10:16:26.860720Z"
}
var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://app.userengage.com/api/public/phone-campaign/1/scheduled_call_create/",
  "method": "POST",
  "headers": {
    "Authorization": "Token oPIexKlydeziKDeUjwTkTB6VsOULin2ERaeoX7Wn8iR7T6NTZLr8DQVd4NSwlDpu",
    "Content-Type": "application/json",
    "Cache-Control": "no-cache",
    "Postman-Token": "5e06e3dc-5954-74e7-0b84-e05fe8fc88f2"
  },
  "processData": false,
  "data": "{\n\t\"client_user\": 21,\n\t\"scheduled_at\": \"2018-02-19T10:16:26.860720Z\"\n}"
}

$.ajax(settings).done(function (response) {
  console.log(response);
});
var data = JSON.stringify({
  "client_user": 21,
  "scheduled_at": "2018-02-19T10:16:26.860720Z"
});

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === 4) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://app.userengage.com/api/public/phone-campaign/1/scheduled_call_create/");
xhr.setRequestHeader("Authorization", "Token oPIexKlydeziKDeUjwTkTB6VsOULin2ERaeoX7Wn8iR7T6NTZLr8DQVd4NSwlDpu");
xhr.setRequestHeader("Content-Type", "application/json");
xhr.setRequestHeader("Cache-Control", "no-cache");
xhr.setRequestHeader("Postman-Token", "7a038452-7274-2de6-fb90-6075fc0dc7ff");

xhr.send(data);
var request = require("request");

var options = { method: 'POST',
  url: 'https://app.userengage.com/api/public/phone-campaign/1/scheduled_call_create/',
  headers:
   { 'Postman-Token': 'f2b2ebfd-b908-6534-bec8-416cc4ba7fdd',
     'Cache-Control': 'no-cache',
     'Content-Type': 'application/json',
     Authorization: 'Token oPIexKlydeziKDeUjwTkTB6VsOULin2ERaeoX7Wn8iR7T6NTZLr8DQVd4NSwlDpu' },
  body: { client_user: 21, scheduled_at: '2018-02-19T10:16:26.860720Z' },
  json: true };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_PORT => "8000",
  CURLOPT_URL => "https://app.userengage.com/api/public/phone-campaign/1/scheduled_call_create/",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "{\n\t\"client_user\": 21,\n\t\"scheduled_at\": \"2018-02-19T10:16:26.860720Z\"\n}",
  CURLOPT_HTTPHEADER => array(
    "Authorization: Token oPIexKlydeziKDeUjwTkTB6VsOULin2ERaeoX7Wn8iR7T6NTZLr8DQVd4NSwlDpu",
    "Cache-Control: no-cache",
    "Content-Type: application/json",
    "Postman-Token: fc60b9d2-30a4-7757-ba00-eff0e2ed9866"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import http.client

conn = http.client.HTTPConnection("https://app.userengage.com/api/public/")

payload = "{\n\t\"client_user\": 21,\n\t\"scheduled_at\": \"2018-02-19T10:16:26.860720Z\"\n}"

headers = {
    'Authorization': "Token oPIexKlydeziKDeUjwTkTB6VsOULin2ERaeoX7Wn8iR7T6NTZLr8DQVd4NSwlDpu",
    'Content-Type': "application/json",
    'Cache-Control': "no-cache",
    'Postman-Token': "a196ff5a-0827-a346-f866-c1fc3861d126"
    }

conn.request("POST", "api,public,phone-campaign,1,scheduled_call_create,", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))

Response

{
    "priority": 1,
    "note": "",
    "status": 1,
    "phone_call": null,
    "client_user": 21,
    "scheduled_at": "2018-02-19T10:16:26.860720Z"
}