Can't send message to some bot users in Telegram - http-get

I made the bot in telegram which accepts some requests from users. My bot should send notifications about changes of the request status. I do it separate from my script by sending get request. But some users can not get the notification message, because this error "{
"ok": false,
"error_code": 403,
"description": "Forbidden: bot was blocked by the user"
}" The user didn't block the bot. The bot blocked itself for some reason. I can't understand how it happens. What is the reason of blocking bot by the user unconsciously? I want write the guid for user "how do not block bot", but I don't know the reason. How I can solve this issue?
Here's my request:
https://api.telegram.org/bot<bot_token>/sendMessage?chat_id=<chat_id>&text=<Your request status changed>&reply_markup={"inline_keyboard": [[{"text": "View", "callback_data": "<request_id>"}]]}

Your bot is blocked by users yet, need to click RESTART to unblock bot.
You can try it yourself by click Stop Bot in menu.

I had the same problem, revoking bot's token solved it.

Related

Webex AttachementActionData usage

How is this class used? If there is a submit button using Action.Submit on an adaptive card, how does the Microsoft Bot get this message?
So this question doesn't get flagged as too generic, there is a Webex adapter connected to a Microsoft bot using this exact demo.
https://learn.microsoft.com/en-us/azure/bot-service/bot-service-adapter-connect-webex?view=azure-bot-service-4.0
The OnMessageActivityAsync message gets the message from the bot, for example, if the user types "Hello", and the bot responds back with an adaptive card that has the action "Action.Submit" that will give the user a card with a submit button. Now, if the user clicks "submit", Webex should send something back to the bot. I don't think it's a message, because I never receive a message. Webex has, on it's side of documentation, a webhook with ActionAttachments. But after creating this webhook and clicking submit, what is the bot supposed to receive?
The answer to this was to change the Webex access token from the auto-generated token to the bot's access token. After doing this, the Action Attachment was working and the bot received the Event Activity.

Slack event message.im not being triggered

I'm trying to get the event to be triggered when someone sends a message on a private conversation in slack, I've already registered the event subscription (message.im) in the subscribe to bot events section, made sure that the needed scope was added (im:history), and reinstalled the app on my workspace.
Also tried signing out of the workspace and logging in again.
Yet, even if it is the admin sending a message to a user or a user sending a message to the admin (or in any other case with other users) the Event is not being triggered.
Any help or suggestion of why could this be happening?
Thanks!
You receive this event when a user sends a direct message to your bot/app.
You wouldn't receive this event when a user sends a message to another user, because the bot is not a part of that conversation.

How to get a welcome message on teams even before user sends any message

I have deployed my bot on teams channel.
I would like to send a welcome message to a new user even before user sends a message to the bot.
can we achieve this for teams channel?
If yes, which event can be used to get that user is accessing bot for the first time.
You can use the ConversationUpdate event ActivityTypes.ConversationUpdate // in c#
When a bot is installed, your bot receives a conversationUpdate event. You can then send a proactive message to the user. Could you please try sending a proactive message and let us know if you face any issues?
The conversationUpdate event with the membersAdded object in the payload is sent when either a bot is added to a team or a new user is added to a team where a bot has been added. It is always a good practice to send a welcome message introducing the bot to all the users. Ensure that your bot responds to the conversationUpdate message, with the teamsAddMembers eventType in the channelData object. Also, keep in mind that the memberAdded ID is the bot's App ID itself, because the same event is sent when a user is added to a team.
Hope this helps.

How to check credentials against botframework api

I'd like to check that my bot credentials (appId + appSecret) are ok to connect to https://api.botframework.com/bot/v1.0/messages.
I can't send a real message because i have no conversation running so I tried to post the following json message :
{ "type": "Ping"} but the response i got was
{
"error": {
"message": "Expression evaluation failed. Object reference not set to an instance of an object.",
"code": "ServiceError"
}
}
Is there any way to check if my access to the api is ok?
If you've registered your bot, you can visit the Bot Framework page, click on the My Bots menu, and select your registered bot. On your bot page, scroll down to the bottom left and there's a test box.
Also, you can use the emulator. It has a place in the upper right corner to replace the default credentials with your bot credentials. Then change the URL to where you have your bot deployed. Tip: remember to append 'api/messages' to the URL.
Download the BotFrameworkEmulator to test connectivity to your bot. It works on windows and OSX if you have mono installed. You can change the default settings that the emulator uses by typing '/settings' after running it. You will be prompted to enter your appId, appSecret and url endpoint for sending and receiving messages to/from your bot.
You can also use the directline rest api to initiate conversations and send messages to your bot

Telegram API: doesn't send message to user until receive first message from that user

I use Telegram API to send a message to a user with my bot.
When the user sends me a message, that operation works but when I want to send a message to an user that haven't sent me any message to me before, then an error occurs (I have his user id):
{"ok":false,"error_code":400,"description":"Error: Bad Request: user not found"}
Is there a solution to solve this?
Telegram bots cannot be a conversation initiators - they can write to user only after that user sends a message to bot first: https://core.telegram.org/bots#4-how-are-bots-different-from-humans
If this error appears in a group, first you need add this bot to that group.

Resources