1

When a user calls to the Dialogflow phone gateway, I should be able to retrieve his phone number. So, I referred to the Dialogflow version 2 API's and I found one API called OriginalDetectIntentRequest which stores the called ID in the payload. I need the node.js code to retrieve this caller ID. (I'm new to Dialogflow and node.js). Can anyone provide me with the code for it.

1 Answers1

1

If you upgrade your plan you will get below detail in your webhook,

{
    "responseId": "9b3b323a-2d37-43a4-8128-4aa5f8bf73c4-ab1309b0",
    "queryResult": {
        "queryText": "TELEPHONY_WELCOME",
        "action": "input.welcome",
        "parameters": {},
        "allRequiredParamsPresent": true,
        "fulfillmentText": "Welcome to my agent",
        "fulfillmentMessages": [
            {
                "platform": "TELEPHONY",
                "telephonySynthesizeSpeech": {
                    "text": "Welcome to my agent"
                }
            },
            {
                "text": {
                    "text": [
                        "Welcome to my agent"
                    ]
                }
            }
        ],
        "outputContexts": [
            {
                "name": "projects/wertyf-qcbtap/agent/sessions/BlvF7EW3RVGk96ZPZsP2_w/contexts/telephony_welcome"
            },
            {
                "name": "projects/wertyf-qcbtap/agent/sessions/BlvF7EW3RVGk96ZPZsP2_w/contexts/__system_counters__",
                "parameters": {
                    "no-input": 0,
                    "no-match": 0
                }
            }
        ],
        "intent": {
            "name": "projects/wertyf-qcbtap/agent/intents/c727997d-f9b0-4b58-a9d4-d6e47c15e868",
            "displayName": "Default Welcome Intent"
        },
        "intentDetectionConfidence": 1,
        "languageCode": "en"
    },
    "originalDetectIntentRequest": {
        "source": "GOOGLE_TELEPHONY",
        "payload": {
            "telephony": {
                "caller_id": "Anonymous"
            }
        }
    },
    "session": "projects/wertyf-qcbtap/agent/sessions/BlvF7EW3RVGk96ZPZsP2_w"
}
Nikhil Savaliya
  • 2,138
  • 4
  • 24
  • 45