2

We have integrated a bot created in Microsoft Botframeowrk with MS Teams (by publising the channel and adding using App ID). On every message that is sent from Teams to the bot, we are getting an error in the channel logs: "activity must include non empty 'text' field or at least 1 attachment". From the console logs, we think that the error is caused by sendActivities being called twice and the second time activity.text field is sent empty which is causing this error. It does not occur in the Web Chat bot.

Rakesh5594
  • 51
  • 2
  • 3
    Can you specify what SDK version are you using and maybe add some code snippets of where the error is showing - anything to further help debugging – Marc Asmar Jan 10 '20 at 09:56
  • I agree with Marc's comment. We need significantly more information. The full error message as well as the code that it points to would be very helpful. This is not a common/known error. – mdrichardson Jan 10 '20 at 18:05
  • Hi Marc & Richardson, The SDK Version we are using are v4 and attached the error we are getting in Azure as warnings and below is log report FYR.. In mainDialog: displayHelpOptions step Innnnnnn onSendActivities Innnnnnn onSendActivities Dispatch Intent: Qna IT intents In QnaMaker dialog - confirm Innnnnnn onSendActivities Innnnnnn QnA if Innnnnnn onSendActivities Regex not found. Sending answer Innnnnnn onSendActivities INSIDE SENDACTIVITY Hi! How may I help to make your day better? Innnnnnn MainDialog intro step Innnnnnn onSendActivities Innnnnnn onSendActivities – Rakesh5594 Jan 13 '20 at 09:18
  • Warning in Azure Bot Framework for Teams is : Activity must include non empty 'text' field or at least 1 attachment – Rakesh5594 Jan 13 '20 at 10:03
  • @Rakesh5594 Again, the full error message as well as the code that it points to would be very helpful. You'll need to edit it into your question so the formatting makes it possible to read. – mdrichardson Jan 15 '20 at 18:31
  • The error log is: Innnnnnn MainDialog intro step In mainDialog: displayHelpOptions step Innnnnnn onSendActivities Innnnnnn onSendActivities Dispatch Intent: Qna IT intents In QnaMaker dialog - confirm Innnnnnn onSendActivities Innnnnnn QnA if Innnnnnn onSendActivities Regex not found. Sending answer Innnnnnn onSendActivities INSIDE SENDACTIVITY Hi! How may I help to make your day better? Innnnnnn MainDialog intro step Innnnnnn onSendActivities Innnnnnn onSendActivities – Rakesh5594 Jan 16 '20 at 05:47
  • Normally in webbot when we ping Hi msg .. ( THe first Msg) it replies with Hi! How may I help to make your day better? but in teams it replies Hi! How may I help to make your day better? and along with that it throws an error Sorry, it looks like something went wrong!... So its the initial ping error might it is responding twice when called through teams, Even from logs we observed that at the end it call Innnnnnn onSendActivities for twice normally it should be Innnnnnn onDialog after Innnnnnn onSendActivities. No Specific code issue, Issue is with the returning on Send Activity. – Rakesh5594 Jan 16 '20 at 06:08
  • is your bot running locally (ngrok) or it is deployed somewhere? Could you please tell us what error you are getting when bot is pinging the messaging endpoint api/messages? Please share the sample code what you are trying. Please take a look at this sample code for [Echo Bot](https://github.com/microsoft/BotBuilder-Samples/tree/master/samples/csharp_dotnetcore/02.echo-bot) – Trinetra-MSFT Jan 23 '20 at 10:53
  • 1
    Hi, did you manage to fix this, can you share the solution? – Mark juzefin Oct 29 '21 at 06:09
  • 1
    @Rakesh5594 I'm also facing the same issue. were you able to fix this ? – Hari Apr 20 '22 at 07:27

1 Answers1

0

I've faced the same problem. It first started appearing when I was sending multiple messages in one turn. Also, it only occurs when the message is sent from Teams, not if I test it via the Emulator or the WebChat.

To me it seems like this error doesn't affect the bots behavior as long as the part, where the error occurs (so TurnContext.sendActivity) is after the bots logic is handled.

So it isn't a solution, more like a workaround but if you are able to: just move the sendActivity to the very bottom of your logic, so it gets called in the end.

Simon
  • 19
  • 4