Skip to content Skip to sidebar Skip to footer

Conditional Sms Response With Django/twilio

I'm trying to adjust the SMS response depending on different parameters (caller id, body of text) and the error is 'HTTP retrieval failure' I've tried using the Flask tutorial for

Solution 1:

Actually in Django it would be quite similar, you should read more about the request. Since you don't know if the request is POST or GET, you can take in use of HttpRequest.REQUEST:

callers = {
    "+14158675309": "Curious George",
    "+14158675310": "Boots",
    "+14158675311": "Virgil",
}

defhello_monkey(request):
    """Respond and greet the caller by name."""

    from_number = request.REQUEST.get('From', None)
    if from_number in callers:
        message = callers[from_number] + ", thanks for the message!"else:
        message = "Monkey, thanks for the message!"# .... your code ....

Hope it helps!

Post a Comment for "Conditional Sms Response With Django/twilio"