Bot status like looks like
Make sure to check Commands for the scope. Notice the scope- along with commands , add team: Once you get the temp code, you need to POST the code along with your credentials to exchange the code for an access token. Once the auth is done, you are done. To obtain the team name as a part of the chat room URL , use team.
You need to use the access token to be able to access the API. For this article, I simplified all my code, but check out the entire code on GitHub to see all the error handlings and when to use Verification token for your app. Of course, you can deploy wherever you want. But if you want to deploy to Heroku like I did, I found this article by Heroku helpful. Make sure to set up your env vars where you set in your. As you see, writing a Slack slash command itself is easy, but to figuring out the whole process to make the bot available to everybody was a bit pain for me.
I spent most of my time reading the docs to just figuring out, and spend far less for coding. There are two parts. Writing a slash command with Node. Using ngrok If you wish to use ngrok for your development too, download ngrok from https: Maximum total JSON size of the request is 30kb. The maximum list length is receivers. The Broadcast API is used to send messages to multiple recipients with a rate limit of requests in a 10 seconds window.
This mandatory parameter defines the recipients for the message. Every user must be subscribed and have a valid user id. For example this should be a part of the full JSON body:. The place holders can appear anywhere in the message, even in tracking data. The list of the place holders:. The account admin will be able to edit most of these details from his Viber client.
This request can be sent twice during a 12 hours period for each user ID. The API supports up to user id per request and those users must be subscribed to the account. Other message types picture, video, etc. The following example shows a post request of a text message.
For other message types see possible message types below. Each callback will contain a signature on the JSON passed to the callback. In case the webhook is offline Viber will re-try to deliver the callback several times for up to an hour until HTTP status code is received.
Before an account can send messages to a user, the user will need to subscribe to the account. Subscribing can take place in one of two ways:. This means that if a user had a conversation with a service and then chose to unsubscribe and subscribe again, a new conversation will be started without any information related to the old conversation. The user will have the option to unsubscribe from the PA. This will trigger an unsubscribed callback. See sending a welcome message below for more information.
The receiver parameter is not mandatory in this case. The Viber API allows sending messages to users only after they subscribe to the account. To learn more about this event and when is it triggered see Conversation started in the callbacks section. An example welcome message would look like this:.
If the message recipient is using their Viber account on multiple devices, each of the devices will return a delivered and a seen status. This means that several callbacks can be received for a single message. If Viber is unable to deliver the message to the client it will try to deliver it for up to 14 days. Since some of the message validations take place on the server while the others take place on the client, some messages may only fail after reaching the client.
In such cases the flow will be as follows:. The following callback data describes the structure of messages sent from user to PA.
The callback message parameters depend on the type of message. For each message type, only the relevant parameters will be received. The following error codes will be returned with API responses.
You can use bold, italic or fixed-width text, as well as inline links in your bots' messages. Telegram clients will render them accordingly. Bots are frequently added to groups in order to augment communication between human users, e. This is especially true for work-related groups. A bot running in privacy mode will not receive all messages that people send to the group. Instead, it will only receive:. On one hand, this helps some of us sleep better at night in our tinfoil nightcaps , on the other — it allows the bot developer to save a lot of resources, since they won't need to process tens of thousands irrelevant messages each day.
Privacy mode is enabled by default for all bots, except bots that were added to the group as admins bot admins always receive all messages. It can be disabled, so that the bot receives all messages like an ordinary user. We only recommend doing this in cases where it is absolutely necessary for your bot to work — users can always see a bot's current privacy setting in the group members list.
In most cases, using the force reply option for the bot's messages should be more than enough. So what messages exactly will my bot get? Telegram bots have a deep linking mechanism, that allows for passing additional parameters to the bot on startup. It could be a command that launches the bot — or an auth token to connect the user's Telegram account to their account on some external service.
Each bot has a link that opens a conversation with it in Telegram — https: You can add the parameters start or startgroup to this link, with values up to 64 characters long.
We recommend using base64url to encode parameters with binary and other types of content. Following a link with the start parameter will open a one-on-one conversation with the bot, showing a START button in the place of the input field. If the startgroup parameter is used, the user is prompted to select a group to add the bot to. As soon as a user confirms the action presses the START button in their app or selects a group to add the bot to , your bot will receive a message from that user in this format:.
Suppose the website example. Here's what they could do to enable notifications for a user with the ID Some bots need extra data from the user to work properly. Bots can ask a user for their location and phone number using special buttons. Note that both phone number and location request buttons will only work in private chats. When these buttons are pressed, Telegram clients will display a confirmation alert that tells the user what's about to happen. BotFather is the one bot to rule them all.
It will help you create new bots and change settings for existing ones. The BotFather will ask you for a name and username, then generate an authorization token for your new bot.
The Username is a short name, to be used in mentions and telegram. Usernames are characters long and are case insensitive, but may only include Latin characters, numbers, and underscores. The token is a string along the lines of Millions choose Telegram for its speed.
To stay competitive in this environment, your bot also needs to be responsive. In order to help developers keep their bots in shape, Botfather will send status alerts if it sees something is wrong. If we get abnormally low readings, you will receive a notification from Botfather. Your bot is sending much fewer messages than it did in the previous weeks. This is useful for newsletter-style bots that send out messages without prompts from the users.