BotFramework Web Chat with existing chat box - c#

I am trying to understand how to integrate BotFramework (C#) with an existing application without the use of Azure and using DirectLine, but everything I have seen so far requires an Azure subscription. I have looked at ngrok, but not sure if that is reliable for a production environment. I have also been digging around the source code repositories of BotFramework-Emulator and BotFramework-WebChat, but haven't found good information that relates to my use case.
If we have an existing "chat box", that has already been styled and has some basic commands that a user can enter, how could I reuse that chat box, but just implement the BotFramework routing? The idea being it is our standard chat box, but when the user types a command like /todo it would start a new bot conversation.
Without Azure, how would we generate a DirectLine token to access our C# WebAPI BotFramework Chatbot? I tried just opening a WebSocket in devtools to try and send messages, but wasn't successful
Sure, it is possible to just to plain REST routing, but would ideally like to use WebSocket to send/receive messages.

Generally speaking, the Azure Bot Service is a required component of using the Microsoft Bot Framework as it serves as the connector (via the supported channels - DirectLine, Teams, Slack, Facebook, etc.) between your bot and the specific channel. It is also responsible for generating the tokens that allows your bot to connect and pass messages around.
However, it is possible to run your bot without the use of the Azure Bot Service. Two options that may serve your needs are:
offline-directline: "Unofficial package to emulate the bot framework connector locally."
InDirectLine: "[T]he DirectLine is a bridge that connects your bot and your client. This project (InDirectLine) is a custom implementation of my own..."
You will need to research both to identify which, if either, could/would meet your needs. But, in short, both projects allow you to run your bot locally, or seemingly from a hosted remote environment, and connect to it.
Hope of help!

Related

How to connect Azure Language Service with knowledge base to Bot Framework SDK V4

I have followed the steps from the AI-900 lab: https://microsoftlearning.github.io/AI-900-AIFundamentals/instructions/04d-create-a-bot.html
I have a simple bot working and it is deployed.
I want to use this chat-bot and extent its functionality.
=> If a user is not satisficed with the bot support, show a button "Would you like to create a bug?" -Yes -No
=>If Yes = I want the chatbot to call an Azure DevOps API to create a bug based on the information collected form the chat.
=> If No = Reset chatbot
What I have done:
I went to Azure Bot Service and I have downloaded the Bot source code.
Run it using Visual Studio 2022 and it runs but, cannot connect to Knowledge Base and Language Service.
I am testing it using Bot Emulator v4.14 on Windows.
Problems and Questions:
I know that QnA will be retired and it is replaced by Custom Question Answering. How to connect Azure Language Service so I can have access to the Knowledge Base and questions I have created in the Language Studio?
Is Azure Bot Framework SDK v4 the correct tool to use? I am writing C# and I want something like this:
If Yes then call Azure Dev Ops API to create a bug with the description and info used in the chat.

How to add authentication to a Bot Framework v4 project without Azure Bot Service?

I'm working on an bot with Bot Framework SDK v4. The plan is to host it on a local server. I've been trying to add authentication with Azure AD to it but I don't want to use the Azure Bot Service. This guide explains how to add authentication but it uses the Azure Bot Service that generates the MicrosoftAppPassword value for the appsettings.json configuration which I need.
What is making me think that using Azure Bot Service is not required is the Bot Framework website where I can register my bot. But I'm not quite sure how to exactly get this to work both with Azure Portal and with the code.
Is there any way to add authentication to a bot for Microsoft Teams without using Azure Bot Service?
This blog post might help to explain how the Bot Framework and Bot Framework Services fit into the picture: https://hilton.giesenow.com/how-bot-calls-actually-work
In essence, you definitely can't run a Bot Framework bot without the 'Services' part behind the scenes, but that does NOT include the hosting - you can host your bot anywhere you like. In the Azure portal, there are various options when creating a bot (I'm not sure what they're called now, it's a few months since I looked), but one used to be called "Bot Channels Registration", which was basically just the registration in the Bot Framework Services, and the other was "Web App Bot", which included both the registration as well as a hosting model, using Azure Web Apps <- this is NOT required and the other option is perfectly fine, allowing you to host wherever you like, provided it's an httpS web-addressable endpoint.
With that in mind, you can host the bot anywhere you like, but still tap in to the authentication/SSO/etc. that the framework + services provide.

