[英]How to send the location object on whatsapp using twilio?
我可以使用 MessagingResponse 发送位置信息吗?
当我尝试以下方法时,我得到 AttributeError: 'Message' object has no attribute '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()
根据文档显示,至少目前通过 WhatsApp 发送位置的唯一方法是通过 REST API。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.