获取Smooch Whatsapp用户号

时间:2019-07-18 19:54:06

标签: smooch

我正在测试集成到Whatsapp的Smooch Javascript SDK(https://docs.smooch.io/rest/#introduction)。我想知道在收到Webhook请求时是否可以获取用户的电话号码,该电话号码不在请求正文中。

//这是我收到的请求正文

{
  "trigger": "message:appUser",
  "app": { "_id": "5d308957198c1f00104a3b88" },
  "version": "v1.1",
  "messages": [
    {
      "type": "text",
      "text": "Hello",
      "role": "appUser",
      "received": 1563472958.747,
      "name": "Kevin Arias",
      "authorId": "2d4628bcb45b234a1ff",
      "_id": "5d30b43ee223faa28f",
      "source": {
        "type": "whatsapp",
        "integrationId": "5d308964a75fd5a457f",
        "originalMessageId": "ABEGVzElE6JZEN_vQ92XFBiIrb4S",
        "originalMessageTimestamp": 1563472958
      }
    }
  ],
  "appUser": {
    "_id": "2d4628b5cb45b234a1ff",
    "conversationStarted": true,
    "surname": "Arias",
    "givenName": "Kevin",
    "signedUpAt": "2019-07-18T15:00:45.883Z",
    "properties": {}
  },
  "conversation": { "_id": "84860727bddac962a8b" }
}

谢谢

1 个答案:

答案 0 :(得分:1)

如果在Smooch Webhook上启用了includeClient选项,则Webhook有效负载中将包含一个client对象,代表消息的来源。 WhatsApp用户名(通常是用户的电话号码)将在client.externalId

下可用