How to get and pass user conversation data to backend API in Azure Bot Framework Composer v1.4.0? - azure

I am new to Azure Bot Framework Composer.
I am creating chatbot using Azure Bot Framework Composer(without writing code) which need to be launch in Angular Web Application from Azure Cloud after deployment.
In my chatbot project, need to fetch the user conversation data and send it to backend API from Azure Bot Framework Composer.
How to achieve this?, anyone help on this.

You can view the conversation data using ${conversation} scope and from dialog stack can access required information. To get last conversation data can use ${turn.Activity}. For sending to backend API, create HTTP post method and pass the data in the body of your request.

Without knowing more details on your chatbot project, one reasonable approach to take is to use the Send HTTP Request action in the composer.
After you obtain the values from the conversation that you are looking for, (can be stored in conversation / dialog variables), you could then pass it onto an HTTP send request and deliver that to your backend API.
With this, you can send any payload to your backend API.

Related

Connect slack with simple web api token but not with Slack bot or slack app

As a leisure project, I created a small project that updates slack status whenever an event is added/updated in Google Calendar (Just like the Google calendar app on Slack). Whatever I implemented till now works as expected but I did so by creating a new Slack app, which I don't want to do - In other words, I am trying to integrate Google Calendar with Slack, without any Slack bot or Slack app setup. At least this is what Zapier does - It asks for authentication to Google calendar & Slack, and integrates them without having a Slack bot or Slack app.
I referred to Slack API docs but couldn’t find any page helpful enough to work without a Slack bot or Slack app, and simply with a Web API token.
I think I found a page closer to what I need but this too requires a client ID and client secret which are possible if a new app is created.
It's no longer possible to generate an API token on its own for Slack. If it helps, you can just think of a Slack app as a simple container representing what you want to accomplish. Install the Slack app to get the token and then use the token for that purpose. You don't need to learn or implement OAuth or provide much more than a name to retrieve a token scoped to the activities you wish to accomplish.

Azure Bot - communicate through REST APIs

I have to integrate 2 different azure bots into a single azure bot application. So thinking of integrating with the REST api. Will this approach work ?
From this links
https://learn.microsoft.com/en-us/azure/bot-service/rest-api/bot-framework-rest-connector-quickstart?view=azure-bot-service-4.0
https://learn.microsoft.com/en-us/azure/bot-service/rest-api/bot-framework-rest-connector-api-reference?view=azure-bot-service-4.0
I can get the access token from cloud bot. But there is no example on "sending message from client". It have examples on handling client messages from server as Activity object.
It would be better if any samples on "sending message from client to azure cloud throught REST"
what is different between REST and connectors.?
I believe it will be possible with DirectLine, but wanted to know how to do thorugh REST APIs.
Thanks in Advance !!
I can't tell you whether or not your idea will work for dealing with two separate bots without more information. If you are trying to start conversations with both bots and the sending messages to the different conversations based on some set of criteria than that should work.
The Bot Framework API can essentially split into two sections:
The Connector (primary) API that the bot uses to talk to users and the service.
The DirectLine API that you can use to talk to the bot instead of using one of the built-in connectors like Slack or Teams.
Based on your needs, the DirectLine is indeed what you are looking for. The directline.botframework.com/v3/directline/conversations/abc123/activities endpoint will allow a client app to send a message to the connected bot.

Edit request in js before sending it to fullfillment endpoint

I need to edit request before sending it to endpoint.
Using Web Demo integration I'm able to send request to the endpoint.
But I can't edit the request in order to provide some extra data to request. Extra data is stored in localStorage so I need to do this in javascript.
I've already connected the agent to an endpoint that handle the request using fullfillment. The problem is that request misses data I can retrieve only from the browser. From fullfillment I can set headers and basic auth but statically and it is not enough.
So I need to add a step in request building/sending:
User write or tell something to embedded chat (Web Demo integration)
Dialogflow recognize intent, params, generate the request.
Additional step: Update the request in javascript
Forward cutomized request to the endpoint
Maybe it's not possible using Web Demo integration. In Documentation can't find a way to just send string or audio in order to receive the generated request.
First of all you will need a custom chat integration, not the default Dialogflow one. Something like Smooch or Kommunicate. The default web demo should only be used for testing your bot. There is NO way you would want to use that in a production environment.
I would save whatever is in the local storage in a database such as Firestore. Once that data is in the database you can use it to modify your request in your fulfillment.
So what I would do:
Have a way to identify a user and save its local storage to the database (as soon as someone clicks on your chat window or opens the chat window)
Once an intent is triggered you check which user is contacting you (through the way that you identified the user) and get all data from the database
Request the data in your fulfillment server
There is no other way in which this is possible. You can't change requests before your query hits Dialogflow.

How to create a custom webhook in Dialogflow based on Azure?

So I would like to implement Dialogflow fulfilliment using a custom node.js webhook. I've created a node.js app in Azure (I have my own .azurewebsites.net site), however I'm not quite sure how to link it to Dialogflow. How do I do this? Thank you.
On the dialog flow side Go to dashboard and click on fulfillment on side bar provide the web hook and basic authentication and headers.
On nodeJs make sure you provide POST Webhook API where dialogflow app sends requests.
Are you familiar with Express or any other framework to create REST APIs with Node?
There are tons of material on the web, but this is a starting point if you like.
In this link you'll find the documentation that shows which fields will be posted to your endpoint and those that you'll want to send back to Dialogflow.

How to get conversation details in microsoft bot framework for skype?

I'm able to get conversation details for webchat using https://webchat.botframework.com/api/conversations/[conversationId]/messages
Service URL for skype channel is https://skype.botframework.com, but I dont find any documentation for getting conversation details
You can use the DirectLine Rest API (see docs).
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, mobile apps, or service-to-service applications that will talk to their bot.
Within the Direct Line API, you will find:
An authentication mechanism using standard secret/token patterns
The ability to send messages from your client to your bot via an HTTP POST message
The ability to receive messages by polling HTTP GET
A stable schema, even if your bot changes its protocol version
You need to enable the DirectLine channel for your bot on (see screenshot)
You don't have to access each specific channel endpoint separately, you can do it all (with some limitations) through the DirectLine API.
Start a New Conversation
POST /api/conversations
Get Messages in a Conversation
GET /api/conversations/{conversationId}/messages
Send a Message
POST /api/conversations/{conversationId}/messages
The full details are in the docs as linked above.
Hope this helps
Can you be more specific about conversation details and what you're looking for?
Generally, you shouldn't assume those URL's are static BTW; an incoming message from the Bot Framework will have a ServiceURL that should be used for the life of that conversation. Some services may have multiple ServiceUrl's that they give out for different users.

Resources