I’m experimenting with the CallbackInput channel as described in Your Own Website.
I have a question about the general behavior of Callbacks in Rasa. My expectation was that rasa will return the “success” message when it successfully receives a properly formatted message with all required fields to the callback endpoint ‘webhooks/callback/webhook’, without waiting for the messaged to be successfully parsed and a reply formulated by nlu+core.
However, a simple test shows me that not only rasa would process the message but attempt to deliver the reply to the designated callback endpoint before sending the “success” message to the original caller.
i.e. if there are delays in either processing or delivering the message to the callback endpoint, the original REST call to ‘webhooks/callback/webhook’ will be blocking.
test: Create a dummy flask ‘print’ endpoint for receiving callbacks.
@app.route("/print", methods=["POST"])
def echo():
try:
data = request.json
print(f"received {data}")
sleep(10) # dummy wait for 10 secs
return jsonify("Got it!")
except Exception as e:
print("Error!", e)
return jsonify("error")
Add the callback url in the credentials file:
callback:
# URL to which Core will send the bot responses
url: "http://localhost:5000/print"
When I call ‘http://localhost:5005/webhooks/callback/webhook’ with the message, it waits for 10s to return “success” indicating that the call is not async.
Is this desired behavior, and why?
Thanks,