How can I get a conversation_id so I run an Action via POST from an App

Hi @Tanja,

Yes, sender_id and conversation_id are the same thing. It used to be called sender_id , but then we renamed it to conversation_id .

That’s great! I messa round for a bunch of hours when I finally your statement that I confirmed with a simple test:

First of all I talk with a bot with sender = "Giorgio"

curl localhost:5005/webhooks/rest/webhook -d '{ "sender": "Giorgio", "message": "hi" }'

and afterward I call the /prediction endpoint, just as an example, passing “Giorgio” as conversation_id

curl -s -X POST localhost:5005/conversations/Giorgio/predict

getting expected results ( see full payload answer of curl requests at the end of this post):

Notes:

  • in the last call the sender is in attribute with name sender_id,
  • that is NOT conversation_id (as documentation states)
  • that is NOT sender (as the webhook endpoint requires)
  • that is NOT recipient_id (as the webhook endpoint reply)
  • that is NOT session_id (as I read somewhere in documentation, if I’m not wrong)

So I’m happy that this holy ID has 5 different names that identify the same stuff :sweat_smile: That’s important for the application need to send “push” message to sender_id, calling /conversations/<conversation_id>/trigger_intentendpoint to trigger a push message in case of external events.

Nice! but…

However, it seems like, we forgot some places.

Yes. I agree with the closed issue consolidate sender_id and conversation_id #4683:

My modest suggestions:

  1. quick & dirty solution is to solve the topic just with big visible annotation boxes in the documentation, here and there on user guide pages, REST API doc page, etc., just stating in large print:

sender === sender_id ==== conversation_ID === recipient_id (=== session_id) :wink:

  1. honestly the API interface would be “consolidated” at least at the external HTTP interface level. I understand the backward compatibility needs. A solution is to deprecate (in documentation) the old attribute names (as “sender”), still accepting them, and suggesting to use a unique name (e.g. conversation_id).

Make sense for you? I’m missing something?

Sorry for long post. Thanks / giorgio


$ curl -s localhost:5005/webhooks/rest/webhook -d '{ "sender": "Giorgio", "message": "hi" }' | json
[
    {
        "recipient_id": "Giorgio",
        "text": "hey"
    },
    {
        "buttons": [
            {
                "payload": "/mood_great",
                "title": "great"
            },
            {
                "payload": "/mood_unhappy",
                "title": "sad"
            }
        ],
        "recipient_id": "Giorgio",
        "text": "How are you?"
    }
]

