如何在node.js中使用googledialogflow的OriginalDetectIntentRequest api获取呼叫者的呼叫者ID

时间:2020-03-10 15:00:55

标签: node.js dialogflow-es

当用户呼叫Dialogflow电话网关时,我应该能够检索到他的电话号码。因此,我参考了Dialogflow版本2的API,然后发现了一个名为OriginalDetectIntentRequest的API,该API将调用的ID存储在有效负载中。我需要node.js代码来检索此呼叫者ID。 (我是Dialogflow和node.js的新手)。谁能为我提供代码。

1 个答案:

答案 0 :(得分:0)

如果升级您的计划,您将在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"
}