Integrate LiveAgent with MS BotFramework (NodeJS)? - botframework

I have a problem in integrating LiveAgent (A customer support/ticketing web application) and MS BotFramework.
The botframework in Azure works fine and ready to integrate with it.
Here are what I guessed/supposed to be the architecture
LiveAgent will do a HTTP POST (they have API for that) to MS Azure Bot Endpoint (NodeJS Application - like: https://<ms_azure_link>/api/messages)
When Azure receives the POST, it will match the intent, running the normal dialogflow, and return necessary response (text, hero card, image etc.), until the end of conversation.
Here are my questions:
When LiveAgent wants to connect to Azure, which endpoint should be used? The api/messages or something called DirectLine API 3.0?
Actually the DirectLine API will return something like this:
{
"conversationId": "3M3TeaDtc3uArxXwlna7AG",
"token": "<My token>",
"expires_in": 1800,
"streamUrl": "wss://directline.botframework.com/v3/directline/conversations/3M3TeaDtc3uArxXwlna7AG/stream?watermark=-&t=ubeJVCXqb9I.dAA.MwBNADMAVABlAGEARAB0AGMAMwB1AEEAcgB4AFgAdwBsAG4AYQA3AEEARwA.7UpMr6Tm0wE.9RmCM_XyjII.CQbU7viSec2P7CtznrijQwou0A8N0GynOvnsUmNT04o",
"referenceGrammarId": "669c7246-bc5c-f25f-aae7-0ad7f39e25b4"
}
As you can see, after you connect using DirectLine, you need to proceed using WebSocket.
So how to connect to this WebSocket thing using LiveAgent? For your information, LiveAgent only suppots HTTP GET/POST to custom URL.
If we don't use DirectLine API, that I will use MS Azure Bot Endpoint.. Now the question becomes: what should be passed to this endpoint so that LiveAgent can authorize itself and using the Bot as usual? Any example on that? DirectLine API Example seems not talking about this.
Thank you very much in advance. I know that this question may not be illustrated well but, hope that you can understand.
If you have any question, please let me know, I am glad to clarify that.
Thank you very much again for all your help.

If you want to treat LiveAgent as a bot client and to make some request against to your bot application. We suggust you to leverage DirectLine APIs.
To implement with DirectLine API via Node.js, you can start with the sample at https://github.com/Microsoft/BotBuilder-Samples/tree/master/Node/core-DirectLine/DirectLineClient
Specially to your second question, to keep a conversation with bot, the web socket stream is not required, unless you want to Receive activities via WebSocket stream
You can refer to the code block from the official DL code sample, which doesn't keep the web socket stream, and only leverage the conversationId and token to make HTTP requests against to bot application.

We did similar solution using MS BOT Chat SDK without DirectLine using windows selfservicehost service. We are interface from left side to MS BOT and to another CRM from right side. When do you say LiveAgent - is it Salesforce solution?

Related

Messaging endpoint of a Microsoft framework BOT

Does the messaging endpoint of bot need to be anonymous?
Any help is greatly appreciated.
If you are using bot framework v4 SDK and when you register a bot in the Azure portal, for example via the Bot Channels Registration, this authentication automatically performed. So, you don't need to explicitly write any code. If you want to restrict the use of bot to users belonging to your tenant you can add authentication to a bot using OAuth. Please go through this documentation for reference.
My understanding is that requests to your /api/messages endpoint include a JWT bearer token issued by the bot framework. The SDK will check this for you.
This appears to be the code where it performs the validation:
https://github.com/microsoft/botbuilder-js/blob/fc5dcc535855cf453b0ebf373121277d824ff840/libraries/botbuilder/src/botFrameworkAdapter.ts#L1180
If you're implementing without the SDK, then you will need to do the JWT verification.

Microsoft Botframework and Data Protection

I'm using MS Bot Framework with Directline for webchat and our client has raised an issue about Data Protection i.e. the user is sending personal data via a Microsoft api.
I don't really know how to reply to this since (a) Pretty much every bot uses a cloud service if you want any sort of assistance and (b) I assume that Directline does nothing with the data and it is purely a conduit, but I don't know that for a fact.
Was going to post on bot builder github issues, but they say it's just for bugs and suggested that I come here. I am looking for some clarification (or a contact at MS) about the privacy and data protection of the conversations if you are using Microsoft's bot framework with any one of their connection services - particularly Directline.
Thanks,
Jarrod
Our official handling terms are listed under the Bot Framework Terms of Service and Privacy statement found on the Bot Framework portal. Are there specific questions your customer has?
-jim

Writing A Bot Framework Client

I've been away from BotFramework development for a while and have now come back to it.
I am using this Bot hosted internally within my company, and talking to it using a relay application using REST. This all worked fine.
However, after updating to V3 of the Bot Framework I came across issues. I see that the changes mean that the Bot now replies asynchronously, sending data to the ServiceURL field. Therefore I have a couple of questions.
Can I still use this architecture for the Bot Framework? (i.e. hosting internally to the company, without using Azure or Connectors)
If I can, I assume that my relay application will need to have an endpoint that the Bot can reply to? Does it just do a http POST to the ServiceUrl I give it? (i.e. http://mybotserver:9000) or is it posting to a URL under that server address? I assume the body of the post is the usual Json you see in the Channel Emulator.
I don't know the specifics of your architecture, but in general, if your bot (via relay) can:
Reach the ServiceURL endpoint with an https post
Receive incoming requests to an endpoint you registered with the Bot Framework
The relay needs to be able to reach our login service to sign requests
Also needs to be able to reach our OpenId endpoint as part of signing/authenticating
That should be it.

How to reach bot service (microsoft bot framework) deployed to azure via fiddler ?

I have a bot service in which I created a new get endpoint using the following
code:
[HttpGet]
[Route("bot/test")]
public async Task TestController()
{
// Do some stuff
}
Now I want to hit the endpoint using the fiddler. But my request is not getting authenticated. I am using bot sdk v3. Earlier when I was using bot sdk v1, I was able to make request using fiddler by providing
authentication: basic base64(appId:appsecret)
Any pointers as to How can I make request to v3 bot service?
You may want to consider using the Bot Framework Emulator instead of Fiddler. It provides a much richer debugging experience.

Microsoft Bot Framework Client sdk

I am looking to use Microsoft Bot Framework in my application. However, I have a custom UI chat control (designed according to my requirements) where I need to hook up this bot.(instead of having pre-configured channels like slack or skype).
Is there a client sdk for web (preferably in angular) and/or mobile available for this purpose?
Take a look at DirectLine.
The Direct Line API is a simple REST API for connecting directly to a single bot. This API is intended for developers writing their own client applications, web chat controls, or mobile apps that will talk to their bot.
DirectLine is always a good option to add chat functionality in your custom UI. Otherwise you can just turn on Web Chat channel and embed iframe in your webpage. This will make your job easy with very less errors.
I have seen directline causing many issues while sending requests. Web Chat is always a better option.

Resources