I’m facing issues with integrating Rasa bot with Web.
My objective is to send an API call to Bot and get back the reply. Very much similar to what @juste_petr did in her tutorial. But not on slack, rather on a local system. For example, I send a simple CURL request to the bot, and it returns the reply.
Current Status:
My bot is recieving the message sent through CURL command, but returns NULL value. I’ve implemented this, excluding the Slack parts. I guess the input part is working correctly but there is some issue with the output part. I can’t find any documentation regarding “HttpInputComponent” and “OutputChannel” in rasa core 0.8.2 docs.
This is the connector code:
class BotOutput(OutputChannel):
def send_text_message(self, message):
text = message
return(text)
class BotInput(HttpInputComponent):
def blueprint(self, on_new_message):
from flask import Flask, request, Response
bot_webhook = Blueprint('bot_webhook', __name__)
@bot_webhook.route('/', methods = ['GET'])
def health():
return jsonify({'status':'ok'})
@bot_webhook.route('/bot/events', methods = ['POST'])
def event():
data = request.get_json()
text = data['text']
on_new_message(UserMessage(text, BotOutput()))
return Response(), 200
return bot_webhook
And this is the Curl request I want to send :
curl -H "Content-Type: application/json" -X POST -d '{"text":"Hello"}' http://127.0.0.1:5004/bot/events
and get a reply.
Any help is appreciated.
p.s I know there is no code for security will add it later. First I want to implement the bot in web.
Hey Thanks for the help. But I guess this is for the latest version of Rasa Core. I’m Using 0.8.2. I’m afraid it doesn’t work for the previous version.
Hehe. I did. It raises error: unrecognized arguments: --enable_api. Anyways, I was going to move to the newer version anyway. Let me set up my bot in the newer version. Then I’ll try your method.
Hey! thanks. It’s working now.
I’ve got another issue, can you tell me why it’s happening?
My custom action is not executing. The name in domain and action.py is correct. I’ve cross checked.