Exotel allows you to make outbound calls to DND numbers which have been whitelisted. To check if a number has been whitelisted or not, you will need to make a HTTP GET request to
https://<your_api_key>:<your_api_token><subdomain>/v1/Accounts/<your_sid>/CustomerWhitelist/<number>
If you’d prefer response in JSON format, just append .json at the end of the HTTP POST request.
<your_api_key>
and <your_api_token>
with the API key and token created by you.<your_sid>
with your “Account sid”<subdomain>
with the region of your account
<your_api_key>
, <your_api_token>
and <your_sid>
are available in the API settings page of your Exotel Dashboard
curl https://<your_api_key>:<your_api_token><subdomain>/v1/Accounts/<your_sid>/CustomerWhitelist/XXXXX30240
var request = require('request'); var dataString = 'From=XXXXX30240&To=9415540682&CallerId=0XXXXXX4890'; var options = { url: 'https://<your_api_key>:<your_api_token><subdomain>/v1/Accounts/<your_sid>/CustomerWhitelist/XXXXX30240', method: 'POST', body: dataString }; function callback(error, response, body) { if (!error && response.statusCode == 200) { console.log(body); } } request(options, callback);
<?php include('vendor/rmccue/requests/library/Requests.php'); Requests::register_autoloader(); $headers = array(); $data = array( 'From' => 'XXXXX30240', 'To' => '9415540682', 'CallerId' => '0XXXXXX4890' ); $response = Requests::post('https://<your_api_key>:<your_api_token><subdomain>/v1/Accounts/<your_sid>/CustomerWhitelist/XXXXX30240', $headers, $data);
import requests data = { 'From': 'XXXXX30240', 'To': '9415540682', 'CallerId': '0XXXXXX4890' } requests.post('https://<your_api_key>:<your_api_token><subdomain>/v1/Accounts/<your_sid>/CustomerWhitelist/XXXXX30240', data=data)
require 'net/http' require 'uri' uri = URI.parse("https://<your_api_key>:<your_api_token><subdomain>/v1/Accounts/<your_sid>/CustomerWhitelist/XXXXX30240") request = Net::HTTP::Post.new(uri) request.set_form_data( "From" => "XXXXX30240", "To" => "9415540682", "CallerId" => "0XXXXXX4890", ) req_options = { use_ssl: uri.scheme == "https", } response = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http| http.request(request) end # response.code # response.body
HTTP Response:
<Result> <Status>(Whitelist|Blacklist|Neutral)</Status> <Type>(Customer|Agent|API|<empty>)</Type> <Expiry>(-1|<seconds>)</Expiry> </Result>
Description of parameters mentioned in the above response:
Parameter Name |
Type & Value |
Result/Status |
|
Result/Type |
|
Result/Expiry |
Contains the number of seconds after which the number will not be in this state (typically whitelist).
|