Get bot responses and parse data from same endpoint

Hi, I’m using RASA as a secondary service, so no front-end chat connected directly. For my use case, I need to get both the bot’s response (from ‘rest’ endpoint) with all the CORE functionality, and also the parsed entities (from /parse). I mimic this by making a request to both endpoints, but this is not an optimal solution. I was thinking about using a custom endpoint by implementing InputChannel, but there is no way to get the parsed data from there, as far as I know. Maybe I’m missing something? Any help is appreciated.

Hi, What is your setup and what do you need the bot responses and parsed entities for? If you are sending messages to Rasa, you can retrieve both the bot response and the parsed entities from the tracker afterwards using the /conversations/{conversation_id}/tracker endpoint. Otherwise, can you let me know what your use case is then I’ll try to think of a solution.

Ok, I’ll try to explain my current setup. We send a request to ‘model/parse’ and other to ‘webhooks/rest/webhook’. Why is that? Because from the webhook I can get the bot responses, for example a response to a question like “How many points the user 123 from sector 345 generated?”, our bot’s domain sends some templates with a format like “The user PLACEHOLDER, from sector PLACEHOLDER, generated PLACEHOLDER points.” , an external service uses our extracted data (which in this case are basically user:123; sector:456; intent:getGeneratedPoints) to search a database for the real data, replace the entities user and sector in the placeholder (this part my be done from our side actually), and return the final response with the points data to the chat front-end. Our real domain uses a lot of entities that need to be parsed. I think this is not the way RASA was intended to be used, is there a better architecture for this use case?

Edit: The tracker looks like a solution to the multiple endpoints problem actually. Thank you! I still want to know what you think about this architecture.

Sounds like you might want to look into custom actions.

Instead of only returning the bot’s response (with an “utter_” action), actions can be customised to do anything you want. So in your case, when the question is asked “How many points the user 123 from sector 345 generated?”, that could trigger an action that also does the database search and fills the placeholders before sending back the bot response.