Here is the function in my django project calling the rasa api.
def connect(chatbot, text):
url = chatbot.rasa_url + "/webhooks/rest/webhook"
payload = '{"message":"' + text + '"}'
headers = {
'Content-Type': 'application/json'
}
response = requests.post(url, headers=headers, data=payload.encode('utf-8'))
return response.json()[0]["text"]
My actions are way too long so I won’t post them here. But they are running without any error so this is not a cause of the problem. The question is how to use your OpenAPI specification provided on this site to create the required endpoint for the custom action server. As I have mentioned above, I used the tool openapi-generator-cli
to generate the code out of the specification, but it led to an error.
So I have added a webhook in my project where I want to run the rasa custom actions. It looks like this:
@api.post("/webhook", summary="Rasa Action Server Webhook", tags=["rasa action server"])
def api_rasa_action_server_webhook(request):
Using the tunnel I am able to send and receive data from one project. After running the connect
function above the following data is received in api_rasa_action_server_webhook
when I print it :
{'next_action': 'action_define_event', 'sender_id': 'default', 'tracker': {'sender_id': 'default', 'slots': {'session_event': 'authentification', 'limit': None, 'valid_limit': True, 'valid_auth': False, 'auth_number': None, 'pin': None, 'requested_slot': None, 'session_started_metadata': None}, 'latest_message': {'intent': {'id': -2144904814263520682, 'name': 'event_provider', 'confidence': 0.9992228746414185}, 'entities': [{'entity': 'session_event', 'start': 0, 'end': 16, 'confidence_entity': 0.9971386194229126, 'value': 'authentification', 'extractor': 'DIETClassifi
…
So I need to either use your OpenAPI specification or manually parse the request. I hope, it has clarified my intention