# Rest api implementation

**URL:** https://forum.rasa.com/t/rest-api-implementation/12624
**Category:** Rasa Open Source
**Created:** [July 8, 2019, 1:15pm UTC](https://forum.rasa.com/t/rest-api-implementation/12624 "2019-07-08T13:15:15Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![chinnusujitha](https://avatars.discourse-cdn.com/v4/letter/c/96bed5/32.png) [@chinnusujitha](https://forum.rasa.com/u/chinnusujitha)
#### Post date: [July 8, 2019, 1:15pm UTC](https://forum.rasa.com/t/rest-api-implementation/12624/1 "2019-07-08T13:15:15Z")

</div>

Hi All, I worked with Rasa long back and now all the docs had changed. I tried to implement the Rest api(post api) for accessing the chat bot through my website. For this i want to write the custom channel. Can anyone help me on doing this like any good tutorial or documentation.

---

<div class="post-metadata">

### Author: ![shreyask92](https://avatars.discourse-cdn.com/v4/letter/s/f05b48/32.png) [@shreyask92](https://forum.rasa.com/u/shreyask92)
#### Post date: [July 8, 2019, 2:10pm UTC](https://forum.rasa.com/t/rest-api-implementation/12624/2 "2019-07-08T14:10:21Z")

</div>

Hi @chinnusujitha,

I am trying to do the same. I found a bunch of articles using different techniques, but havent yet found the right soultion. I will let you know if I succeed in doing so.

---

<div class="post-metadata">

### Author: ![JiteshGaikwad](https://avatars.discourse-cdn.com/v4/letter/j/77aa72/32.png) [@JiteshGaikwad](https://forum.rasa.com/u/JiteshGaikwad)
#### Post date: [July 8, 2019, 3:10pm UTC](https://forum.rasa.com/t/rest-api-implementation/12624/3 "2019-07-08T15:10:36Z")

</div>

Hey @chinnusujitha, just follow the below steps to connect your bot to custom channel using REST api,

Step1: you need to ensure your `credentials.yml` has the following content:

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/rasa/original/2X/7/76dc4a48e6edc9edc9e3ae1351bbfd59b755465b.png)

Step2: Once you have trained your bot, you can start your bot server by running the below command

> rasa run -m models --enable-api --cors “\*” --debug

