Bot framework + messenger + image exception - image

I have a very simple bot made using ms bot framework and luis that's connected to Facebook messenger.
It works ok with text but when i send only an image with messenger i get "Sorry, my bot code is having an issue." I tried debugging but can't find the problem. When i send an image to the bot in the emulator i get "Exception: Value cannot be null. Parameter name: stringToEscape
Anyone had a similar issue? How do you receive an image to your bot from messenger?
"
I searched every resource i could find but didn't find anything that solved the issue for me.

I found the problem: When you use LUIS you need to always pass an activity where the text property is not null if it is null it throws an exception, and that's what was happening in my case since when you send an image or w/e the activity text is null and those files are in activity.attachments. I hope this help someone who struggled with the same issue.

Related

retrieve members email from 1:1 conversation bot framework message extension

So i created a message extension using bot framework v4.
What am trying to do is to retrieve members emails in 1:1 conversation using the message extension on OnTeamsMessagingExtensionSubmitActionAsync. However am getting 403 Forbidden.
The next step I tried to add the Bot to the conversation using AdaptiveCards and I get the following error "Something went wrong, please try again later." And when checking bot in channel registration I found the below issue:
The bot is not part of the conversation roster
So I created a graph connection and granted admin consent.Now when using GetUserTokenAsync after submit action I receive "Something went wrong, please try again later." (Testing connection created from portal.azure.com returns a token)
I find it a little bit weird to not able to retrieve what's already obvious. I can see the contact email and name so the 403 is absurd in my own opinion or I might be doing something wrong.
SO my question is either how to check the detailed errors that are returned or is there any easier way to retrieve members emails.
Thank you
So the problem was in the bot manifest file it seems that I didn't add the below to the json:
"validDomains": [
"token.botframework.com",
"*.ngrok.io"
]

Microsoft Bot send the response twice in Teams

I've used Microsoft bot framework SDKv4, and integrated to Teams channel. It is running well, but giving responses twice.
But, I didn't get the same behavior, while I tested it on Emulator and Web Chat in Azure Portal.
However, I can see below issue, while I ping the bot in web chat and get a response.
Further, I can also see, that its always 'sending' as a status although I got a valid response, and the status later changes to "Send Failed. Retry"
Is the issue related to my teams integration for getting message twice? and how, should I fix it!
Are you using webhooks? If so, having multiple webhooks with same ID could be the reason for double messages. Hope this helps
I made my bot working. It was the issue of MS authentication!
I had a call with MS support person and the root cause appeared to be only the MS authentication. Had to reset app secret and then re-deloyment.
Its weird that, although it was not getting authenticated primarily yet it was returning me the response. This, I still haven't got it!

Sending messages to my bot via Slack gets no response

I have a bot deployed to our Azure subscription. Using the webchat channel, I can interact with the bot using the url:
http://mybotname.azurewebsites.net/
We have added the bot to Slack as an app. We followed all the instructions given by the documentation on how to add a bot into Slack - https://learn.microsoft.com/en-us/azure/bot-service/bot-service-channel-connect-slack?view=azure-bot-service-3.0
When I send a message to the bot in the Slack channel we have created, I get no response. There is not error message, or in fact anything, returned.
Whereabouts can I start looking to see what the problem could be? Suggestions for error logs, traces, etc would be appreciated. I enabled App insights for the Azure Web App which the bot runs under, but nothing comes up as an error, or warning, or anything. I'm a bit lost here, any suggestions would be appreciated.
Note that I was made aware that, for Slack, I may need to tailor the responses in order for Slack to render them e.g. FormFlow define options for string field
I'm not sure how to do that, or even if this is a case that my bot simply isn't working in Slack regardless of how I'd format the responses.

'Oops. Something went wrong and we need to start over.' with Microsoft Bot Service with LUIS Template

I have created a Bot Service with LUIS template using Node.js, I have trained my luis model with our domain utterances and it was working fine. suddenly from a week time , Am facing weird behavior form the Bot Service, for any request the bot is replying as 'Oops. Something went wrong and we need to start over.' message. Could anyone encountered the similar issue and share your inputs to resolve.
Appreciate your help.
When a user query exceeds 500 character Luis gives an error. Check the user message how long it is and then test it in Luis portal. Or please check the subscription key which is used.

Microsoft bot works locally but not when published

So I created a chatbot which works perfectly fine on the Microsoft Bot Framework Channel Emulator when run locally.
However, after I publish it, when I test it on Telegram, I get Error 500: "POST to pbot2 failed: POST to the bot's endpoint failed with HTTP status 500".
I have absolutely no clue as to where I might have gone wrong. Usually its a credentials issue if it works locally but not when published, but I tried testing connection to my bot on the Microsoft Bot website and it gives me: Endpoint authorization succeeded. So credentials is definitely not an issue.
Googling gives me results where the problem is with the backward compatibility of the System.IdentityModel.Tokens.jwt, but I did not update that package so that should not be an issue.
At this point I've ran out of ideas, will appreciate any help! Thanks in advance.
Without a little more context I might not be of much help; however there are a number of tools you can use:
1) If you hook up app insights in the bot framework portal, we'll log exceptions we see from your bot into app insights. The first couple million transactions a month are free for dev time debugging it's a must have.
2) 500 is internal server error. I assume your bot is set to take the other activity types beyond just "Message"? You'll get conversationUpdate Activity messages from the channel that you won't see automatically in the emulator.
3) You can point the emulator at your cloud endpoint and verify there as well and often get more detail for exceptions than you will in your chat channel.
Let us know what you find.
You're getting an uncaught exception; what I do is wrap everything in in the Post method in MessageController.cs in try...catch, and when the exception is caught, send the exception's Message and StackTrace into the chat. Usually the first few lines will contain the general error description and most of the times the line number.
catch (Exception ex)
{
string error = Emoji.Blush;
//for debugging in bot emulator, also output stack trace
if (activity.ChannelId == "emulator"
|| activity.ChannelId == "facebook" //uncomment this line to get stack traces on facebook too
)
{
error += ex.Message + ex.StackTrace;
}
//create response activity
Activity response = activity.CreateReply(error);
//post back to user
ConnectorClient connector = new ConnectorClient(new Uri(activity.ServiceUrl));
await connector.Conversations.ReplyToActivityAsync(response);
}

Resources