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.
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.
- Open the Publishing section of your NativeChat bot.
- Click the Add button for Mobile App / NativeScript to open the NativeScript mobile app configuration generator.
- Click the Generate embed code button. You will receive your embed code for any web page.
- Copy the HTML embed code.
Configure your NativeScript app
- Create a new HTML file.
- Make sure the HTML file contains an opening and a closing
<html>tag and an opening and a closing
<body>tag between them.
- Paste the HTML embed code from NativeChat between the opening and closing
<body>tags in the HTML file.
- You can set additional options in the HTML embed code. All available options are listed here.
- Add a WebView component in a page of your NativeScript app.
- Set the
srcpath of the WebView to the HTML file with the HTML embed code for your NativeChat bot. e.g.:
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.