Publish Your Bot for Use in a NativeScript Mobile App

Learn how to set-up NativeChat bot in a NativeScript app.

Add a NativeChat widget to your NativeScript app.

Setup

Create a new channel in NativeChat

To receive messages and other events sent by your NativeScript app users, you need to enable Mobile App / NativeScript channel.

  1. Open the Publishing section of your NativeChat bot.
  2. Click the Add button for Mobile App / NativeScript to open the NativeScript mobile app configuration generator.
  3. Click the Add configuration button. You will receive your embed code for any web page.
  4. Copy the HTML embed code.

Configure your NativeScript app

  1. Create a new HTML file.
  2. Make sure the HTML file contains an opening and a closing <html> tag and an opening and a closing <body> tag between them.
  3. Paste the HTML embed code from NativeChat between the opening and closing <body> tags in the HTML file.
  4. You can set additional options in the HTML embed code. All available options are listed here.
  5. Add a WebView component in a page of your NativeScript app.
  6. Set the src path of the WebView to the HTML file with the HTML embed code for your NativeChat bot. e.g.:
<WebView src="~/home/chat.html"></WebView>

Test your bot

After the WebView component is added to your app, you should be able to use the chat UI to send messages to your bot.