What is Direct Line in Azure? - azure

I am starting to develop a bot for Teams and I do not understand the various channel offerings. I know I need to add Microsoft Teams to the channel list in Azure for the bot to be able to message people through chat channels, but I can't figure out how to allow the bot to communicate with an API that is hosted in AWS. Maybe Direct Line is what I'm supposed to use, but the documentation is very unclear. Here is what I can find about Direct Line:
Direct Line. This is the standard channel offering of Direct Line. It works by default with bot templates via the Azure portal, bots from the Bot Builder Samples, and bots created with the Azure CLI. This is the Direct Line best suited in the majority of the cases. See Connect a bot to Direct Line.
If anything, I became more confused after reading that. It raises more questions than it answered. If Direct Line is supposed to allow me to communicate with third-party APIs, I don't know how to get started even if I enable it. The BotBuilder repository documentation does not mention Direct Line channels, at least not in an obvious way, so that hasn't been much help either.
I have very little clue about how this works even though I spent my whole day reading about it. Deploying a bot to Teams that can make a call to another API is much more difficult than I anticipated. All I want to do is say #bot command and have it call an API to make a GET request. Once I am able to do that, I will be able to develop the rest of the application, but using the requests module in Python has not worked and I don't know why.
Anything you can offer about how this should work would be greatly appreciated.

Direct Line, as the name implies, is a direct line of communication to an Azure bot. Essentially, it is a set of APIs that you can use to communicate with an Azure Bot outside the set of provided channels. If you are building a custom application that none of the other channels such as Web Chat, Teams, Email, etc. would be appropriate for, then you can use the Direct Line API to send and receive messages to and from a hosted bot with REST calls. The API reference in the documentation explains how to connect to and use Direct Line. You would implement these calls into your application as you would calls to any other REST API and display the responses in whatever manner fits your use case.
The key intuition here is that Direct Line is only for communicating with the bot. It has nothing to do with connecting to outside services. Communicating with 3rd party services would be accomplished in the same manner as any other application. I don't know how you've implemented your application or what service you're connecting to, but I would suggest you double check that your calls to that service work outside your bot using Postman or curl before attempting to implement them into the bot.
Your use case would appear to be the Microsoft Teams channel, and not Direct Line.

I'm not totally clear either on what Direct Line is for, but from what I can understand it would be if you want to include a bot experience in your own custom app, like a desktop app with a "chat" feature. It's definitely not needed for Teams though - you only need the Teams channel.
With regards calling an API from within your bot, essentially your bot is just a standard web service - it can do anything any other kind of web service / web api can do, e.g. calling a 3rd party API.

Related

Microsoft Teams - Bot Health Check

I want to implement a health check on my MS Teams bot but it seems that support for that was removed on https://github.com/microsoft/botframework-sdk/issues/6225.
What is the best approach now to add a health check to my bot?
Thanks
There is no mechanism built into the Bot Framework SDK to accomplish this. You'd need to setup an API route in the bot, and have the other service call that endpoint. Depending on your security considerations you'd probably also want to authenticate that call in some manner.
At the end of the day, the bot is just a web service using some specialized API calls to model conversations - you can add any additional APIs you like just as you would with any other web service.

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.

How to use botframework on Azure endpoint to work in your own bot design?

My question is simple. However, I am unable to find it anywhere on Internet.
I have published my bot on azure. It gives my messaging endpoint as https://something.azurewebsites.net/api/messages (it is not exactly real).
How can I use this to get and post json files that it should give? The file I will receive, I will hold it on variable and then loop around to get particular messages or post messages. However, it is not work? Do I need to give secret along with this on header? How will this endpoint work so I can give and receive messages through input field on my chatbot design on HTML?
You won't ever need to get or post messages directly. If you have a Bot Channels Registration resource or a Web App Bot resource then that takes care of all communication with your endpoint. Connect your resource to whatever channels you want (like Direct Line) and then use those channels' clients to communicate with the bot. Have a look at the documentation for more information: https://learn.microsoft.com/en-us/azure/bot-service/bot-service-overview-introduction?view=azure-bot-service-4.0

Customise Azure bot framework in NodeJs using DirectLine JS

I am looking for a solution which has Customised Azure bot in website. I am not looking for an iFrame integration, As i have already explored. I need a solution which gives me an option to make UI changes in the bot window and invoke Live agent Chat window(Third party) from the existing Chatbot.
I tried these link below which dint help
https://github.com/Microsoft/BotFramework-WebChat
I understand exactly what you need.
It's true that the github url you pasted won't help but I know you'll get a lot of tips from the Direct Line and DirectLineJS documentation from the Advanced part.
You simply need a way to integrate to the Bot Framework from your existing UI system and hence using the Bot as just an Endpoint.
Your solution lies in the actual implementation methods for various channels that is supported by Bot Framework. Take Skype or Facebook for instance.
You need to study and configure WebHooks, Direct-Line Channels.
First: Use the Azure Portal to add a new website to your Bot in Channel property.
Secret Keys would be generated for you after then you can configure for version 1.1 or 3.0.
Check the Documentation here: https://learn.microsoft.com/bot-framework/rest-api/bot-framework-rest-direct-line-concepts
Now your site can be configured to talk to the Bot Framework via Web Clients and Sockets as API requests.
With these, you have the priviledge to use your own UI with the Bot Framework.

Where is Microsoft.ServiceBus.Notifications.NotificationHubClient?

I have started learning about notification hubs and have gone through some tutorials.
Now I need to send messages from my ASP.NET WebAPI 2 backend to the notification hub. So I decided to learn about the Notification Hubs Rest API.
On this link It is written that Microsoft already provides a .NET wrapper around the REST API in the Microsoft.ServiceBus.Notifications.NotificationHubClient on this page.
But on clicking the link it says topic is no longer available.
Now I need to learn about how to send push notifications from my asp.net web api backend and azure website seems to have only one tutorial which is this
So can someone please point out where is Microsoft.ServiceBus.Notifications.NotificationHubClient or some tutorials or other library if this one is outdated
is there a specific reason you want to implement the solution using REST API directly? I would not recommend that unless you have the reason. There is a Microsoft.Azure.NotificationHubs library that you can use for your Web API solution, and the tutorial you mentioned is the right one (you can install it using NuGet). For more fast proof of concept implementation, you can skip the authentication part here, however it is good one to know.

Resources