예제 #1
0
    def response_for_text(self, username, text,
                          id_string=None, identity=None):
        if identity is None:
            identity = self.random_identity()

        return process_incoming_smses(username=username,
                                      id_string=None,
                                      incomings=[(identity, text)])[0]
예제 #2
0
def process_message_for_twilio(username,
                               sms_identity, sms_text, sms_time, id_string):
    """ Process a text instance and return in SMSSync expected format """

    if not sms_identity or not sms_text:
        return get_response({'code': SMS_API_ERROR,
                             'text': _(u"`identity` and `message` are "
                                       u"both required and must not be "
                                       u"empty.")})

    incomings = [(sms_identity, sms_text)]
    response = process_incoming_smses(username, incomings, id_string)[-1]

    return get_response(response)