Load testing bot with serviceUrl throws exception - botframework

System Information
SDK Language: Node.js
SDK Version: 3.8.3
Development Environment: localhost
Issue Description
Following the blogpost https://blog.botframework.com/2017/06/19/Load-Testing-A-Bot/ to load test the bot Im creating a "sink" service to send messages to the bot. Since it uses it as the serviceUrl in the message, the bot talks to the sink service for other purposes too.
I can post to the bot, but at one point when the bot is talking back it sends a message of type 'event' 'Debug' that has no conversation object in the address, resulting in an exception being thrown.
Expected Behavior
The bot sends activities back to the sink service
Actual Results
After activity type 'messge' and 'typing' have been sent, the debug event activity raises an exceptoin:
TypeError: Cannot read property 'id' of undefined
at ChatConnector.postMessage (/Users/nico/workspace/ambitai/codereview/server/node_modules/botbuilder/lib/bots/ChatConnector.js:459:82)
at /Users/nico/workspace/ambitai/codereview/server/node_modules/botbuilder/lib/bots/ChatConnector.js:165:27
at iterate (/Users/nico/workspace/ambitai/codereview/server/node_modules/async/lib/async.js:262:13)
at Object.async.forEachOfSeries.async.eachOfSeries (/Users/nico/workspace/ambitai/codereview/server/node_modules/async/lib/async.js:281:9)
at ChatConnector.send (/Users/nico/workspace/ambitai/codereview/server/node_modules/botbuilder/lib/bots/ChatConnector.js:159:15)
at RemoteSessionLogger.flush (/Users/nico/workspace/ambitai/codereview/server/node_modules/botbuilder/lib/RemoteSessionLogger.js:74:24)
at /Users/nico/workspace/ambitai/codereview/server/node_modules/botbuilder/lib/Session.js:638:26
at /Users/nico/workspace/ambitai/codereview/server/node_modules/async/lib/async.js:52:16
at Object.async.forEachOf.async.eachOf (/Users/nico/workspace/ambitai/codereview/server/node_modules/async/lib/async.js:236:30)
at Object.async.forEach.async.each (/Users/nico/workspace/ambitai/codereview/server/node_modules/async/lib/async.js:209:22)
at Session.onFinishBatch (/Users/nico/workspace/ambitai/codereview/server/node_modules/botbuilder/lib/Session.js:616:15)
at /Users/nico/workspace/ambitai/codereview/server/node_modules/botbuilder/lib/Session.js:430:27
at /Users/nico/workspace/ambitai/codereview/server/node_modules/botbuilder/lib/Session.js:606:17
at /Users/nico/workspace/ambitai/codereview/server/node_modules/botbuilder/lib/bots/UniversalBot.js:523:17
at /Users/nico/workspace/ambitai/codereview/server/node_modules/botbuilder/lib/bots/ChatConnector.js:178:36
at /Users/nico/workspace/ambitai/codereview/server/node_modules/async/lib/async.js:52:16
at /Users/nico/workspace/ambitai/codereview/server/node_modules/async/lib/async.js:269:32
at /Users/nico/workspace/ambitai/codereview/server/node_modules/async/lib/async.js:44:16
at /Users/nico/workspace/ambitai/codereview/server/node_modules/botbuilder/lib/bots/ChatConnector.js:167:25
at /Users/nico/workspace/ambitai/codereview/server/node_modules/botbuilder/lib/bots/ChatConnector.js:474:21
at Request._callback (/Users/nico/workspace/ambitai/codereview/server/node_modules/botbuilder/lib/bots/ChatConnector.js:508:37)
at Request.self.callback (/Users/nico/workspace/ambitai/codereview/server/node_modules/request/request.js:188:22)

Found the issue, when calling the bot endpoint, the activity must provide the conversation id. This was not specified in the blogpost. By adding conversation: { id: <id> } to the activity being posted it works

Related

"Subscription validation request failed. Notification endpoint must respond with 200 OK to validation request"

