当前位置: 首页>>代码示例>>Python>>正文


Python Response.message方法代码示例

本文整理汇总了Python中twilio.twiml.Response.message方法的典型用法代码示例。如果您正苦于以下问题:Python Response.message方法的具体用法?Python Response.message怎么用?Python Response.message使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在twilio.twiml.Response的用法示例。


在下文中一共展示了Response.message方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: sms

# 需要导入模块: from twilio.twiml import Response [as 别名]
# 或者: from twilio.twiml.Response import message [as 别名]
def sms(request):
    name = request.POST.get('Body', '')
    msg = 'Hey %s'

    r = Response()
    r.message(msg)
    return r
开发者ID:michaelperret,项目名称:GroupText,代码行数:9,代码来源:views.py

示例2: sms

# 需要导入模块: from twilio.twiml import Response [as 别名]
# 或者: from twilio.twiml.Response import message [as 别名]
def sms(request):
    if request.method == 'GET':
        return HttpResponse("You are using GET. Use POST to communicate via SMS.")

    body = request.POST.get('Body', '')
    body = body.lower()

    if "call me" in body:

        client = TwilioRestClient(settings.TWILIO_ACCOUNT_SID, settings.TWILIO_AUTH_TOKEN) 
    
        call = client.calls.create(
            to="978-382-3789",
            from_="19782917626",
            url="http://twimlets.com/holdmusic?Bucket=com.twilio.music.ambient")
            # monkey mp3 below doesn't work for some reason -> Application error
            # https://demo.twilio.com/hellomonkey/monkey.mp3


        msg = "I'll call you in a sec......"
        r = Response()
        r.message(msg)
        return r


    msg = 'How are you today? This is what you sent me: %s' % (body)
    # msg = 'Hello world! Twilio integrated with Django!!!'
    r = Response()
    r.message(msg)
    return r
开发者ID:kishan,项目名称:Django_Twilio_Project,代码行数:32,代码来源:views.py

示例3: handle_noticeboard_inbound

# 需要导入模块: from twilio.twiml import Response [as 别名]
# 或者: from twilio.twiml.Response import message [as 别名]
    def handle_noticeboard_inbound():

        pusher_key = app.config.get('PUSHER_KEY', None)
        pusher_secret = app.config.get('PUSHER_SECRET', None)
        pusher_app_id = app.config.get('PUSHER_APP_ID', None)

        try:
            p = Pusher(pusher_app_id, pusher_key, pusher_secret)

            p['rrk_noticeboard_live'].trigger(
                'new_message',
                {
                    'image': request.values.get('MediaUrl0', None),
                    'body': request.values.get('Body', None),
                    'from': request.values.get('From', None)
                }
            )
        except:
            return '<Response />'

        to = request.values.get('To', '')
        r = Response()
        r.message(
            '''Thank you, your image has been posted
            to {0}noticeboard/live/{1}'''.format(request.url_root, to))
        return r.toxml()
开发者ID:Twilio-org,项目名称:rapid-response-kit,代码行数:28,代码来源:noticeboard.py

示例4: sms_personal

# 需要导入模块: from twilio.twiml import Response [as 别名]
# 或者: from twilio.twiml.Response import message [as 别名]
def sms_personal(request):
    name = request.POST.get('Body', '')
    msg = 'Hey %s, how are you today?' % (name)
    
    r = Response()
    r.message(msg)
    return r
开发者ID:JPranjali,项目名称:twilio-django-part-1,代码行数:9,代码来源:views.py

示例5: verify_sms

# 需要导入模块: from twilio.twiml import Response [as 别名]
# 或者: from twilio.twiml.Response import message [as 别名]
def verify_sms(request):
    from_number = request.POST.get("From", None)
    from_text = request.POST.get("Body", None)
    msg = game_logic(from_number, from_text)
    r = Response()
    r.message(msg)
    return r
开发者ID:peasnrice,项目名称:Point2Point,代码行数:9,代码来源:web_views.py

示例6: giveHelp

# 需要导入模块: from twilio.twiml import Response [as 别名]
# 或者: from twilio.twiml.Response import message [as 别名]
def giveHelp(person_one, request):
    """ Method for ending a conversation """
    help_message = ""
    help_message += "End conversation: %s Unsubscribe: %s Help: %s" % (end_command, unsubscribe_command, help_command)
    r = Response()
    r.message(msg=help_message, to=person_one.phone_number)
    return r
开发者ID:codekansas,项目名称:phonely,代码行数:9,代码来源:views.py

示例7: sms

# 需要导入模块: from twilio.twiml import Response [as 别名]
# 或者: from twilio.twiml.Response import message [as 别名]
def sms(request):
#    name = request.POST.get('Body', '')

    msg = 'Hey Mike, please send Kennedy a reminder to do a breast self-exam! Go to the page at http://j.mp/SelfChec to get some ideas for what to talk about.'
    r = Response()
    r.message(msg)

    return r
开发者ID:MatthewKrey,项目名称:serkli,代码行数:10,代码来源:views.py

示例8: unsubscribe

# 需要导入模块: from twilio.twiml import Response [as 别名]
# 或者: from twilio.twiml.Response import message [as 别名]
def unsubscribe(person_one, request):
    """ Method for ending a conversation """
    phone = person_one.phone_number
    person_one.delete()
    message = "You have unsubscribed."
    r = Response()
    r.message(msg=message, to=phone)
    return r
开发者ID:codekansas,项目名称:phonely,代码行数:10,代码来源:views.py

示例9: sms_response_help

