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 Status with the chat ID and typing as action.

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

Unset typing

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


Did this page help you?