I finished this tutorial https://learn.microsoft.com/en-us/graph/tutorials/azure-functions?tutorial-step=5 everything worked fine until i published my azure Functions in my Azure App.
When i try to make the subscription i get this error "Subscription validation request failed. Notification endpoint must respond with 200 OK to validation request". When i test with ngrok i can create the subscription with no problems but when i replace NgrokURL value for my Azure function Url, not. Is that the right way to create the susbcription? Also i tried to create the subscription in Graph Explorer but i still get this message.
As the same question raised in MSFT Docs Q&A Forum and thanks to the Shwetachoudhary provided the solution that helps other community members:
In the following below code,
content type must be text/plain.
body must include the validation token.
CodeSamples
asp .net mvc sample - Specifically look at the NotificationController.cs file
In the method
[HttpPost]
public async Task<ActionResult> Listen()
{
if (Request.QueryString["validationToken"] != null)
{
var token = Request.QueryString["validationToken"];
return Content(token, "plain/text");
}
'notificationUrl' must be able to respond to the request for validation. Make sure the validation token returns as plain/text as well. Refer to the Notification endpoint validation document provided by Microsoft.
Try isolating the code and calling the same API with Postman or Graph Explorer and see the results.

Establish bot to bot communication in Microsoft Bot Framework

I have 2 published bots in Azure. Now, I would like to establish communication between bots.
Using Skill bot concept, I can able send message from parent bot(Bot1) to child bot (Bot2). once Bot2 received the message it throwing below error:
Error 403 - This web app is stopped.
The web app you have attempted to reach is currently stopped and does not accept any requests. Please try to reload the page or visit it again soon.
If you are the web app administrator, please find the common 403 error scenarios and resolution here. For further troubleshooting tools and recommendations, please visit Azure Portal.
Also , I am getting below error at Bot1:
[onTurnError]: Error: Request failed with status code 500
[onTurnError]: [object Object]
[onTurnError] unhandled error: Error: Request failed with status code 500
I didn't find any other errors except above mentioned information /error.
please suggest me what I am doing wrong here.
I look forward for your suggestions/corrections. Really appreciate for your response.

How do I retrieve the sender number when using Twilio's messaging services with Copilot enabled?

I have a Twilio messaging service with Copilot and the sticky sender feature enabled.
I would like to view the phone number that Copilot assigns to my recipients when I send them a message.
With the Ruby client, I get a MessageContext object when I send a message, but it only has the
messaging service SID - the from method returns nil.
Currently, this is how I'm sending messages:
def send(from, to, message)
client = Twilio::REST::Client.new(ACCOUNT_SID, AUTH_TOKEN)
client.api.account.messages.create(
body: message,
messaging_service_sid: from,
to: to,
status_callback: BASE_URL + '/sms_status/status',
)
end
Twilio developer evangelist here.
I'm not sure, but you might not have the phone number at the time you make the API request using a messaging service. This request really just queues up the message to be sent.
I would check the message object once it has been sent. You have a status callback URL setup, so you should be able to either inspect the parameters sent to that URL or look up the message from the API using its SID and then get the number that was used.

Bot Framework API, reply to messages

I have registered Bot channels on Azure portal and enabled Skype support. I'm trying to create a reply to skype messages as described here.
I get user's message like: { ... 'type': 'message', 'id': '1579000...' ... }
And then use that id when sending POST to .../v3/conversations/{conversationId}/activities/1579000...
In a request body I also have 'replyToId': '1579000...'
The message, which is sent to skype, comes up without any quote inside (as usual message). What am I doing wrong? Do I understand how it should actually work (maybe this is not quoting, but something else)?

How to customize error message sent to an end-user when bot's endpoint is unavailable?

If a user sends message to a bot while it's endpoint is unavailable or failed processing the message, the user receives an error message from Bot Connector, which seems like that:
POST to {SomeArbitraryBot} failed: POST to the bot's endpoint failed with HTTP status 502
or
POST to {SomeArbitraryBot} failed: A task was canceled.
etc.
Is there a way to customize logic of sending error message or to suppress it at all in such a case?
UPDATE
I posted a corresponding issue at Bot Builder GitHub repository.

Resources