Rest api implementation

@Saylee If you tried in postman can you put screenshot please.

i m sorry i did one mistake. i m edited my previous response. Please check it.

@athenasaurav Hey!! I was able to access it correctly! Thanks a ton! You are amazing! Just a small edit for the answer you gave, the bearer token generation is also a POST request and not GET. Also, for accessing the rest channel, I will have to add the link http://[IP]:80/webhooks/rest/webhook inside endpoints.yml as well, right?

Yes exactly. I was answering from my phone. So couldnt properly format and do it. Edited that too. No for accessing the link you have to just add

rest:

@athenasaurav Hi again! I tried accessing the http://[IP]:80/webhooks/rest/webhook URL.But it is giving me an error saying

Error: Requested URL /webhooks/rest/webhook not found

I had the ‘rest:’ added already. Below is the image

ret

Does the URL below rasa needs to be changed? Also its in my git repo which is connected with the rasa-x using integrated version control, will it be picked up automatically by the deployed bot? or will i have to re-deploy it?

hi @Saylee, yes the url is incorrect. you need to update it to following

rasa:
  url: ${RASA_X_HOST}/api

the url your using is for localhost not on GCP.

i m not sure it will pick up from git directly or not. probably not. Give it a try let the community know

Hi @JiteshGaikwad, I tried the same steps and it worked fine on postman. But now, I want to run it in python. It did as follows

image and am getting this error

image

Please suggest me a way out.

just send the data in this way:

data = json.dumps(data)

1 Like

Hi @RohanJauhari, You should try this First run this in command window:

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

Then in python code :

import requests

url = "http://localhost:5005/webhooks/rest/webhook"
payload = '{"message":"hi"}'
headers = {
  'Content-Type': 'application/json'
}
response = requests.post(url, headers=headers, data = payload.encode('utf-8'))
print("{}".format(response.json()[0]["text"]))
1 Like

Thanks a lot @JiteshGaikwad and @athenasaurav. It worked fine. Now, I want to run rasa server on my computer and want to access it from another computer. I looked up here: Configuring the HTTP API but couldn’t figure out the right steps. Could you please help?

Hi @RohanJauhari. You can use ngrok.

1 Like

is this possible to pass intent name instead of action name in js file??

when adding buttons with welcome message in bot, buttons functionality is not working. please help

Hello @esub,

You can use utter greet with button payload like this :

templates:
  utter_greet:
  - text: "Hey! How can I help you?"
    buttons:
    - title: "What can you do?"
      payload: '/bot_functions' 

Thank you @athenasaurav. I have another question is this possible to add icons inside the buttons. if possible please help me how?

Hello @esub, can you elaborate the issue. Do you mean to add the emoticon? If yes you can use Unicode characters for the emoticon or emoji or icon, whatever you say. You can google to get unicode character of any icon.

Thank you @athenasaurav it worked.

Hi @JiteshGaikwad am looking into chatbot widget. can u please tell me is this possible to make part of text bold and adding color for that text??

Not sure what’s the thought process here - the webhook API is the API that one needs from a chatbot - send a message to bot and get the bot’s response.

It’s a pity that it takes an hour of digging and googling to find a a single short paragraph on this arguably main API buried deep in Rasa docs. And it doesn’t even contain a full specification of request and full specification of possible responses.

can we secure the Rest using any authentication in Rasa X

Hi @sheggam_harshith yes we can secure using bearerAuth.