Update a bot user
PATCH
https://api.vidmoat.com/v1/telegram/users/{user}Change one person: allowed (allowlist), blocked, daily_credits (null for the bot's default).
Path parameters#
userstringrequiredA numeric Telegram user id, or an @username (4 to 32 letters, digits and underscores; send the @ as%40or leave it out).
Body#
allowedbooleantrueadds them to the allowlist (by id, or by the @username you gave when they have not used the bot yet);falseremoves them.blockedbooleantrueblocks them;falseunblocks them.daily_creditsinteger or nullTheir own daily limit, 0 to 1,000,000, ornullfor the bot's default.
Response#
Returns 200.
Response fields#
objectstringAlwaystelegram_user.idstring or nullVidmoat id of the person.nullfor somebody who has not used the bot yet.telegram_user_idstring or nullNumeric Telegram id, as a string.usernamestring or nullTelegram @username, without the @.display_namestring or nullTheir Telegram name.statusenumWhether they are blocked.One ofactive,blockedallowlistedbooleanOn the bot's allowlist.daily_creditsinteger or nullTheir own daily credit limit.nullmeans the bot's default.first_seen_atstring or nullISO 8601 time of their first message.last_seen_atstring or nullISO 8601 time of their latest message.projectsintegerProjects they have. Omitted for somebody who has not used the bot.messages_todayintegerSince midnight UTC. Omitted for somebody who has not used the bot.messages_30dintegerLast 30 days. Omitted for somebody who has not used the bot.credits_todayintegerCredits spent since midnight UTC. Omitted for somebody who has not used the bot.credits_30dintegerCredits spent in the last 30 days. Omitted for somebody who has not used the bot.
Errors#
Besides the errors any request can get (authentication, rate limits):
| Status | Code | When |
|---|---|---|
| 404 | not_found | The key is not minted for an app you own (a personal key, for example). Use a key from the app whose bot you manage. |
| 404 | not_found | No bot is connected to the app yet. |
| 400 | invalid_request | No field to change, a value of the wrong type, a test key, or an allowlist already at 5,000 entries. |
| 429 | rate_limited | More than 120 changes a minute on this app. |