Once you run this command, you can see the below output in the terminal ![image](https://europe1.discourse-cdn.com/flex013/uploads/rasa/original/2X/6/61846b2545fb3f0335535469256c37cdd388bb0d.png)

Step3: Once your server is up and running you can access your bot throught REST api, given below:

> [http://localhost:5005/webhooks/rest/webhook](http://localhost:5005/webhooks/rest/webhook)

Step4: Now you can test the api:

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/rasa/original/2X/f/f73e7831628e284858b341f9e496bf8d4edc3761.png)

You can try out my custom UI : [https://github.com/JiteshGaikwad/Rasa\_CustomUI-v\_2.0](https://github.com/JiteshGaikwad/Rasa_CustomUI-v_2.0)

I hope this will help you 🙂

---

<div class="post-metadata">

### Author: ![EvanD](https://avatars.discourse-cdn.com/v4/letter/e/22d042/32.png) [@EvanD](https://forum.rasa.com/u/EvanD)
#### Post date: [July 9, 2019, 9:00am UTC](https://forum.rasa.com/t/rest-api-implementation/12624/4 "2019-07-09T09:00:54Z")

</div>

Hi @JiteshGaikwad

Is it normal that the Two Stage Fallback Policy doesn’t work when using the rest api ? It works when I’m using websocket.

Thank you

---

<div class="post-metadata">

### Author: ![JiteshGaikwad](https://avatars.discourse-cdn.com/v4/letter/j/77aa72/32.png) [@JiteshGaikwad](https://forum.rasa.com/u/JiteshGaikwad)
#### Post date: [July 9, 2019, 10:22am UTC](https://forum.rasa.com/t/rest-api-implementation/12624/5 "2019-07-09T10:22:28Z")

</div>

No, it should work

---

<div class="post-metadata">

### Author: ![EvanD](https://avatars.discourse-cdn.com/v4/letter/e/22d042/32.png) [@EvanD](https://forum.rasa.com/u/EvanD)
#### Post date: [July 9, 2019, 10:37am UTC](https://forum.rasa.com/t/rest-api-implementation/12624/6 "2019-07-09T10:37:38Z")

</div>

Okay, actually the problem is bigger than I thought:

Each time I have a question with buttons, clicking on button doesn’t execute the intent it should but the fallback policy.

When I’m trying to send http request manually I get the same problem, do you have any clue what could be the problem ?

Would you otherwise maybe have a working example so I can try to debug ?

Thank you in advance

---

<div class="post-metadata">

### Author: ![JiteshGaikwad](https://avatars.discourse-cdn.com/v4/letter/j/77aa72/32.png) [@JiteshGaikwad](https://forum.rasa.com/u/JiteshGaikwad)
#### Post date: [July 9, 2019, 11:10am UTC](https://forum.rasa.com/t/rest-api-implementation/12624/7 "2019-07-09T11:10:19Z")

</div>

hey @EvanD, I think so the problem lies in payload of buttons, make sure whenever you click the buttons, the payload is getting triggered properly?

---

<div class="post-metadata">

### Author: ![EvanD](https://avatars.discourse-cdn.com/v4/letter/e/22d042/32.png) [@EvanD](https://forum.rasa.com/u/EvanD)
#### Post date: [July 9, 2019, 2:47pm UTC](https://forum.rasa.com/t/rest-api-implementation/12624/8 "2019-07-09T14:47:48Z")

</div>

Well, I’ve tried to change the format of the payload in the domain file but in vain.

I’m not sure what you mean by triggered properly, but I’d say yes.

For example, I have an intent called **UploadTracksFTP** and a button which has for title “ **More than 1000** ” with its payload **/UploadTracksFTP**

When I click on it, it sends as request payload :

```auto
{"message":"More than 1000","sender":"username"}

```

And I receive an empty list as response payload.

Would you have any further explanation ?

Thank you for your time

---

<div class="post-metadata">

### Author: ![EvanD](https://avatars.discourse-cdn.com/v4/letter/e/22d042/32.png) [@EvanD](https://forum.rasa.com/u/EvanD)
#### Post date: [July 9, 2019, 2:57pm UTC](https://forum.rasa.com/t/rest-api-implementation/12624/9 "2019-07-09T14:57:02Z")

</div>

Well actually I realize the request payload message should be the name of the intent “/UploadTracksFTP” and not the title of the button. Though I don’t get why there’s such an error, is that linked to a rasa update or something ?

Anyway I’m now be able to do what I want, thank you for your help

---

<div class="post-metadata">

### Author: ![JiteshGaikwad](https://avatars.discourse-cdn.com/v4/letter/j/77aa72/32.png) [@JiteshGaikwad](https://forum.rasa.com/u/JiteshGaikwad)
#### Post date: [July 9, 2019, 3:24pm UTC](https://forum.rasa.com/t/rest-api-implementation/12624/10 "2019-07-09T15:24:27Z")

</div>

hey @EvanD, I am glad it worked out & it’s not related to update of the rasa, it was due to the message that you were sending through payload. 🙂

---

<div class="post-metadata">

### Author: ![JiteshGaikwad](https://avatars.discourse-cdn.com/v4/letter/j/77aa72/32.png) [@JiteshGaikwad](https://forum.rasa.com/u/JiteshGaikwad)
#### Post date: [July 9, 2019, 3:27pm UTC](https://forum.rasa.com/t/rest-api-implementation/12624/11 "2019-07-09T15:27:41Z")

</div>

Actually I was referring to the payload as described here:

> **[Domain](https://rasa.com/docs/rasa/domain/)**
>
> An open source machine learning framework for automated text and voice-based conversations

Sorry that I didn’t mentioned about it clearly previously.😌

---

<div class="post-metadata">

### Author: ![chinnusujitha](https://avatars.discourse-cdn.com/v4/letter/c/96bed5/32.png) [@chinnusujitha](https://forum.rasa.com/u/chinnusujitha)
#### Post date: [July 11, 2019, 6:16am UTC](https://forum.rasa.com/t/rest-api-implementation/12624/12 "2019-07-11T06:16:38Z")

</div>

Hi @shreyask92,

Thanks for the reply. I would thankful if you share me the solution once you succeed.

---

<div class="post-metadata">

### Author: ![chinnusujitha](https://avatars.discourse-cdn.com/v4/letter/c/96bed5/32.png) [@chinnusujitha](https://forum.rasa.com/u/chinnusujitha)
#### Post date: [July 11, 2019, 12:32pm UTC](https://forum.rasa.com/t/rest-api-implementation/12624/13 "2019-07-11T12:32:19Z")

</div>

Hi @JiteshGaikwad,

Thanks for the reply.Yes it is helpful for me.

I ran the nlu model using:

> python3 -m rasa train nlu -c config.yml --fixed-model-name current -u data/data2Insights.json --out models -v -vv

And core model using:

> python3 -m rasa train core -d domain.yml -s stories.md --debug --out models/dialogue -v

Then i ran the bot using this command:

> rasa run -m models --enable-api --cors “\*” --debug

Then i got an warning:

> 2019-07-11 12:58:23 WARNING rasa.core.interpreter - No local NLU model ‘/tmp/tmp26x19\_ee/nlu’ found. Using RegexInterpreter instead.

By bot behaved weirdly means - If i say hi to it it is saying bye. Can you please help me on this.

And also if i want to run with different host other than localhost and different port number not an default one(5005), where i need to give those credentials?

---

<div class="post-metadata">

### Author: ![JiteshGaikwad](https://avatars.discourse-cdn.com/v4/letter/j/77aa72/32.png) [@JiteshGaikwad](https://forum.rasa.com/u/JiteshGaikwad)
#### Post date: [July 11, 2019, 1:06pm UTC](https://forum.rasa.com/t/rest-api-implementation/12624/14 "2019-07-11T13:06:46Z")

</div>

> [@chinnusujitha](#):
>
> 2019-07-11 12:58:23 WARNING rasa.core.interpreter - No local NLU model ‘/tmp/tmp26x19\_ee/nlu’ found. Using RegexInterpreter instead.

You are facing the above warning because there was no nlu model found. make sure you have models tar file in the models folder.

if you want to change the default port of the rasa server you can pass the port number to the -p argument

> rasa run -m models --enable-api --cors “\*” --debug -p 5004

---

<div class="post-metadata">

### Author: ![chinnusujitha](https://avatars.discourse-cdn.com/v4/letter/c/96bed5/32.png) [@chinnusujitha](https://forum.rasa.com/u/chinnusujitha)
#### Post date: [July 12, 2019, 6:42am UTC](https://forum.rasa.com/t/rest-api-implementation/12624/15 "2019-07-12T06:42:10Z")

</div>

Hi @JiteshGaikwad, I have my nlu model in models folder only. Please see this screenshot.

![image](https://europe1.discourse-cdn.com/flex013/uploads/rasa/original/2X/e/e1ab1fded780c07f3237bf3b425909c9415f4cb4.png)

And if i want to change the localhost to some ip address then where i need to change it?

I want something like this:

> http://:5005/webhooks

After webook i dont need again rest/webhook.

Thanks in Advance.

---

<div class="post-metadata">

### Author: ![shreyask92](https://avatars.discourse-cdn.com/v4/letter/s/f05b48/32.png) [@shreyask92](https://forum.rasa.com/u/shreyask92)
#### Post date: [July 12, 2019, 2:50pm UTC](https://forum.rasa.com/t/rest-api-implementation/12624/16 "2019-07-12T14:50:25Z")

</div>

Hi @chinnusujitha,

When you are running the bot you specify the location of the model using “-m models”, and since you trained only rasa core, your latest model does not contain an nlu model. Instead use “rasa train --force \<optional\_parm\>”, this would create the latest version of both core and nlu in one single tar.gz file, and you will not see this error again when you run your bot.

---

<div class="post-metadata">

### Author: ![chinnusujitha](https://avatars.discourse-cdn.com/v4/letter/c/96bed5/32.png) [@chinnusujitha](https://forum.rasa.com/u/chinnusujitha)
#### Post date: [July 15, 2019, 7:17am UTC](https://forum.rasa.com/t/rest-api-implementation/12624/17 "2019-07-15T07:17:10Z")

</div>

Hi @shreyask92, Thank You, That worked for me but if i have nlu model and core model in separate zip files(as shown in my above screen shot), how should i have to tell that to rasa run?

---

<div class="post-metadata">

### Author: ![chinnusujitha](https://avatars.discourse-cdn.com/v4/letter/c/96bed5/32.png) [@chinnusujitha](https://forum.rasa.com/u/chinnusujitha)
#### Post date: [July 17, 2019, 10:32am UTC](https://forum.rasa.com/t/rest-api-implementation/12624/18 "2019-07-17T10:32:59Z")

</div>

Hi All,

```
     Can anyone help me on this..
```

---

<div class="post-metadata">

### Author: ![erohmensing](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/erohmensing/32/1789_2.png) [@erohmensing](https://forum.rasa.com/u/erohmensing)
#### Post date: [July 19, 2019, 9:36pm UTC](https://forum.rasa.com/t/rest-api-implementation/12624/19 "2019-07-19T21:36:30Z")

</div>

@chinnusujitha the easiest way would be to manually unzip the files, move all the files in one to the other, and re-zip. (then remove the `core-`). At the moment, I don’t believe there is a way to pull separate core and nlu models – this was the point of merging the `train` method, to make combined core and nlu models out of the box (ofc you can still also use nlu-only or core-only)

The train method will only re-train whichever parts have been modified, so nlu will not retrain if you just add stories – therefore there’s really no downside to creating combined models if you’re using core and nlu.

---

<div class="post-metadata">

### Author: ![tonysinghmss](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/tonysinghmss/32/5846_2.png) [@tonysinghmss](https://forum.rasa.com/u/tonysinghmss)
#### Post date: [August 5, 2019, 12:25pm UTC](https://forum.rasa.com/t/rest-api-implementation/12624/20 "2019-08-05T12:25:10Z")

</div>

> [@JiteshGaikwad](#):
>
> [http://localhost:5005/webhooks/rest/webhook](http://localhost:5005/webhooks/rest/webhook)

Is this API documentation given in rasa docs? I couldn’t find it…

[Next page](https://forum.rasa.com/t/rest-api-implementation/12624.md?page=2)