$ curl -s -X POST localhost:5005/conversations/Giorgio/predict |json
{
    "confidence": 0.9853241444,
    "policy": "policy_0_TEDPolicy",
    "scores": [
        {
            "action": "utter_greet",
            "score": 0.9853241444
        },
        {
            "action": "utter_iamabot",
            "score": 0.0041449759
        },
        {
            "action": "utter_did_that_help",
            "score": 0.0024251365
        },
        {
            "action": "utter_goodbye",
            "score": 0.0021894691
        },
        {
            "action": "utter_cheer_up",
            "score": 0.0020371093
        },
        {
            "action": "utter_noworries",
            "score": 0.0012032713
        },
        {
            "action": "action_session_start",
            "score": 0.0007067497
        },
        {
            "action": "utter_happy",
            "score": 0.0007019339
        },
        {
            "action": "action_restart",
            "score": 0.0006773554
        },
        {
            "action": "action_default_fallback",
            "score": 0.000589791
        },
        {
            "action": "action_back",
            "score": 0.0
        },
        {
            "action": "action_deactivate_form",
            "score": 0.0
        },
        {
            "action": "action_default_ask_affirmation",
            "score": 0.0
        },
        {
            "action": "action_default_ask_rephrase",
            "score": 0.0
        },
        {
            "action": "action_listen",
            "score": 0.0
        },
        {
            "action": "action_revert_fallback_events",
            "score": 0.0
        },
        {
            "action": "utter_how_are_you",
            "score": 0.0
        }
    ],
    "tracker": {
        "active_form": {},
        "events": [
            {
                "confidence": null,
                "event": "action",
                "name": "action_session_start",
                "policy": null,
                "timestamp": 1588440894.6446385
            },
            {
                "event": "session_started",
                "timestamp": 1588440894.6446514
            },
            {
                "confidence": null,
                "event": "action",
                "name": "action_listen",
                "policy": null,
                "timestamp": 1588440894.6446688
            },
            {
                "event": "user",
                "input_channel": "rest",
                "message_id": "1557eff7286f44268920b8fb83cd3797",
                "metadata": {},
                "parse_data": {
                    "entities": [],
                    "intent": {
                        "confidence": 0.9912492037,
                        "name": "greet"
                    },
                    "intent_ranking": [
                        {
                            "confidence": 0.9912492037,
                            "name": "greet"
                        },
                        {
                            "confidence": 0.0024676742,
                            "name": "affirm"
                        },
                        {
                            "confidence": 0.0020308082,
                            "name": "deny"
                        },
                        {
                            "confidence": 0.0014053768,
                            "name": "bot_challenge"
                        },
                        {
                            "confidence": 0.0012757968,
                            "name": "mood_unhappy"
                        },
                        {
                            "confidence": 0.0007220268,
                            "name": "goodbye"
                        },
                        {
                            "confidence": 0.0005345532,
                            "name": "thank"
                        },
                        {
                            "confidence": 0.0003145098,
                            "name": "mood_great"
                        }
                    ],
                    "text": "hi"
                },
                "text": "hi",
                "timestamp": 1588440894.853342
            },
            {
                "confidence": 1.0,
                "event": "action",
                "name": "utter_greet",
                "policy": "policy_1_MemoizationPolicy",
                "timestamp": 1588440894.8554208
            },
            {
                "data": {
                    "attachment": null,
                    "buttons": null,
                    "custom": null,
                    "elements": null,
                    "image": null,
                    "quick_replies": null
                },
                "event": "bot",
                "metadata": {},
                "text": "hi",
                "timestamp": 1588440894.8554251
            },
            {
                "confidence": 1.0,
                "event": "action",
                "name": "utter_how_are_you",
                "policy": "policy_1_MemoizationPolicy",
                "timestamp": 1588440894.857363
            },
            {
                "data": {
                    "attachment": null,
                    "buttons": [
                        {
                            "payload": "/mood_great",
                            "title": "great"
                        },
                        {
                            "payload": "/mood_unhappy",
                            "title": "sad"
                        }
                    ],
                    "custom": null,
                    "elements": null,
                    "image": null,
                    "quick_replies": null
                },
                "event": "bot",
                "metadata": {},
                "text": "How are you?",
                "timestamp": 1588440894.8573668
            },
            {
                "confidence": 1.0,
                "event": "action",
                "name": "action_listen",
                "policy": "policy_1_MemoizationPolicy",
                "timestamp": 1588440894.8591037
            },
            {
                "event": "user",
                "input_channel": "rest",
                "message_id": "2751ca8ffb164a8a9a5284ef5880afc9",
                "metadata": {},
                "parse_data": {
                    "entities": [],
                    "intent": {
                        "confidence": 0.9912492037,
                        "name": "greet"
                    },
                    "intent_ranking": [
                        {
                            "confidence": 0.9912492037,
                            "name": "greet"
                        },
                        {
                            "confidence": 0.0024676742,
                            "name": "affirm"
                        },
                        {
                            "confidence": 0.0020308082,
                            "name": "deny"
                        },
                        {
                            "confidence": 0.0014053768,
                            "name": "bot_challenge"
                        },
                        {
                            "confidence": 0.0012757968,
                            "name": "mood_unhappy"
                        },
                        {
                            "confidence": 0.0007220268,
                            "name": "goodbye"
                        },
                        {
                            "confidence": 0.0005345532,
                            "name": "thank"
                        },
                        {
                            "confidence": 0.0003145098,
                            "name": "mood_great"
                        }
                    ],
                    "text": "hi"
                },
                "text": "hi",
                "timestamp": 1588441827.8472962
            },
            {
                "confidence": 0.9858503342,
                "event": "action",
                "name": "utter_greet",
                "policy": "policy_0_TEDPolicy",
                "timestamp": 1588441827.850348
            },
            {
                "data": {
                    "attachment": null,
                    "buttons": null,
                    "custom": null,
                    "elements": null,
                    "image": null,
                    "quick_replies": null
                },
                "event": "bot",
                "metadata": {},
                "text": "hey",
                "timestamp": 1588441827.8503537
            },
            {
                "confidence": 0.9982337952,
                "event": "action",
                "name": "utter_how_are_you",
                "policy": "policy_0_TEDPolicy",
                "timestamp": 1588441827.853193
            },
            {
                "data": {
                    "attachment": null,
                    "buttons": [
                        {
                            "payload": "/mood_great",
                            "title": "great"
                        },
                        {
                            "payload": "/mood_unhappy",
                            "title": "sad"
                        }
                    ],
                    "custom": null,
                    "elements": null,
                    "image": null,
                    "quick_replies": null
                },
                "event": "bot",
                "metadata": {},
                "text": "How are you?",
                "timestamp": 1588441827.853198
            },
            {
                "confidence": 0.9818285704,
                "event": "action",
                "name": "action_listen",
                "policy": "policy_0_TEDPolicy",
                "timestamp": 1588441827.8560057
            }
        ],
        "followup_action": null,
        "latest_action_name": "action_listen",
        "latest_event_time": 1588441827.8560057,
        "latest_input_channel": "rest",
        "latest_message": {
            "entities": [],
            "intent": {
                "confidence": 0.9912492037,
                "name": "greet"
            },
            "intent_ranking": [
                {
                    "confidence": 0.9912492037,
                    "name": "greet"
                },
                {
                    "confidence": 0.0024676742,
                    "name": "affirm"
                },
                {
                    "confidence": 0.0020308082,
                    "name": "deny"
                },
                {
                    "confidence": 0.0014053768,
                    "name": "bot_challenge"
                },
                {
                    "confidence": 0.0012757968,
                    "name": "mood_unhappy"
                },
                {
                    "confidence": 0.0007220268,
                    "name": "goodbye"
                },
                {
                    "confidence": 0.0005345532,
                    "name": "thank"
                },
                {
                    "confidence": 0.0003145098,
                    "name": "mood_great"
                }
            ],
            "text": "hi"
        },
        "paused": false,
        "sender_id": "Giorgio",
        "slots": {}
    }
}