Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
In this article
APPLIES TO: SDK v4
Although bots most commonly exist outside of apps, they can also be integrated with apps. For example, you could embed a knowledge bot within an app to help users find information that might otherwise be challenging to locate within complex app structures.
You can embed a bot within a help desk app to act as the first responder to incoming user requests. The bot can independently resolve simple issues and hand off more complex issues to a human agent.
The way to integrate a bot with an app varies depending on the type of app.
An app that's created in native code can communicate with the Bot Framework by using the Direct Line API, either via REST or web sockets.
A mobile app built with a web language and frameworks such as Cordova may communicate with the Bot Framework by using the same components that a bot embedded within a website would use, just encapsulated within a native app's shell.
An IoT app can communicate with the Bot Framework by using the Direct Line API.
In some scenarios, it may also use Azure AI services like Speech, Translator, Language, and Vision.
Other types of apps and games can communicate with the Bot Framework by using the Direct Line API.
This example of creating a mobile app that runs a bot uses Xamarin, a popular tool for building cross-platform mobile applications.
First, create a web view component and use it to host a Web Chat control. Then, using Azure portal, add the Web Chat channel.
Next, specify the registered web chat URL as the source for the web view control in the Xamarin app:
public class WebPage : ContentPage
{
public WebPage()
{
var browser = new WebView();
browser.Source = "https://webchat.botframework.azure.cn/embed/<YOUR SECRET KEY HERE>";
this.Content = browser;
}
}
Using this process, you can create a cross-platform mobile application that renders the embedded web view with the web chat control.