在Twilio中创建SMS模板



我在microsoft azure中使用Twilio node.js API发送短信。我想创建一些预定义的模板,比如"亲爱的客户,您的账户余额是55555卢比"。

是否可以在Twilio帐户中创建SMS模板?Twilio是否支持Transaction SMS ?

您需要以类似于以下示例的方式定义动态内容,在快速入门中,您通过名称响应发送者(在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)

最新更新