【问题标题】:How to send the location object on whatsapp using twilio?如何使用 twilio 在 whatsapp 上发送位置对象?
【发布时间】:2020-10-09 08:54:41
【问题描述】:

我可以使用 MessagingResponse 发送位置吗?

当我尝试以下方法时,我得到 AttributeError: 'Message' 对象没有属性 'persistent_action'

from flask import Flask, request
import requests
from twilio.twiml.messaging_response import MessagingResponse

app = Flask(__name__)
@app.route('/bot', methods=['POST'])
def bot():
    resp = MessagingResponse()
    msg = resp.message()
    if request.values.get('Latitude'):
        lat = request.values.get('Latitude')
        long = request.values.get('Longitude')
        location = 'geo:'+lat+','+long
        loc = [location]
        msg.persistent_action(loc)
        return str(resp)
if __name__ == '__main__':
app.run()

【问题讨论】:

标签: python twilio


【解决方案1】:

根据文档看来,至少目前通过 WhatsApp 发送位置的唯一方法是通过 REST API。

Location Messages with WhatsApp

  • 参见代码示例:“发送带有位置信息的 WhatsApp 消息”

How To Send Location Details on WhatsApp in Node JS

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-05-18
    • 1970-01-01
    • 2019-10-28
    • 2019-11-13
    • 2022-01-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多