# Rasa core integration with chatwidget

**URL:** <https://forum.rasa.com/t/rasa-core-integration-with-chatwidget/8830>\
**Category:** Rasa Open Source\
**Created:** [April 22, 2019, 6:51am UTC](https://forum.rasa.com/t/rasa-core-integration-with-chatwidget/8830 "2019-04-22T06:51:57Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![prashant\_kamble](https://avatars.discourse-cdn.com/v4/letter/p/df705f/32.png) [@prashant\_kamble](https://forum.rasa.com/u/prashant_kamble)\
**Post date:** [April 22, 2019, 6:51am UTC](https://forum.rasa.com/t/rasa-core-integration-with-chatwidget/8830/1 "2019-04-22T06:51:57Z")

</div>

I have successfully integrated my rasa core chatbot with chatwidget (mrbot-ai/rasa-webchat) using socketio channel.

Below are two commands that I used for:

1. To start rasa core server with endpoints and credentials file.

`python -m rasa_core.run -d models/dialogue -u models/nlu/current --endpoints endpoints.yml --credentials credentials.yml`

1. To start custom action server.

`python -m rasa_core_sdk.endpoint --actions actions`

1. You need to just change port and machine’s ip in a script i.e provided on github i.e [GitHub - mrbot-ai/rasa-webchat: A chat widget easy to connect to chatbot platforms such as Rasa Core](https://github.com/mrbot-ai/rasa-webchat)

Note: Make sure that your rasa core server and custom action server is up and running before just clicking or opening html file of your website.

If you have any issues related to chatwidget integration please let me know.

---

<div class="post-metadata">

**Author:** ![cyanamous](https://avatars.discourse-cdn.com/v4/letter/c/8491ac/32.png) [@cyanamous](https://forum.rasa.com/u/cyanamous)\
**Post date:** [July 10, 2019, 11:16am UTC](https://forum.rasa.com/t/rasa-core-integration-with-chatwidget/8830/2 "2019-07-10T11:16:59Z")

</div>

Hey Please help in the integration in the latest Rasa 1.0

---

<div class="post-metadata">

**Author:** ![prashant\_kamble](https://avatars.discourse-cdn.com/v4/letter/p/df705f/32.png) [@prashant\_kamble](https://forum.rasa.com/u/prashant_kamble)\
**Post date:** [July 10, 2019, 11:18am UTC](https://forum.rasa.com/t/rasa-core-integration-with-chatwidget/8830/3 "2019-07-10T11:18:21Z")

</div>

Hi Aditya,

Can you show me what you are upto. what widget you are using ?

---

<div class="post-metadata">

**Author:** ![cyanamous](https://avatars.discourse-cdn.com/v4/letter/c/8491ac/32.png) [@cyanamous](https://forum.rasa.com/u/cyanamous)\
**Post date:** [July 10, 2019, 11:28am UTC](https://forum.rasa.com/t/rasa-core-integration-with-chatwidget/8830/4 "2019-07-10T11:28:08Z")

</div>

I’m using [GitHub - mrbot-ai/rasa-webchat: A chat widget easy to connect to chatbot platforms such as Rasa Core](https://github.com/mrbot-ai/rasa-webchat) and implementing in react. So i used following code for widget.

`import { Widget } from 'rasa-webchat';`

```
function CustomWidget = () => {
  return (
    <Widget
      interval={2000}
      initPayload={"/get_started"}
      socketUrl={"http://localhost:5500"}
      socketPath={"/socket.io/"}
      customData: {{"userId": "123"}}, // arbitrary custom data. Stay minimal as this will be added to the socket
      title={"Title"}
      inputTextFieldHint={"Type a message..."}
      connectingText={"Waiting for server..."}
      hideWhenNotConnected
      embedded={true}
      openLauncherImage="myCustomOpenImage.png"
      closeLauncherImage="myCustomCloseImage.png"
      params={{
        images: {
          dims: {
            width: 300,
            height: 200
          }
        },
        storage: "local"
      }}
    />
  )
}

```

And from this([Your Own Website](https://rasa.com/docs/rasa/user-guide/connectors/your-own-website/)) reference added websocket channel.

---

<div class="post-metadata">

**Author:** ![cyanamous](https://avatars.discourse-cdn.com/v4/letter/c/8491ac/32.png) [@cyanamous](https://forum.rasa.com/u/cyanamous)\
**Post date:** [July 10, 2019, 11:28am UTC](https://forum.rasa.com/t/rasa-core-integration-with-chatwidget/8830/5 "2019-07-10T11:28:46Z")

</div>

And thanks alot for such a prompt reply

---

<div class="post-metadata">

**Author:** ![prashant\_kamble](https://avatars.discourse-cdn.com/v4/letter/p/df705f/32.png) [@prashant\_kamble](https://forum.rasa.com/u/prashant_kamble)\
**Post date:** [July 10, 2019, 12:01pm UTC](https://forum.rasa.com/t/rasa-core-integration-with-chatwidget/8830/6 "2019-07-10T12:01:14Z")

</div>

Yeah Aditya. let me look into that what you have did.

---

<div class="post-metadata">

**Author:** ![prashant\_kamble](https://avatars.discourse-cdn.com/v4/letter/p/df705f/32.png) [@prashant\_kamble](https://forum.rasa.com/u/prashant_kamble)\
**Post date:** [July 10, 2019, 12:05pm UTC](https://forum.rasa.com/t/rasa-core-integration-with-chatwidget/8830/7 "2019-07-10T12:05:14Z")

</div>

Hi Aditya,

Your chatwidget script should as per below format :

```
<div id="webchat"/>
<script src="https://storage.googleapis.com/mrbot-cdn/webchat-0.5.8.js"></script>
<script>
  WebChat.default.init({
    selector: "#webchat",
    initPayload: "/get_started",
    interval: 1000, // 1000 ms between each message
    customData: {"userId": "123"}, // arbitrary custom data. Stay minimal as this will be added to the socket
    socketUrl: "http://localhost:5500",
    socketPath: "/socket.io/",
    title: "Title",
    subtitle: "Subtitle",
    inputTextFieldHint: "Type a message...",
    connectingText: "Waiting for server...",
    hideWhenNotConnected: true,
    fullScreenMode: false,
    profileAvatar: "http://to.avat.ar",
    openLauncherImage: 'myCustomOpenImage.png',
    closeLauncherImage: 'myCustomCloseImage.png',
    params: {
      images: {
        dims: {
          width: 300,
          height: 200,
        }
      },
      storage: "local"
    }
  })
</script>

```

Just confirm this all changes you have in your script. let me know it solves or not.

Note :

And one more thing in socketUrl attribute you have to replace it with your rasa core server port number i.e for e.g [http://localhost:5005](http://localhost:5005) .

By default it uses port 5005.

---

<div class="post-metadata">

**Author:** ![cyanamous](https://avatars.discourse-cdn.com/v4/letter/c/8491ac/32.png) [@cyanamous](https://forum.rasa.com/u/cyanamous)\
**Post date:** [July 10, 2019, 12:14pm UTC](https://forum.rasa.com/t/rasa-core-integration-with-chatwidget/8830/8 "2019-07-10T12:14:59Z")

</div>

Thanks alot. I did not changed the socket url. Thanks

---

<div class="post-metadata">

**Author:** ![prashant\_kamble](https://avatars.discourse-cdn.com/v4/letter/p/df705f/32.png) [@prashant\_kamble](https://forum.rasa.com/u/prashant_kamble)\
**Post date:** [July 10, 2019, 12:20pm UTC](https://forum.rasa.com/t/rasa-core-integration-with-chatwidget/8830/9 "2019-07-10T12:20:09Z")

</div>

Yup 😊. your are very welcome.

---

<div class="post-metadata">

**Author:** ![cyanamous](https://avatars.discourse-cdn.com/v4/letter/c/8491ac/32.png) [@cyanamous](https://forum.rasa.com/u/cyanamous)\
**Post date:** [July 10, 2019, 12:31pm UTC](https://forum.rasa.com/t/rasa-core-integration-with-chatwidget/8830/10 "2019-07-10T12:31:36Z")

</div>

Hey did you try changing the UI of the webchat any way to do that

---

<div class="post-metadata">

**Author:** ![prashant\_kamble](https://avatars.discourse-cdn.com/v4/letter/p/df705f/32.png) [@prashant\_kamble](https://forum.rasa.com/u/prashant_kamble)\
**Post date:** [July 10, 2019, 12:36pm UTC](https://forum.rasa.com/t/rasa-core-integration-with-chatwidget/8830/11 "2019-07-10T12:36:36Z")

</div>

yeah Aditya. Yes.

We can use inbuilt rest api. We just need to make ajax request for that rest api with user message and bot will give us reponse. Afte that it depends on us that, how complex or attractive ui we can make and how we render bot responses.

---

<div class="post-metadata">

**Author:** ![cyanamous](https://avatars.discourse-cdn.com/v4/letter/c/8491ac/32.png) [@cyanamous](https://forum.rasa.com/u/cyanamous)\
**Post date:** [July 10, 2019, 2:56pm UTC](https://forum.rasa.com/t/rasa-core-integration-with-chatwidget/8830/12 "2019-07-10T14:56:06Z")

</div>

Like adding more custom components and extending the code did your tried it

---

<div class="post-metadata">

**Author:** ![prashant\_kamble](https://avatars.discourse-cdn.com/v4/letter/p/df705f/32.png) [@prashant\_kamble](https://forum.rasa.com/u/prashant_kamble)\
**Post date:** [July 11, 2019, 4:13am UTC](https://forum.rasa.com/t/rasa-core-integration-with-chatwidget/8830/13 "2019-07-11T04:13:16Z")

</div>

Hi @cyanamous,

You mean adding custom actions?

---

<div class="post-metadata">

**Author:** ![ravikrcs](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/ravikrcs/32/10301_2.png) [@ravikrcs](https://forum.rasa.com/u/ravikrcs)\
**Post date:** [July 25, 2019, 9:34am UTC](https://forum.rasa.com/t/rasa-core-integration-with-chatwidget/8830/14 "2019-07-25T09:34:13Z")

</div>

Hi, i created the Bot. Now, i want to integrate with chatwidget using socketio channel. The above discussion i am not understand clearly. Can you guide me step-wise please.

---

<div class="post-metadata">

**Author:** ![cyanamous](https://avatars.discourse-cdn.com/v4/letter/c/8491ac/32.png) [@cyanamous](https://forum.rasa.com/u/cyanamous)\
**Post date:** [July 28, 2019, 8:08am UTC](https://forum.rasa.com/t/rasa-core-integration-with-chatwidget/8830/16 "2019-07-28T08:08:34Z")

</div>

> **[GitHub - botfront/rasa-webchat: A feature-rich chat widget for Rasa and Botfront](https://github.com/botfront/rasa-webchat)**
>
> A feature-rich chat widget for Rasa and Botfront. Contribute to botfront/rasa-webchat development by creating an account on GitHub.

Use a above repo. Make sure you have node and npm installed. and then create a new react app using the below command

```auto
npx create-react-app react-ui

```

Now cd into the react-ui and run

```auto
npm install

```

Navigate into the App.js file in src

```
import React from 'react';
import './App.css';
import { Widget } from 'rasa-webchat';

function App() {
  return (
    <div className="App" >
      <p>React UI</p>
      <Widget
      interval={2000}
      initPayload={"/get_started"}
      socketUrl={"http://localhost:5005"}
      socketPath={"/socket.io/"}
      customData= {{"userId": "123"}} // arbitrary custom data. Stay minimal as this will be added to the socket
      title={"Rasa UI"}
      inputTextFieldHint={"Type a message..."}
      connectingText={"Waiting for server..."}
      hideWhenNotConnected
      embedded={false}
      openLauncherImage="myCustomOpenImage.png"
      closeLauncherImage="myCustomCloseImage.png"
      params={{
        images: {
          dims: {
            width: 300,
            height: 200
          }
        },
        storage: "local"
      }}
    />
    </div>
  );
}

export default App;

```

Ans then add Web socket channel as mentioned here

> **[Your Own Website](https://rasa.com/docs/rasa/connectors/your-own-website/)**
>
> Deploy and Run a Rasa Chat Bot on a Website

Then run npm start in react-ui folder and rasa run in rasa folder. Optionally can run rasa run actions too.

---

<div class="post-metadata">

**Author:** ![prashant\_kamble](https://avatars.discourse-cdn.com/v4/letter/p/df705f/32.png) [@prashant\_kamble](https://forum.rasa.com/u/prashant_kamble)\
**Post date:** [July 29, 2019, 3:49am UTC](https://forum.rasa.com/t/rasa-core-integration-with-chatwidget/8830/17 "2019-07-29T03:49:10Z")

</div>

Hi @ravikrcs,

Is your issue solved ??

---

<div class="post-metadata">

**Author:** ![Spike](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/spike/32/4563_2.png) [@Spike](https://forum.rasa.com/u/Spike)\
**Post date:** [August 16, 2019, 3:38am UTC](https://forum.rasa.com/t/rasa-core-integration-with-chatwidget/8830/18 "2019-08-16T03:38:18Z")

</div>

Hi @cyanamous, I followed the step but I got this error after I run rasa run command:

`engineio.server - http://localhost:3000 is not an accepted origin.`

Can you help me? Thanks!

---

<div class="post-metadata">

**Author:** ![prashant\_kamble](https://avatars.discourse-cdn.com/v4/letter/p/df705f/32.png) [@prashant\_kamble](https://forum.rasa.com/u/prashant_kamble)\
**Post date:** [August 16, 2019, 5:30am UTC](https://forum.rasa.com/t/rasa-core-integration-with-chatwidget/8830/19 "2019-08-16T05:30:10Z")

</div>

Hi Yunbin,

Can just change the port 3000 to 5000 and try it.

---

<div class="post-metadata">

**Author:** ![Spike](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/spike/32/4563_2.png) [@Spike](https://forum.rasa.com/u/Spike)\
**Post date:** [August 16, 2019, 6:26am UTC](https://forum.rasa.com/t/rasa-core-integration-with-chatwidget/8830/20 "2019-08-16T06:26:53Z")

</div>

Hi @prashant_kamble I use `npm start -- --port 5000` but that didn’t work.

And may I know specifically how did you make use of this? [GitHub - mrbot-ai/rasa-webchat: A chat widget easy to connect to chatbot platforms such as Rasa Core](https://github.com/mrbot-ai/rasa-webchat) Because I am a beginner and just trained my first bot by following the tutorial. Now I want to find a way to ensure that I can integrate with UI before I proceed to further train the bot and develop other elements of my website. Thank you.

---

<div class="post-metadata">

**Author:** ![prashant\_kamble](https://avatars.discourse-cdn.com/v4/letter/p/df705f/32.png) [@prashant\_kamble](https://forum.rasa.com/u/prashant_kamble)\
**Post date:** [August 16, 2019, 7:50am UTC](https://forum.rasa.com/t/rasa-core-integration-with-chatwidget/8830/21 "2019-08-16T07:50:20Z")

</div>

yup 😊

[Next page](https://forum.rasa.com/t/rasa-core-integration-with-chatwidget/8830.md?page=2)
