Set presence status

Learn how to update the presence status in Telegram using Unipile API.

Set online / offline status

To mark the account owner as online or offline, use Set Presence method and specify online or offline as presence.

const { data, error } = await messagingApi.setPresence({
  path: {
    account_id: "acc_123456789",
  },
  body: {
    presence: "online",
  },
});
messaging_api.set_presence(
    "acc_123456789",
    {"presence": "online"},
)
curl --request POST \
     --url https://api.unipile.com/v2/account_id/presence \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --data '
{
"presence": "online"
}
'

Set typing status

To mark the account owner as typing in a given chat for other participants of this chat, use Set Composing method and provide the chat ID.

const { data, error } = await messagingApi.setComposingStatus({
  path: {
    account_id: "acc_123456789",
  },
  body: {
    chat_id: "chat_id",
    presence: "typing",
  },
});
messaging_api.set_composing_status(
    "acc_123456789",
    {
        "chat_id": "chat_id",
        "presence": "typing",
    },
)
curl --request POST \
     --url https://api.unipile.com/v2/account_id/presence \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --data '
{
"chat_id": "chat_id",
"presence": "typing"
}
'
📘

Unset typing

You don't have to unset the typing status manually as it's going away automatically after 5 seconds.