【问题标题】:telegram user phone number or id in dialogflow webhookdialogflow webhook 中的电报用户电话号码或 ID
【发布时间】:2019-07-29 03:41:05
【问题描述】:

我已经集成了 DialogFlow 和 Telegram。

我在 fullfilment 发送 webhook。

如何获取用户 Telegram 电话号码并将其发送到 webhook?

谢谢。

【问题讨论】:

    标签: dialogflow-es telegram


    【解决方案1】:

    您不会从 Telegram Bot API 获得电话号码,但您可以提取用户 ID。这是您将在 webhook 中收到的示例负载(在 request['originalDetectIntentRequest']['payload'] 节点中):

    {  
       'source':'telegram',
       'data':{  
          'update_id':123456789.0,
          'message':{  
             'from':{  
                'is_bot':False,
                'username':'user_name',
                'id':123456789.0,
                'language_code':'pl',
                'last_name':'Last Name',
                'first_name':'First Name'
             },
             'chat':{  
                'type':'private',
                'last_name':'Last Name',
                'id':123456789.0,
                'first_name':'First Name',
                'username':'user_name'
             },
             'message_id':258.0,
             'text':'user message',
             'date':1564341923.0
          }
       }
    }
    

    获取用户电话号码的唯一方法是询问他。你可以在这里找到更多信息:https://core.telegram.org/bots/2-0-intro#locations-and-numbers

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-04-15
      • 2019-03-02
      • 2017-11-20
      • 2022-11-05
      • 2019-10-20
      • 1970-01-01
      • 2018-07-18
      相关资源
      最近更新 更多