0.3.0 • Public • Published


A simple react native project integrated with Rasa Open Source with using REST Channel. Please see more at Rasa Rest API.

This project uses react-native-gifted-chat so you can use all the props from it.


yarn add react-native-rasa


npm install react-native rasa

Setup your Rasa host

The REST channel will provide you with a REST endpoint where you can post user messages and receive the assistant's messages in response.

Add the REST channel to your credentials.yml:

  # you don't need to provide anything here - this channel doesn't
  # require any credentials

Restart your Rasa X or Rasa Open Source server to make the REST channel available to receive messages. You can then send messages to http://<host>:<port>/webhooks/rest/webhook, replacing the host and port with the appropriate values from your running Rasa X or Rasa Open Source server.

Message Format

Please see more informations from Rasa Doc at here, you also need to know about react-native-gifted-chat message format to understand how this libray works.

Rasa Example


On the example-rasa folder there is a sample code using poetry and Rasa 3.0.4. If you do not have poetry installed yet you can install it from here. It requires you have python = ">=3.7,<3.9" installed.

You can activate a python environment and install packages with the following commands. Make sure you are on example-rasa folder

poetry shell
poetry install

Running the Rasa and Action Server

At the root of your rasa project, run the following command to start the action server. It will be defaulted to port 5055.

rasa train
rasa run actions

You should see the following output at the terminal action-server-img

Open a new terminal and activate the same virtual environment with poetry shell. Change to directory example-rasa. Run the following command to start the server. The default port is 5005.

rasa run --enable-api --cors "*"

enable-api is optional but cors is required to allow secure data transfer and prevent you from getting Cross-Origin Resource Sharing error. The terminal will show the following output. For Windows users, you need to use double quotes to ensure that CORS registered correctly. api-server-img

Running ngrok

Android and iOS apps will requiere secure https connections. If you are testing locally we recommend you to use ngrok. You should copy the https address on host props.

./ngrok http 5005


Basic chat configuration

import React from 'react';
import {SafeAreaView, StatusBar, StyleSheet} from 'react-native';
import RNRasa from 'react-native-rasa';
// your rasa host, for example:
const HOST = 'http://localhost:5005';
const App = () => {
  return (
      <StatusBar barStyle="dark-content" />
      <SafeAreaView style={styles.container}>
          onSendMessFailed={(error) => console.log(error)}
          emptyResponseMessage="Sorry, I don't understand"
          onEmptyResponse={() => console.log('Handle with your custom action')}

export default StyleSheet.create({
  container: {
    flex: 1,

For a custom Chat setup, please check the App.tsx file.


  • host (string) - (Required) Your Rasa host, http://<host>:<port>/webhooks/rest/webhook, replacing the host and port with the appropriate values from your running Rasa X or Rasa Open Source server.

  • onSendMessFailed (Function) - (Optional) Callback when sending a message failed.

  • onEmptyResponse (Function) - (Optional) Callback when the bot return empty reponse (Sometimes it happens to Rasa Open Source).

  • emptyResponseMessage (String) - (Optional) The message the bot will return in case the reponse is empty.

  • userId (String) - (Optional) Sets the user Id..

  • userAvatar (String) - (Optional) Sets the user Avatar using an image uri.

  • userName (String) - (Optional) Sets the user name.

  • botName (String) - (Optional) Sets the bot name.

  • botAvatar (String) - (Optional) Sets the bot Avatar using an image uri.

  • You can also use all the props from react-native-gifted-chat


  • resetMessages (Function) - This clear all messages on the widget.
  • resetBot (Function) - It sends a reset intent to Rasa server (It will requiere a correct configuration on Rasa server to handle this intent. Check how to do that on the our sample code).
  • sendCustomMessage (Function) - It allows to send custom text messages to Rasa server.


TODO List:

  • [x] Reset bot on destroy
  • [x] Add restart bot options
  • [x] Add checkbox messages and quick replies
  • [x] Add bot avatar
  • [x] Add example
  • [x] Add Video reponses
  • [ ] Voice support
  • [ ] Allow that users attach files and images

PR are welcome ❤️


Package Sidebar


npm i react-native-rasa

Weekly Downloads






Unpacked Size

252 MB

Total Files


Last publish


  • hungvv193
  • luongvinh