Muting or Unmuting Telegram Notifications for Users
In some instances, you need to mute broadcasts for Telegram users having a dialog with the bot or an operator to avoid interruptions. And when required, the messaging shall be unmuted.
In our platform, these can be done for users with Telegram tokens. The feature is implemented through two API endpoints described below.
Muting Notifications
To mute notifications, send requests to the following endpoint:
- POST
/v1/apps/{app_uuid}/token/mute
NOTE
Muted users or chats can receive transactional messages (smartsend, test).
The method’s parameters and their description are given in the following table.
Parameter | Type | Description |
---|---|---|
token | string | Required. User’s Telegram token. |
duration | long | Optional. Mute duration in seconds: The minimum value is 5 seconds. The maximum value is 31,536,000 seconds (approximately 1 year). If the duration is not specified, mute is set to 9999-12-31 23:59:59, disabling notifications "forever". To change the mute duration, send another request with the new value. |
The response may return the following errors listed in the table.
Status | Error message |
---|---|
400 | Wrong app uuid |
400 | Tokens must be specified |
400 | Duration must be positive int |
404 | Not registered application |
The muted contacts in the campaign reports are shown as Unavailable contacts
with Other errors
as the error type.
The error name in the details is CHANNEL_WAS_MUTED
.
Unmuting Notifications
To unmute notifications, send requests to the following endpoint:
- POST
/v1/apps/{app_uuid}/token/unmute
The request must contain the following parameter:
Parameter | Type | Description |
---|---|---|
token | string | Required. User’s Telegram token. |
The response may return the following errors listed in the table.
Status | Error message |
---|---|
400 | Wrong app uuid |
400 | Tokens must be specified |
404 | Not registered application |
Updated about 4 hours ago