How to publish and deploy multi-channel bots without azure?

once I read about Microsoft bot framework, I realized that it is a platform to code once and run everywhere... I mean, you code once and then you have bots for Telegram, Facebook, slack, skype and so on.
Is my understanding about Microsoft bot framework correct? Or I'm expecting too much of it?
Then I downloaded Bot Composer for my windows laptop and created a bot.
It works on emulator.
My problem/Question is how to publish and deploy my bot without azure?
I have a VPS on Hetzner, and I want to host my Bots in that vps.
The bot composer has only options working with azure, I don't have Microsoft app ID and Microsoft app password. What should I do ?
In this chart, It can be seen that some social platforms work with azure, and some others work with sdk, for example Telegram -->> SDK , What does it mean ?!?!?
Does it mean that you have to pay for Azure to publish your bot for Telegram ?
In this link, I have to register a bot, there is a button there which says : Create Microsoft App ID and password.
I clicked on it and created one, there is Microsoft App ID in it, but there is no password.
I know I wrote too much :)) but I got very confused because I think the documentation is very unclear and the boundary between paid services and unpaid services is not clear...
Can anyone tell an instruction of how to deploy an simple echo bot on a VPS for multiple platforms without azure ?
Thank you.
That's a bunch of questions 😅, will try to synthetize.
Yes it's a code once, use from several channels... but not all channels have the same capabilities.
A bot application is "just" a state machine with a REST API endpoint to receive messages and send the replies back (seen from 30,000 ft 😉)
You can host your app anywhere, it just has to have a valid public https address that you can configure in the Bot Channel Registration in Azure.
Azure Bot Service is a channel aggregator, that handles all the connection details for the channels listed as "Azure" in the chart you mentioned. Those channels are handled "automagically" by the bot framework.
You might want to read a blog post I wrote some time ago, it's a bit dated but still conceptually valid:
How does a Bot Builder v4 bot work?
For those channels not in Azure, you have to handle each channel with a provider-supplied SDK in your web app. Of course, you could also implement authorization and all the details by yourself, after all it's just an API endpoint.
You don't really have to pay Azure for using the bot service channels, if you use the standard channels, and premium channels are low cost.
As for deploying outside Azure, supposing you'll still use the free or close-to-free Bot Service:
Follow section 1-3 in Deploy your bot
Deploy the web app wherever you want (even locally using ngrok similar to what I show in another blog post.
With all of the above in place, you should be able to test the bot from the channel webchat or even from Telegram, once you enable it, while your app is running in VS 😀

Send In App Message to Android by C# .NET using Firebase In App Messaging

I just want to ask is there any possibility right now to Send Firebase In App Message without using Firebase Console? I want to send In App Message (FIAM) to Android App from .NET C# MVC Web Application. I managed to send Push Notification(FCM) succesfully but what about In App Messaging? Is there any API available for that?
There currently is no API to configure the messages delivered/displayed by Firebase In-app Messaging. If this is a use-case you'd like to see added, I recommend you file a feature request.
The closest work-around at the moment would be to use Firebase Remote Config (which does have an API for setting configuration data) to deliver some value to your clients, and then have your clients display the message on those conditions. This is somewhat similar to what Firebase's In-app Messaging does behind the scenes, although (as far as I know) it uses its own infrastructure to deliver the configuration data.

How to "talk" with a bot framework from code?

I have a bot framework published on Azure that is working fine, according to my emulator. I developed this bot to use it on the app (Xamarin) that I am developing (C#). However, I don't know how to communicate with my bot. I need someway to send "strings" and get the "strings" answered by the bot. How can I establish a connection and a conversation with my bot?
Any code tutorial available?
My bot is published on https://XXXXXX.azurewebsites.net/api/messages .
Thank you in advance!
I think that you will have to use the Direct Line API.
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
Here you will find a sample showing how to create a DirectLine client.

Categories

Resources