Rasa template response via custom action server generating empty response

I am referring to the following article from Rasa for generating a template-based response from my custom action server. The details are in the section titled “Calling Responses from Custom Actions”.

Link to the article - https://rasa.com/docs/rasa/responses/

Following is my domain.yml file

version: '3.0'
session_config:
  session_expiration_time: 60
  carry_over_slots_to_new_session: true
intents:
- greet
- create_OPEX

responses:
  utter_greet:
  - text: |
      Hello! How can I help you?
  - text: |
      Hi!

actions:
- action_create_OPEX_Sheet

And my stories.yml looks something like this:

stories:
 - story: greet and create_OPEX
   steps:
   - intent: greet
   - action: utter_greet
   - intent: create_OPEX
   - action: action_create_OPEX_Sheet

The “action_create_OPEX_Sheet” action sends a REST call to my custom action server (Java Spring Boot), which returns the response in the following format:

{
    "responses": [
        {
            "template": "utter_greet"
        }
    ],
    "events": []
}

This format is the same as provided in the article above, my problem is that despite my server sending a template response back, Rasa doesn’t send or generate any response based on that. It returns an empty response to the chatbot.

However, when I modify my custom action server to return a text-based response, it does work fine. In that case, it’ll return whatever text I send from my custom action server. But, I want template-based responses to work.

The text-based response being sent from the custom action server:

{
    "responses": [
        {
            "text": "sample response from custom action server"
        }
    ],
    "events": []
}

Can you please let me know what am I doing wrong in this? Any help would be appreciated, thanks.

Version Details:

Rasa Version: 3.5.5 Minimum Compatible Version: 3.5.0 Rasa SDK Version: 3.5.1 Python Version: 3.10.11 Operating System: Windows-10-10.0.22621-SP0 Python Path: C:\Users\amann\AppData\Local\Programs\Python\Python310\python.exe

Hi @aman-nankani

You have rasa action server and from there you are calling your Java application. Correct?

To display the output from Rasa action server, You could try something like this

class ActionGreetUser(Action):
    def name(self) -> Text:
        return "action_greet_user"

    async def run(
        self,
        dispatcher: CollectingDispatcher,
        tracker: Tracker,
        domain: Dict[Text, Any],
    ) -> List[EventType]:
         CALL_YOUR_JAVA_APPLICATION_HERE
        dispatcher.utter_message(text = "JAVA_OUTPUT")

        return []

You can take more help following this link: Rasa action server Dispatcher

@anoopshrma - No no, I am using my Java Application as a “custom action server”.

Rasa themselves do not provide Custom Action Server in Java. May I know which page/github/article you are using to create your custom action server?

@anoopshrma - Yes, the custom action server in Java is my own. It’s a spring boot application.

This is why I am referring the following section of the article, where it has the details for a custom action server, and what to return from it. Attaching the screenshot for the same.

The problem is that even if I am returning the response in the same format as shown in the image, I am not able to get any response in Rasa chatbot.

Thanks