Run an action in a conversation HTTP API not displayed in web chat

Dears, I tried to run an action to active conversation using HTTP API but the message that dispatched from the action not displayed on The web chat, for debugging I run the rasa and rasa actions with Debug Command, In the terminal the action execution appeared on rasa and rasa actions just the dispatched message not displayed on the web chat.

for web chat I am using rasa-webchat

Snapshot from HTTP API call

Request URL: conversations/{conversationId}/execute

Request Body:

{ “name”: “action_test_notify” }

Snapshot from rasa run actions -vv

2019-08-08 17:39:12 DEBUG rasa_sdk.executor - Received request to run ‘action_test_notify’ 2019-08-08 17:39:12 WARNING root - action_test_notify 2019-08-08 17:39:12 DEBUG rasa_sdk.executor - Finished running ‘action_test_notify’ 127.0.0.1 - - [2019-08-08 17:39:12] “POST /webhook HTTP/1.1” 200 432 0.001520

Snapshot from rasa run --enable-api -vv

2019-08-08 17:44:24 DEBUG rasa.core.processor - Action ‘action_test_notify’ ended with events ‘[‘BotUttered(text: test message., data: {“elements”: null, “quick_replies”: null, “buttons”: null, “attachment”: null, “image”: null, “custom”: null}, metadata: {})’, ‘BotUttered(text: pushed message, data: {“elements”: null, “quick_replies”: null, “buttons”: null, “attachment”: null, “image”: null, “custom”: null}, metadata: {})’]’ 2019-08-08 17:44:24 DEBUG rasa.core.processor - Current slot values: able_to_finish: None finish_date: None is_remain_tasks: None project_name: None requested_slot: None 2019-08-08 17:44:24 DEBUG rasa.core.tracker_store - Recreating tracker for id ‘id here’

any help please to overcome this issue.

Thanks

Can I ask why you are using the conversations/{conversationId}/execute endpoint? If you are using rasa-webchat you should have it set up in a socketio input channel.

Thanks for reply @erohmensing, I’m using socketio as input channel in webchat, but I have some scenario to run an action remotely not using python actions or stories

Thanks

@erohmensing Could you point us to how we can initiate a message to socketio then? It is not a supported output_channel param for /conversations/{conversation_id}/execute.

Thanks @mmm3bbb for reply, In this way I initiate the socketio

    <script>
      WebChat.default.init({
        selector: "#webchat",
        initPayload: "/get_started",
        interval: 1000, // 1000 ms between each message
        customData: {"userId": "123"}, // arbitrary custom data. Stay minimal as this will be added to the socket
        socketUrl: "http://localhost:5005",
        socketPath: "/socket.io/",
        title: "BOT",
        subtitle: "Your AI assistants",
        inputTextFieldHint: "Type a message...",
        connectingText: "Waiting for server...",
        hideWhenNotConnected: true,
        fullScreenMode: false,
        profileAvatar: "https://dynl.mktgcdn.com/p/Qv_UQq8KoxM_Dc5LAP4WLkCFA30p6Ok7N32a5CEHFo0/196x186.png",
        openLauncherImage: 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcStjhIQNktxSy0mJGzO-J1GbVi6-mkX7PbgUawvLaRkMwGJLNgY',
        closeLauncherImage: 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcStjhIQNktxSy0mJGzO-J1GbVi6-mkX7PbgUawvLaRkMwGJLNgY',
        params: {
          images: {
            dims: {
              width: 300,
              height: 200,
            }
          },
          storage: "local"
        }
      })
    </script>

and please note I’m using https://github.com/mrbot-ai/rasa-webchat as webchat and if that webchat is not supported as output channel for /conversations/{conversation_id}/execute, Are there any workaround to this issue ?

Thanks

@mohocp Yeah, I was asking @erohmensing the same thing. I do have it working with Facebook Messenger (make you you upgrade to latest version).

@erohmensing… Also, I’m a little uncertain about the application flow. Let’s say that my application wants to track a stock price (stock entity) and alert user when it goes above X. Since it doesn’t appear I can pass in entities in the body, I have to save this alert info with the user, then generate a request to /conversations/{}/execute which will then find its way back to my application and I then lookup what I saved for the user, update tracker and I’m done? Oh, I guess I also need to add a magic intent that tells my application to lookup whatever queued message it has because I can’t use the normal action-handling logic that would normally act on the intent/entities/slots passed in.

Just want to make sure there’s not a more straightforward way to do this.

@erohmensing any suggestions please ?

@mmm3bbb If you want your bot to notify the user when an external event happens, it looks like you’re trying to do something we just added: Actions

I’m already using Action, But I run the action via HTTP API and the action executed but the dispatched message not displayed on web chat.

Did you open the link? It’s not just a link to actions but rather to external triggers.

Thanks @erohmensing, that means the dispatched message not displayed because my input channel not supported, so I should use CallbackInput channel.

So, Are there are any complete example or tutorial about how to implement CallbackInput channel ? for know I’m using socketio channel.

Thanks

What do you mean it is not supported? Perhaps that’s just an API spec error – messages should always get sent back to the input channel that they came from

Proactively reaching out to the user is dependent on the abilities of a channel and hence not supported by every channel. If your channel does not support it, consider using the CallbackInput channel to send messages to a webhook.

The above is quote from the Rasa Action Documentations.

there are no error in API and message always sent to rasa console and the action executed as I mention in topic but the problem is the dispatched message not displayed on webChat

@erohmensing

I think both @mohocp and I have the same question. We are both using this endpoint:

HTTP API

which includes query parameter output_channel.

According to the docs, the valid values for output_channel are: Enum: “latest” “slack” “callback” “facebook” “rocketchat” “telegram” “twilio” “webexteams”

You will see that “socketio” is not a valid value.

I have tested the endpoint using Facebook Messenger as a client and using output_channel=facebook. This indeed works - I am able to trigger an explicit action that then generates a response that is sent to the correct Messenger user.

I have also tried output_channel=socketio and also output_channel=latest (with correct conversation_id for socketio client) and neither forced a response to the socketio channel. The results were returned to the http requester.

So the question that @mohocp and I (and I’m sure others) have is how do we get http://localhost:5005/conversations/{conversation_id}/execute type functionality with socketio as a channel?

@erohmensing any help please

@akelad can please help us on this issue

Okay, I see. thanks for the explanation, @mmm3bbb. What I meant by

What do you mean it is not supported? Perhaps that’s just an API spec error – messages should always get sent back to the input channel that they came from

is that maybe it’s just an error on our part where not all the supported channels are in the enum. @Tobias_Wochinger you added the enum of channels here – do you know if the socket channel does not support this, or if it is just something we missed?

Yep, socketio is not supported. If you wanna do a pr or have ideas how to do so, I’d highly appreciate it.

@Tobias_Wochinger @erohmensing @mmm3bbb,

the above quote from documentations,

Are there any explanations, tutorial or example for CallbackInput channel to send messages to webhook ?

Thanks