Working with Contacts

TrueConfAbout 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"
    }
}
ParameterTypeMandatoryDescription
typeuint32YesMessage type (default is 1). Corresponds to MESSAGE_TYPE.REQUEST
iduint32YesUnique request identifier. An incremental value assigned by the sender, required in each request for subsequent association with the response. Read more here.
methodstringYesThe getUserDisplayName command
userIdstringYesTrueConf ID of the user whose name needs to be obtained

Response:

{
    "type": 2,
    "id": 1,
    "payload": {
        "displayName": "John Doe"
    }
}
ParameterTypeMandatoryDescription
typeuint32YesMessage type (default is 2). Corresponds to MESSAGE_TYPE.RESPONSE
iduint32YesAn identifier matching the number sent in the original request, used to link the request and response.
displayNamestringYesDisplayed 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.