Direct call
This page explains the key functions of direct call consisting of how to retrieve a direct call or a list of direct calls, update custom items, and delete custom items of a direct call.
Note: Right now, the Calls API supports retrieving calls and actions for custom items. Other actions should be done from the Calls SDK.
Resource representation
The following table shows the list of properties in a direct call resource.
Property name | Type | Description |
---|---|---|
call_id | string | A unique identifier for the call. |
call_type | string | The type of the call. |
is_video_call | string | Indicates whether the call is a video call. |
state | string | The state of the call. |
end_result | string | The result of how the call has ended. Valid values are |
user_role | string | The user's role in the call. This appears either as |
participants | nested object | The users who have participated in the call. |
started_by | string | The ID of the user who dialed the call. |
started_at | long | The timestamp of when the call was dialed, in Unix milliseconds. |
ended_by | string | The IDs of the specific users who get a notification for the message. |
ended_at | long | The timestamp of when the call was ended, in Unix milliseconds. |
duration | int | The period from the call was accepted to when the call was ended, measured in milliseconds. |
custom_items | nested object | Specifies a |
Actions
- API endpoints are relative to the base URL allocated to your application. In this page, the
/direct_calls
endpoint refers tohttps://api-{application_id}.calls.sendbird.com/v1/direct_calls
.
Note: If you want to know your application ID, sign in to your dashboard, go to the Settings > Application > General, and then check the Application ID.
- It's recommended that the parameter values in API URLs be urlencoded, such as
{user_id}
.
List of actions
Action | HTTP request |
---|---|
| |
| |
| |
|
Retrieve a list of direct calls
Retrieves all direct calls within the application. The retrieved list of direct calls are sorted in reverse order, meaning the newest direct call appears first and the oldest last.
HTTP request
Parameters
The following table lists the parameters that this action supports.
Optional
Parameter name | Type | Description |
---|---|---|
limit | int | Specifies the number of results to return per page. Acceptable values are 1 to 100, inclusive. (Default: |
string | Specifies the value of the | |
user_ids | string | Searches for calls that include one or more users in the parameter value. The string should consist of multiple urlencoded user IDs separated by commas (for example, |
between_two_user_ids_only | string | Searches for calls between two users in the parameter value. The string should consist of only the two urlencoded user IDs separated by commas. |
call_ts | long | Specifies the timestamp of the query start time in Unix milliseconds. If this parameter isn't specified, the last 90 days starting from the time of query are searched by default. |
search_scope_from_call_ts | long | Specifies the query range starting from the set |
duration_range_min | int | Specifies the minimum value of the duration to restrict the search scope to only retrieve calls of which duration is equal to or greater than the specified value, in Unix milliseconds. This should be specified in conjunction with the |
duration_range_max | int | Specifies the maximum value of the duration to restrict the search scope to only retrieve calls of which duration is less than the specified value, in Unix milliseconds. This should be specified in conjunction with the |
state | string | Restrict the search scope to only retrieve calls of which state matches any of the specified value. Acceptable values are limited to |
end_result | string | Specifies a comma-separated string of one or more end results to only retrieve calls of which the end result that matches any of the specified values. Acceptable values are limited to |
Response
If successful, this action returns a list of call resources in the response body.
List of response properties
Property name | Type | Description |
---|---|---|
calls[] | list | A list of the user's calls. |
has_next | boolean | Indicates whether there is the next page of the user’s calls. |
string | The value for the |
Retrieve a direct call
Retrieves a specific direct call.
HTTP request
Parameters
The following table lists the parameters that this action supports.
Required
Property name | Type | Description |
---|---|---|
call_id | string | Specifies the unique ID of the target call. |
Response
If successful, this action returns a call resource in the response body.
Update custom items of a direct call
Updates custom items of a specific direct call. A direct call can have custom key-value items which store additional information for the call.
Note: When a direct call is created, its custom items have no values by default.
HTTP request
Parameters
The following table lists the parameters that this action supports.
Required
Parameter name | Type | Description |
---|---|---|
call_id | string | Specifies the unique ID of the target call. |
Request body
The following table lists the properties of an HTTP request that this action supports.
Properties
Required | Type | Description |
---|---|---|
custom_items | nested object | Specifies a |
Optional | Type | Description |
---|---|---|
mode | string | Determines whether to update the existing custom items or add new custom items. Acceptable values are the following: |
Response
If successful, this action returns custom items including the updated or added ones in the response body.
List of response properties
Property name | Type | Description |
---|---|---|
call_id | string | The unique ID of the target call. |
updated | array | An array of the keys for updated custom items. |
custom_items | nested object | The custom items including the updated or added ones. |
affected_at | long | The time of when the specified custom items have been updated, in Unix milliseconds. |
Delete custom items of a direct call
Deletes custom items of a specific direct call.
HTTP request
Parameters
The following table lists the parameters that this action supports.
Required
Property name | Type | Description |
---|---|---|
keys | array | Specifies the keys of custom items to delete. If not specified, all custom items of the direct call are deleted. |
Response
If successful, this action returns custom items excluding the deleted ones in the response body.
List of response properties
Property name | Type | Description |
---|---|---|
call_id | string | The unique ID of the target call. |
deleted | array | An array of the keys for deleted custom items. |
custom_items | nested object | The custom items after deleting. |
affected_at | long | The time of when the specified custom items have been deleted, in Unix milliseconds. |