Callback Requests
Creates a request for a callback for the specified phone number. Instead of waiting on hold in the queue when all agents are busy, the caller's place is held in the queue and their call is automatically returned when an agent becomes available. For more information on callback requests, see Understanding the end-user experience in Zendesk help. Callbacks don't need to be enabled on the phone number to create a callback request with the API.
JSON format
Callback Requests are represented as JSON objects with the following properties:
Name | Type | Read-only | Mandatory | Description |
---|---|---|---|---|
group_ids | array | false | false | IDs of groups to route the call to. If omnichannel routing is enabled, only the first group_id provided is used to route the callback |
phone_number_id | number | false | true | The Talk phone number ID |
requester_phone_number | string | false | true | The callback phone number in E.164 international number format |
Create Callback Request
POST /api/v2/channels/voice/callback_requests
Allowed For
- Agents
Rate Limit
You can create 30 callback requests every 10 minutes using this endpoint.
Example body
{
"callback_request": {
"phone_number_id": 1001,
"requester_phone_number": "+12518717081"
}
}
Code Samples
curl
curl https://{subdomain}.zendesk.com/api/v2/channels/voice/callback_requests.json \
-d '{"callback_request": {"phone_number_id": 1001, "requester_phone_number": "+1234567890"}}' \
-H "Content-Type: application/json" -X POST \
-v -u {email_address}/token:{api_token}
Go
import (
"fmt"
"io"
"net/http"
"strings"
)
func main() {
url := "https://support.zendesk.com/api/v2/channels/voice/callback_requests"
method := "POST"
payload := strings.NewReader(`{
"callback_request": {
"phone_number_id": 1001,
"requester_phone_number": "+12518717081"
}
}`)
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/json")
req.Header.Add("Authorization", "Basic <auth-value>") // Base64 encoded "{email_address}/token:{api_token}"
client := &http.Client {}
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := io.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
Java
import com.squareup.okhttp.*;
OkHttpClient client = new OkHttpClient();
HttpUrl.Builder urlBuilder = HttpUrl.parse("https://support.zendesk.com/api/v2/channels/voice/callback_requests")
.newBuilder();
RequestBody body = RequestBody.create(MediaType.parse("application/json"),
"""
{
\"callback_request\": {
\"phone_number_id\": 1001,
\"requester_phone_number\": \"+12518717081\"
}
}""");
String userCredentials = "your_email_address" + "/token:" + "your_api_token";
String basicAuth = "Basic " + java.util.Base64.getEncoder().encodeToString(userCredentials.getBytes());
Request request = new Request.Builder()
.url(urlBuilder.build())
.method("POST", body)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", basicAuth)
.build();
Response response = client.newCall(request).execute();
Nodejs
var axios = require('axios');
var data = JSON.stringify({
"callback_request": {
"phone_number_id": 1001,
"requester_phone_number": "+12518717081"
}
});
var config = {
method: 'POST',
url: 'https://support.zendesk.com/api/v2/channels/voice/callback_requests',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Basic <auth-value>', // Base64 encoded "{email_address}/token:{api_token}"
},
data : data,
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
Python
import requests
import json
from requests.auth import HTTPBasicAuth
url = "https://support.zendesk.com/api/v2/channels/voice/callback_requests"
payload = json.loads("""{
"callback_request": {
"phone_number_id": 1001,
"requester_phone_number": "+12518717081"
}
}""")
headers = {
"Content-Type": "application/json",
}
email_address = 'your_email_address'
api_token = 'your_api_token'
# Use basic authentication
auth = HTTPBasicAuth(f'{email_address}/token', api_token)
response = requests.request(
"POST",
url,
auth=auth,
headers=headers,
json=payload
)
print(response.text)
Ruby
require "net/http"
require "base64"
uri = URI("https://support.zendesk.com/api/v2/channels/voice/callback_requests")
request = Net::HTTP::Post.new(uri, "Content-Type": "application/json")
request.body = %q({
"callback_request": {
"phone_number_id": 1001,
"requester_phone_number": "+12518717081"
}
})
email = "your_email_address"
api_token = "your_api_token"
credentials = "#{email}/token:#{api_token}"
encoded_credentials = Base64.strict_encode64(credentials)
request["Authorization"] = "Basic #{encoded_credentials}"
response = Net::HTTP.start uri.hostname, uri.port, use_ssl: true do |http|
http.request(request)
end
Example response(s)
201 Created
// Status 201 Created
null