# 需要导入模块: from twilio.twiml import Response [as 别名]
# 或者: from twilio.twiml.Response import message [as 别名]
def sms_response_help(poll_title, poll_options):
    r = Response()
    r.message(
        u"%s\nOptions: %s.\n\nReply to this SMS with your vote!\n\nTo see the results text RESULTS.\n\nTo remove a vote text UNVOTE.\n\nTo see which option you have voted for text WHICH. \U0001F37A" % (
            poll_title, poll_options
            )
        )
    return r
开发者ID:mleonard87,项目名称:brewballot,代码行数:10,代码来源:views.py

示例10: sms

# 需要导入模块: from twilio.twiml import Response [as 别名]
# 或者: from twilio.twiml.Response import message [as 别名]
def sms(request):
    enrolleeNumber = request.POST.get('Body', '')
    msg = 'Enrollment for %s confirmed' % (enrolleeNumber)
    r = Response()
    r.message(msg)
    enrollmentMessage = 'You have been enrolled in this progam. Stay tuned!'
    sendMessage(enrolleeNumber, enrollmentMessage)
    return r
开发者ID:hackbrightforgood,项目名称:sms_campaign,代码行数:10,代码来源:views.py

示例11: recv

# 需要导入模块: from twilio.twiml import Response [as 别名]
# 或者: from twilio.twiml.Response import message [as 别名]
def recv():
    message = request.values['m']
    data = message.split(' ', 1)
    user = load_user(data[0])

    resp = Response()
    resp.message("Forwarded to %s" % user.email
                 if user else "User not found")
    return str(resp)
开发者ID:sergey-kozub,项目名称:demosms,代码行数:11,代码来源:server.py

示例12: sms

# 需要导入模块: from twilio.twiml import Response [as 别名]
# 或者: from twilio.twiml.Response import message [as 别名]
def sms(request):
    """Will reside in home application only."""
    body = request.POST.get('Body', '')
    from_who = request.POST.get('From', '')
    #msg = 'Hey %s, how are you today?' % (body)
    msg = 'Your request has been received and will be processed shortly.'
    r = Response()
    r.message(msg)
    Received.objects.create(from_who=from_who, msg=body)
    return r
开发者ID:johnwamburu,项目名称:school,代码行数:12,代码来源:views.py

示例13: authorizedEnrollerResponse

# 需要导入模块: from twilio.twiml import Response [as 别名]
# 或者: from twilio.twiml.Response import message [as 别名]
def authorizedEnrollerResponse(senderNumber, smsMessage, request):

    formattedMessage = formatString(smsMessage)
    # If they texted a phone number, enroll that person.
    if isPhoneNumber(formattedMessage):
        try:
            enrolleeNumber = formatPhoneNumber(removeCountryCode(formattedMessage))
            
            # store the enrollee phone number in the session for use in between requests
            request.session[senderNumber] = enrolleeNumber

            addRecipient(phone_number=enrolleeNumber)

            # Get the group the enroller belongs to.
            group = getGroupByPhoneNumber(senderNumber)

            # Pull campaign info for that group.
            camps = group.campaign_set.all()
            campaignIDs = ''

            for camp in camps:
                campID = str(camp.id)
                campName = camp.name
                campaignIDs = campaignIDs + '\n' + campID + ' - ' + campName

            msg = 'Please select a campaign:\n %s' % (campaignIDs)
            r = Response()
            r.message(msg)
            return r
        except Exception as e:
            return invalidRequest('Error: could not enroll user.')
        
    else:
        try:
            campaignID = int(smsMessage)
            # Get the group the enroller belongs to.
            group = getGroupByPhoneNumber(senderNumber)
            
            if isValidCampaignID(campaignID, group) and (request.session[senderNumber] != None):
                campaignName = Campaign.objects.get(id=campaignID).name
                enrolleeNumber = request.session[senderNumber]
                addRecipientToCampaign(enrolleeNumber, campaignID, senderNumber)
                msg = 'Enrollment in %s confirmed for %s' % (campaignName, enrolleeNumber)
                r = Response()
                r.message(msg)
                enrollmentMessage = 'You have been enrolled in %s. Stay tuned!' % (campaignName)
                sendMessage(enrolleeNumber, enrollmentMessage)
                request.session[senderNumber] = None
                return r
            else:
                return invalidRequest('Sorry, we could not find that campaign ID.')
        except Exception as e:
            return invalidRequest('Error: could not find that campaign ID.')
                
    return invalidRequest('Not a valid enrollment or campaign.')
开发者ID:kmjennison,项目名称:sms_campaign,代码行数:57,代码来源:views.py

示例14: continuedConversation

# 需要导入模块: from twilio.twiml import Response [as 别名]
# 或者: from twilio.twiml.Response import message [as 别名]
def continuedConversation(person_one, request):
    """ Method for continuing a conversation """
    message = request.POST.get("Body", "")
    if re.match("speak", message, re.IGNORECASE):
        message = message[6:]
        r = Response()
        r.say(msg=message, to=person_one.partner.phone_number)
        return r
    r = Response()
    r.message(msg=message, to=person_one.partner.phone_number)
    return r
开发者ID:codekansas,项目名称:phonely,代码行数:13,代码来源:views.py

示例15: sms_reply

# 需要导入模块: from twilio.twiml import Response [as 别名]
# 或者: from twilio.twiml.Response import message [as 别名]
def sms_reply():
    message_body = request.form['Body']
    print message_body
    send_message(message_body)

    res = Response()
    res.message('Thanks for texting our HackPack! After a bit of '
                'rendering, your message should scroll by on our display '
                'shortly :) To find out how to do stuff this on your own '
                'check out: http://twilio.com')

    return str(res)
开发者ID:eddiezane,项目名称:hackpack-cloudbit,代码行数:14,代码来源:app.py


注:本文中的twilio.twiml.Response.message方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。