Working with Contacts
About 2 min
Working with Contacts
Get the display name of a user by their TrueConf ID
When receiving system notifications (for example, when adding a user to the chat), only the technical identifier (TrueConf ID) is passed in the userId field — for instance, user@video.example.com. If the bot needs to send a welcome message or display the user in the interface, it is preferable to use the display name (for example, "Ivan Petrov") instead of the technical ID.
Request:
{
"type": 1,
"id": 1,
"method": "getUserDisplayName",
"payload": {
"userId": "user@video.example.com"
}
}| Parameter | Type | Mandatory | Description |
|---|---|---|---|
| type | uint32 | Yes | Message type (default is 1). Corresponds to MESSAGE_TYPE.REQUEST |
| id | uint32 | Yes | Unique request identifier. An incremental value assigned by the sender, required in each request for subsequent association with the response. Read more here. |
| method | string | Yes | The getUserDisplayName command |
| userId | string | Yes | TrueConf ID of the user whose name needs to be obtained |
Response:
{
"type": 2,
"id": 1,
"payload": {
"displayName": "John Doe"
}
}| Parameter | Type | Mandatory | Description |
|---|---|---|---|
| type | uint32 | Yes | Message type (default is 2). Corresponds to MESSAGE_TYPE.RESPONSE |
| id | uint32 | Yes | An identifier matching the number sent in the original request, used to link the request and response. |
| displayName | string | Yes | Displayed user name on the server |
In the event of an error, a message containing the errorCode parameter is returned. A list of possible values is available in the corresponding section of the documentation.