【问题标题】:Twilio SMS webhook parameter for threading用于线程的 Twilio SMS webhook 参数
【发布时间】:2017-01-03 05:39:58
【问题描述】:

我想查看发布到我的 Messaging Webhook 的 HTTP 参数,并找出正在响应哪些发送的 SMS。我有我发送的 SMS 的 SID,但它没有出现在任何已发布的参数中。下面是我看到的参数,序列化成URI格式的字符串:

ToCountry=US&ToState=CA&SmsMessageSid=SMxxxxxxx&NumMedia=0&ToCity=&FromZip=94080&SmsSid=SMxxxxxxx&FromState=CA&SmsStatus=received&FromCity=MOUNTAIN VIEW&Body=Yeah? &FromCountry=US&To=+1NNNNNNNNNN&ToZip=&NumSegments=1&MessageSid=SMxxxxxxx&AccountSid=ACzzzzzz&From=+1MMMMMMMMMM&ApiVersion=2010-04-01&

SMxxxxxxx 的所有值在 POST 调用中都是相同的。

我是否应该进行另一个 API 调用以询问特定发送的 SMS 是否收到响应?

【问题讨论】:

  • 我认为不会,当您发布短信时,它会向您发送回复。

标签: twilio webhooks twilio-api


【解决方案1】:

这篇关于使用 SMS 跟踪对话的博文似乎可以帮助您。 https://www.twilio.com/blog/2014/07/the-definitive-guide-to-sms-conversation-tracking.html

@app.route("/sms")
def sms():

    #get the cookie value, or default to zero
    messagecount = int(request.cookies.get('messagecount',0))
    messagecount += 1

    twml = twiml.Response()
    twml.sms("You've sent " + str(messagecount) + " messages in this conversation so far")

    resp = make_response(str(twml))

    expires=datetime.utcnow() + timedelta(hours=4)
    resp.set_cookie('messagecount',value=str(messagecount),expires=expires.strftime('%a, %d %b %Y %H:%M:%S GMT'))

    return resp

修改那里的示例,您可以使用 cookie 来跟踪 specific messages

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-07-22
    • 2017-04-21
    • 1970-01-01
    • 2018-11-19
    • 2020-08-27
    相关资源
    最近更新 更多