我正在使用微软azure中的Twilio node.js应用程序接口发送短信。我想创建一些预定义的模板,如‘亲爱的客户,您的帐户余额是55555卢比’。
可以在Twilio帐号中创建短信模板吗?Twilio支持交易短信吗?
发布于 2016-08-19 04:36:33
您将需要以类似于以下示例的方式定义动态内容,在该示例中,您从Quickstarts按名称(在Python中显示)响应发件人:
https://www.twilio.com/docs/quickstart/python/sms/replying-to-sms-messages
from flask import Flask, request, redirect
import twilio.twiml
app = Flask(__name__)
# Try adding your own number to this list!
callers = {
"+14158675309": "Curious George",
"+14158675310": "Boots",
"+14158675311": "Virgil",
}
@app.route("/", methods=['GET', 'POST'])
def hello_monkey():
"""Respond and greet the caller by name."""
from_number = request.values.get('From', None)
if from_number in callers:
message = callers[from_number] + ", thanks for the message!"
else:
message = "Thanks for the message!"
resp = twilio.twiml.Response()
resp.message(message)
return str(resp)
if __name__ == "__main__":
app.run(debug=True)https://stackoverflow.com/questions/39013432
复制相似问题