Callback Requests
创建一个回调的要求规范ified 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, seeUnderstanding the end-user experiencein 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
旋度
旋度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}:{password}
Go
import(
"fmt"
"io"
"net/http"
"strings"
)
funcmain(){
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)
iferr!=nil{
fmt.Println(err)
return
}
req.Header.Add("Content-Type","application/json")
req.Header.Add("Authorization","Basic
" )// Base64 encoded "username:password"client:=&http.Client{}
res,err:=client.Do(req)
iferr!=nil{
fmt.Println(err)
return
}
deferres.Body.Close()
body,err:=io.ReadAll(res.Body)
iferr!=nil{
fmt.Println(err)
return
}
fmt.Println(string(body))
}
Java
importcom.squareup.okhttp.*;
OkHttpClientclient=newOkHttpClient();
HttpUrl.BuilderurlBuilder=HttpUrl.parse("https://support.zendesk.com/api/v2/channels/voice/callback_requests")
.newBuilder();
RequestBodybody=RequestBody.create(MediaType.parse("application/json"),
"""
{
\"callback_request\":{
\"phone_number_id\":1001,
\"requester_phone_number\":\"+12518717081\"
}
}""");
Requestrequest=newRequest.Builder()
.url(urlBuilder.build())
.method("POST",body)
.addHeader("Content-Type","application/json")
.addHeader("Authorization",Credentials.basic("your-email","your-password"))
.build();
Responseresponse=client.newCall(request).execute();
Nodejs
varaxios=require('axios');
vardata=JSON.stringify({
"callback_request":{
"phone_number_id":1001,
"requester_phone_number":"+12518717081"
}
});
varconfig={
method:'POST',
url:'https://support.zendesk.com/api/v2/channels/voice/callback_requests',
headers:{
'Content-Type':'application/json',
'Authorization':'Basic
' ,// Base64 encoded "username:password"},
data:data,
};
axios(config)
.then(function(response){
console.log(JSON.stringify(response.data));
})
.catch(function(error){
console.log(error);
});
Python
importrequests
importjson
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",
}
response=requests.request(
"POST",
url,
auth=('
' ,'' ),headers=headers,
json=payload
)
print(response.text)
Ruby
require"net/http"
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"
}
})
request.basic_auth"username","password"
response=Net::HTTP.start uri.hostname,uri.port,use_ssl:truedo|http|
http.request(request)
end
Example response(s)
201 Created
// Status 201 Created
null