Newer Version Available

This content describes an older version of this product. View Latest

Create VoiceCall

Creates a VoiceCall record containing the participants (that is, the caller and recipient) for the VoiceCall. When you create a VoiceCall record, it creates a conversation in Salesforce. Only use this API in a real-time context, which means that you should invoke this API only when a call is initiated.

This API also can be used to create VoiceCalls records for transfer and conference calls by including the parentVoiceCallId parameter in the request payload.

This endpoint is available in API version 49.0 and later.

URI
/telephony/v1/voiceCalls
Formats
JSON, XML
HTTP Methods
POST
Authentication
Authorization: Bearer token
Parameters
Property Name Type Description Required
callCenterApiName string API name of your call center created in Salesforce. Yes
parentVoiceCallId string Passes the Salesforce VoiceCall record ID or the parent call’s vendor key, which is a unique ID. If included, creates a VoiceCall that is parented to the value in this field. Don’t include this property when creating an initial VoiceCall. No
vendorCallKey string Unique key that identifies the VoiceCall within the telephony system. For example, if the telephony system is Amazon Connect, this value is the contact ID. Yes
to string The phone number to which the call was made. For example, for an inbound call, this value is the contact center phone number. Yes
from string The phone number from which the call was made. For example, for an inbound call, this value is the End User's phone number. Yes
initiationMethod string Initiation method of the call. Allowed values: Inbound / Outbound / Transfer / Conference Yes
startTime string Start Time of the call. Yes
participants array Participants in the call. You can add one or more participants with at least one minimum participant. Participants are passed in as an array and each participant object in the array must confirm to the following pattern. Both the fields are required.
1{ "participantKey" : "value",
2  "type" : "value" }
type can be either END_USER or HUMAN_AGENT. Only one participant can be of type END_USER.
participantKey is the End-User phone number or the agent's Salesforce username.
Yes
callAttributes string Set VoiceCall custom fields using key: value pairs in a JSON string. The key is the API name of the custom field and value is the value to set in that field. Ignored when creating VoiceCall for transfer. No
Example
Request:
1POST /telephony/v1/voiceCalls
2
3{
4  "callCenterApiName": "MyContactCenter",
5  "vendorCallKey": "5324881f-1e84-4367-8930-f69a74b30ca6",
6  "to": "8002345678",
7  "from": "4081456688",
8  "initiationMethod": "Inbound",
9  "startTime": "2019-07-02T17:32:28Z",
10  "participants": [
11    {
12      "participantKey": "4081456688",
13      "type": "END_USER"
14    }
15  ],
16  "callAttributes": "{\"MyField__c\": \"abc\"}"
17}
Response without any errors:
1{
2  "voiceCallId": "0LQRM0000006CSz",
3  "errors": []
4}
Response with errors:
1{ 
2  "voiceCallId": "0LQRM0000001qEy", 
3  "errors": ["SocialSecurity__c: data value too large: 123456", "NumberField__c: invalid number: bad"]
4}