twillio_handler.py 文件源码

python
阅读 17 收藏 0 点赞 0 评论 0

项目:DecidePolitics 作者: georgeaf99 项目源码 文件源码
def handle_sms():
    """Handles Twillio SMS message"""
    customer_phone_number = request.values["From"]
    text_message_body = request.values["Body"]

    # Retrieve the customer from the DB or create a new one
    customer = Customer.get_customer_by_phone_number(customer_phone_number)
    if not customer:
        # Save the customer to the DB
        customer = Customer.create_new({
            CFields.PHONE_NUMBER: customer_phone_number,
        })
        customer.create()

        customer_lc.on_new_customer()

    messaging.on_message_recieve(customer, text_message_body)

    return jsonpickle.encode(dict(
        success=True
    ))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号