Queuing Multiple Outbound Calls

post
Queuing Multiple Outbound Calls

https://insight.plumvoice.com/api/surveys/{survey_id}/{instance_id}/bulk_queue
Bulk queue outbound calls for an Insight survey.
Request
Response
Request
Path Parameters
survey_id
required
string
Insight ID number
instance_id
required
string
Instance number for an Insight survey
Headers
content-type
required
string
multipart/form-data
Form Data Parameters
csv
required
object
CSV file of contacts to receive the outbound calls. For a description of how to format this file, see Bulk Queue Calls Formatting.
start_timestamp
optional
string
Unix timestamp for when to make the outbound call.
end_timestamp
optional
string
Unix timestamp for when to stop attempting to make the outbound call
max_attempts
optional
integer
Number of attempts to be made (if previous attempts are not completed successfully). Integer between 1-10.
reattempt_wait
optional
integer
Interval (in seconds) to wait before retrying the outbound call after a failure. This is only required when you set an max_attempts value greater than one, indicating additional retry attempts.
result_url
optional
string
Callback URL to your REST service that processes the call status results when the call is completed, canceled, or all attempts have been exhausted. The POST body will match the format of the 'call_details' attribute from the outbound call status API response, shown here.
Response
200: OK
JSON
XML
JSON
{'success':true}
XML
<result>
<success>true</success>
</result>
400: Bad Request
Example: too many attempts were supplied.
JSON
XML
JSON
{'success':false,'error':'attempts can only be an integer between 1 and 10.'}
XML
<result>
<success>false</success>
<error>attempts can only be an integer between 1 and 10.</error>
</result>

Possible Response Codes

  • 200: success

  • 400: supplied data improperly formatted or invalid, uploaded CSV was invalid or not supplied

  • 401: authentication headers were invalid or the account is inactive

  • 403: the account attempting to queue the outbound call for the survey does not have appropriate permissions

  • 404: deployment, user or survey was not found

  • 405: invalid HTTP method supplied (only POST allowed)

  • 409: survey has been marked as deleted, survey deployment has expired, no TTS engine or metadatbase set for the survey, instance_id supplied did not match the current deployment, the number of survey responses has exceeded the max responses set in the survey's deployment settings

  • 415: unsupported media type (Content-Type value in request)

  • 500: database error

The return structure will contain the following item(s):

Name

Data Type

Always Present

Description

success

boolean

yes

Indicates the outcome of the request

error

string

no

If the success value is false this provides a message indicating what error(s) occurred

Sample Code

This sample PHP code makes a request to queue multiple outbound calls:

<?php
$ch = curl_init();
$url = 'https://insight.plumvoice.com/api/surveys/{survey_id}/{instance_id}/bulk_queue';
$params = array(
'csv'=>'@/path/to/csv/on/your/pc.csv',
'start_timestamp'=>strtotime('+1 minutes'),
'end_timestamp'=>strtotime('+1 hour'),
'attempts'=>1
);
$username = 'you@yourdomain.com';
$password = 'your_developer_key';
curl_setopt($ch, CURLOPT_USERPWD, $username.":".$password);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Accept: application/json", "Content-type: multipart/form-data"));
$result = curl_exec($ch);
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
var_dump($result);
var_dump($http_code);