How to Chat with HTTP API

So I just started a server with rasa run. I want to mimic behavior just like in Rasa Shell. However, reading through the Rasa HTTP API, it seems that I must:

  1. Add a message to a tracker Add Conversation Message
  2. From that message, add the intent Trigger Conversation Intent

However, having these two API calls seems like it is unnecessarily increasing our latency by a lot. Is there a smoother way of interacting with the HTTP API?

As a reference, here is my code:

conversation_id = input("Conversation ID: ")
url = f"my-server:5005/conversations/{conversation_id}/"
messages_url = url + "messages"
intents_url = url + "trigger_intent"

while True:
    message = input("Input: ") 
    payload = {
                "text": message,
                "sender": "user",
    messages_response =, json=payload)
    messages_data = json.loads(messages_response.text)
    intent_name = messages_data['latest_message']['intent']['name']

    payload = {
               'name': intent_name,
    intents_response =, json=payload)
    intents_data = json.loads(intents_response.text)
    print (intents_data["messages"][0]["text"])

Also, how do you delete a conversation (and free up a conversation_id and the memory)?

Thank you.

Hi, I think this design force you two good practices. First, better to have Rasa API behind a public API, so that API will be responsible to expose a simplified API to the world reducing latency. You get secure and simple with this pattern. Second, it is possible to manage multiple inputs (add message) before trigger the intent. It sound more natural to wait until the user stop sending messages, and then responde. The model will have complete idea to predict next better action. Your backend can set a timeout after the last message to trigger the intent.

About your second question, clean conversation events? good one, don’t know yet. Maybe that public API could passthru last 10 events, keeping the JSON in a maximun size.

Regards. AG