Azure bot framework Slack channel "Slack API error" because of token_expired - botframework

I have a self-hosted Azure bot with a Slack channel. The bot is able to send proactive messages and respond to user mentions after I authorized it with Slack. However, this stops working after some period of inactivity. The request via botbuilder sdk results in "Slack API error" and the underlying error appears to be token_expired.
await turnContext.sendActivity({ text: 'Some message...', textFormat: 'markdown' });
I assumed that token refresh should be fully handled within the framework. Has anyone encountered this issue? Is there some specific configuration that is required?

Related

Microsoft Teams no install event - can't send welcome message

Up until this Friday, MS Teams would always send a conversationUpdate event payload to our bot messaging endpoint whenever a user installed our app in Teams.
This stopped happening suddenly and now we only get a message when an app is added to a Team scope and not just personal scope.
Given that: how do we know to send a Welcome message via our bot to a user that installed our app if we receive no message, no payload. Nothing hits our bot messaging endpoint.

MS bot not working on Skype for Business

I have registered an MS bot on over Skype for business channel, the bot was searchable and responding for few days but no I am getting below error in "Bot Channel registration">channels> issues
"There was an error sending this message to your bot: HTTP status code NotFound".
On SFB I get error
"Error happened in Skype for Business service when reaching bot service".
Bot is hosted over azure in web API working and fine in Web channel, whereas with SFB its not hitting the API endpoint.
Every time I send a message from skype for businesss, I get the same error on bot channel registration.
Environment is a hybrid of Lync 2010 and Skype for business online and after registration bot was searchable and responding to users on SFB online.
What could be the possible reason for this error?
For my situation I realized that if I dont change messaging endpoint area everything goes well.I mean I was adding Microsoft App Id to my endpoint like https://myendpoint/{{MicrosoftAppId}} after bot created .It is because you can have your microsoft app id after you create the bot.What is awkard is that despite messaging endpoint looks an editable area when I change it I am falling into error place where my endpoint is never called[again webchannel works fine , it looks Skype For Business needs some refactoring]. However I found that if I dont change this endpoint url bot works fine for Skype For Business and my endpoint is hit successfully .So keep your messaging endpoint constant and set it only when creating your bot.

Getting error 'There was an error sending this message to your bot: HTTP status code GatewayTimeout ' email channel in MS bot

I have published a bot in bot framework and it is working in test window of the bot framework. Then I configured the bot with email channel with office 365 mail. I am getting the error:
There was an error sending this message to your bot: HTTP status code GatewayTimeout
You probably have this message because you did not use your endpoint for some time. One possibility to try to avoid those timeout is to set your published bot to Always On on Azure

Microsoft botframework and Slack configuration

I'm using Microsoft's botframework to create a Slack bot, however I'm running into 2 problems.
When I do "Test connection to your bot" I'm getting
InternalServerError
no_text
When I type in the test chat console on the botframework page, the messages are received in my slack general channel. However, when I as a user in my slack and type in the general channel, whatever I type the bot also generate the same message. i.e.
me: Hello
bot: Hello
I think it's how I set up my configuration for the slack bot app and/or the messaging endpoint of my botframework bot.
Thanks.

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

Resources