def receipts(payload, event): for i in previous_orders: element = Template.ReceiptElement(title=i['title'], subtitle=i['subtitle'], quantity=i['quantity'], price=200, currency="USD", image_url=i['image_url']) address = Template.ReceiptAddress(street_1=i['street_1'], street_2=i['street_2'], city=i['city'], postal_code=i['postal_code'], state=i['state'], country=i['country']) summary = Template.ReceiptSummary(subtotal=200, shipping_cost=5, total_tax=10, total_cost=215) adjustment = Template.ReceiptAdjustment(name=i['name'], amount=1308) page.send( event.sender_id, Template.Receipt(recipient_name=i['receipt_name'], order_number=i['order_number'], currency="USD", payment_method='visa', timestamp="1428444852", elements=[element], address=address, summary=summary, adjustments=[adjustment]))
def send_generic_program(recipient, data): data = urllib.parse.quote_plus(data) response = requests.get('https://uos.edu.pk/about/bot_program/' + data) result = response.json() if result: send_message(recipient, 'Duration : ' + result[0]['duration']) send_message(recipient, 'Credit Hours ' + result[0]['credit_hour']) send_message(recipient, 'Eligibility ' + result[0]['requirement']) page.send( recipient, Template.Buttons(result[0]['name'], [ Template.ButtonWeb( "See More Detail", "https://uos.edu.pk/department/academic_programs/" + result[0]['dpartment']), Template.ButtonWeb( "Prospectus Jump", "https://uos.edu.pk/uploads/faculties/covers/" + result[0]['scheme_file']), Template.ButtonWeb( "Scheme of Study", "https://uos.edu.pk/uploads/faculties/schemes/" + result[0]['detail_scheme']) ])) else: send_message(recipient, 'Sorry, but i am unable to Find' + data) send_typing_off(recipient)
def callback_picked_genre(payload, event): global profile sender_id = event.sender_id count = 1 cartSum = 0 text = '' if len(profile[sender_id].orderDetail): for i in profile[sender_id].orderDetail: item = i.split(',') text += str(count) + ".\n商品名稱:" + item[1] + "\n顏色尺寸:" + item[ 2] + "\n數量:" + item[3] + "\n金額小計:" + str( int(item[3]) * int(item[4])) text += '\n-------------\n' count = count + 1 cartSum += int(item[3]) * int(item[4]) text += '運費:$60\n總金額:' + str(60 + cartSum) page.send(sender_id, text) page.send( sender_id, Template.Generic([ Template.GenericElement( '商品清單', buttons=[ Template.ButtonPostBack('商品詢問', "query1"), Template.ButtonPostBack('送出訂單', "deal") ]) ]))
def Intents_parser(receivedent, user): if receivedent['intent'][0]['value'] == "department_info": return department_info(receivedent, user) elif receivedent['intent'][0]['value'] == "faculty_profile": if first_entity_value(receivedent, 'department_name'): send_generic_faculty(user, receivedent['faculty_name'][0]['value'], receivedent['department_name'][0]['value']) return "Here you go" else: send_generic_faculty(user, receivedent['faculty_name'][0]['value']) return "Here you go" elif receivedent['intent'][0]['value'] == "admission_info": page.send( user, Template.Buttons('Admissions', [ Template.ButtonWeb( "Private Admissions", "https://uos.edu.pk/examination/Admissions_Schedule"), Template.ButtonWeb( "Regular Admissions", "https://admissions.uos.edu.pk/importantdates") ])) return "Here you can Find All Admisison Related Info" elif receivedent['intent'][0]['value'] == "merit_info": page.send( user, Template.Buttons('Merit Info', [ Template.ButtonWeb("Merit Lists", "https://uos.edu.pk/examination/merits") ])) return "Here you can Find All info Related To Merit" elif receivedent['intent'][0]['value'] == "junk": return "that was the junk" else: return "nothing but intents"
def callback_picked_dept(payload, event, data, raw_data, page): sender_id = event.sender_id message = payload.split('_')[1] print(message) tech_idx = data[0].index('technical') if message.lower() in [dept for dept in data[1][tech_idx]]: dept_idx = data[1][tech_idx].index(message) generic_template = [] for event in data[2][dept_idx]: generic_template.append( Template.GenericElement( event, subtitle=data[1][tech_idx][dept_idx] + ' - ' + raw_data['technical'][dept_idx]['alis'], image_url=get_icon_from_name( raw_data['technical'][dept_idx]['events'][ data[2][dept_idx].index(event)]['name']), buttons=[ Template.ButtonPhoneNumber( "Contact", '+91' + raw_data['technical'][dept_idx] ['events'][data[2][dept_idx].index( event)]['managers'][0]['phone']), Template.ButtonPostBack('Details', "TECH_" + event) ])) page.send(sender_id, Template.Generic(generic_template))
def template_cart_items(user_id): cart_id = Cart.query.filter_by(user_id=user_id).first().id cart_item_query = Cart_item.query.filter_by(cart_id=cart_id).all() elements = [] for item in cart_item_query: item_id = item.item_id quantity = item.quantity print(item_id) print(quantity) item = Item.query.filter_by(id=item_id).first() payload = "REMOVE_FROM_CART_|" + str(cart_id) + "|" + str(item.id) print("------->", payload) element = Template.GenericElement( item.name, subtitle=str(item.price) + "৳ (x" + str(quantity) + ")\r\n" + item.description, image_url=item.thumb_urls, buttons=[Template.ButtonPostBack("Remove from cart", payload)]) elements.append(element) isNull = False if not elements: isNull = True return [Template.Generic(elements, True), isNull]
def send_reddit_post(recipient_id, microarticle, microarticle_type): #sends user the text message provided via input response parameter print("[i] Formatting Article...") response = article_Service.format_article(microarticle, microarticle_type) print("[i] " + microarticle_type + " SRC:\t" + str(microarticle.domain)) if microarticle_type == "image": image_formats = ['.gif','.jpg','.jpeg','.png'] if microarticle.url[-4:] in image_formats: page.send(recipient_id, Attachment.Image(str(microarticle.url))) elif microarticle.url[-4:] == ".gifv": page.send(recipient_id, Attachment.Video(str(microarticle.url))) else: page.send(recipient_id, Attachment.Image(str(microarticle.url))) elif microarticle_type == "video": page.send(recipient_id, Attachment.Video(str(microarticle.url))) elif microarticle_type == "article": print("[i] Response:") pprint.pprint(response) page.send(recipient_id, Template.Generic([ Template.GenericElement(microarticle.title, subtitle= response[0].get('subtitle'), item_url= microarticle.url, image_url= microarticle.thumbnail, buttons=[ Template.ButtonShare(), Template.ButtonWeb("Open Web URL", microarticle.url) ]), ])) print("[i] Response sent...") return "success"
def template_cart_products(sender_id): cart = Cart.get_cart(sender_id) products = cart.get_products() pprint(products) templates = [] if len(products) == 0: navigation = [QuickReply("explore categories", "SHOW_CATEGORIES")] print("template_cart_products()") page.send(sender_id, "your cart is empty, continue exploring", quick_replies=navigation) else: for product in products: print(product.product_id) print(product.quantity) # refactor it :'( product_ = Product.query.filter_by(id=product.product_id).first() payload = "REMOVE_FROM_CART|" + str(product.product_id) print("========>", payload) template = Template.GenericElement( product_.name, subtitle=str(product_.price) + "৳ (x" + str(product.quantity) + ")", image_url=product_.img_url, buttons=[ Template.ButtonPostBack("Remove From Cart", payload), Template.ButtonPostBack("Checkout!", "CHECKOUT") ]) templates.append(template) page.send(sender_id, Template.Generic(templates))
def send_receipt(recipient): receipt_id = "order1357" element = Template.ReceiptElement(title="Oculus Rift", subtitle="Includes: headset, sensor, remote", quantity=1, price=599.00, currency="USD", image_url=CONFIG['SERVER_URL'] + "/assets/riftsq.png" ) address = Template.ReceiptAddress(street_1="1 Hacker Way", street_2="", city="Menlo Park", postal_code="94025", state="CA", country="US") summary = Template.ReceiptSummary(subtotal=698.99, shipping_cost=20.00, total_tax=57.67, total_cost=626.66) adjustment = Template.ReceiptAdjustment(name="New Customer Discount", amount=-50) page.send(recipient, Template.Receipt(recipient_name='Peter Chang', order_number=receipt_id, currency='USD', payment_method='Visa 1234', timestamp="1428444852", elements=[element], address=address, summary=summary, adjustments=[adjustment]))
def challenge(turn, total_turn, mark, sender_id): if turn == 0: with open("resource/questions.json") as f: questions = json.load(f) else: with open("questions.pickle", 'rb') as pinfile: questions = pickle.load(pinfile) random_question = sample(questions, 1) question = random_question[0]["question"] choices = random_question[0]["choices"] answer = random_question[0]["answer"] print("question: ", question) for i in questions: if i["question"] == question: questions.remove(i) with open("questions.pickle", "wb") as poutfile: pickle.dump(questions, poutfile) print("questions: ", questions) buttons = [] for i in range(len(choices)): buttons.append( Template.ButtonPostBack( choices[i], str(turn) + "_" + str(total_turn) + "_" + str(i) + "_" + str(answer) + "_" + str(mark))) g_page.send(sender_id, Template.Buttons(question, buttons))
def on_enter_talking(self, event): print("I'm entering talking") sender_id = event['sender']['id'] url = "https://www.youtube.com/results?search_query=%E9%82%8A%E7%B7%A3%E4%BA%BA&sp=EgQQARgB" res = requests.get(url, verify=False) soup = BeautifulSoup(res.text,'html.parser') arr_titles = [] arr_urls = [] i = 0 for all_mv in soup.select(".yt-lockup-video"): # 抓取 Title & Link data = all_mv.select("a[rel='spf-prefetch']") print(data[0].get("href")[-11:]) arr_titles.append(data[0].get("title")) arr_urls.append(data[0].get("href")[-11:]) i += 1 select = random.randint(0,i-1) print(arr_titles[select]) print(arr_urls[select]) page.send(sender_id, Template.Generic([ Template.GenericElement(arr_titles[select], subtitle = "邊緣人專用", item_url = "https://www.youtube.com/watch?v=" + arr_urls[select], image_url = "https://img.youtube.com/vi/" + arr_urls[select] + "/hqdefault.jpg", buttons = [ Template.ButtonWeb("Open Web URL", "https://www.youtube.com/watch?v=" + arr_urls[select]) ]) ])) quick_replies = [QuickReply(title="好 拜拜~", payload="PICK_bye")] page.send(sender_id, "邊緣人就去看跟邊緣人相關的影片啦><" ,quick_replies=quick_replies,metadata="DEVELOPER_DEFINED_METADATA")
def show_persistent_menu(): page.show_persistent_menu([ Template.ButtonPostBack('Subscriptions', 'MENU_PAYLOAD/subscriptions'), Template.ButtonPostBack('Current Features', 'MENU_PAYLOAD/GET_STARTED'), Template.ButtonPostBack('Health and Wellness', 'MENU_PAYLOAD/health') ]) return "Done with persistent menu section"
def webhook(): payload = request.get_data(as_text=True) print(payload) page.show_persistent_menu([Template.ButtonPostBack('SUB_LIST1', 'MENU_PAYLOAD/1'), Template.ButtonPostBack('SUB_LIST2', 'MENU_PAYLOAD/2')]) page.handle_webhook(payload,message = message_handler) return "ok"
def send_button(recipient): page.send( recipient, Template.Buttons("hello", [ Template.ButtonWeb("Open Web URL", "https://www.oculus.com/en-us/rift/"), Template.ButtonPostBack("trigger Postback", "DEVELOPED_DEFINED_PAYLOAD"), Template.ButtonPhoneNumber("Call Phone Number", "+16505551234") ]))
def fb_receive_message(): message_entries = json.loads(request.data.decode('utf8'))['entry'] for entry in message_entries: for message in entry['messaging']: if message.get('message'): user_id = "{sender[id]}".format(**message) text = "{message[text]}".format(**message) res = bt.response(text, user_id) if res == "De rien": client.send_image(user_id, conf.deRien) elif res == "merci": client.send_image(user_id, conf.happy) elif res == "no": client.send_image(user_id, conf.angry) elif res == "ah": client.send_image(user_id, conf.bored) elif res == "quoi": client.send_image(user_id, conf.busy) elif res == "lol": client.send_image(user_id, conf.grand) elif (res == "ok"): page.send( user_id, Template.Generic([ Template.GenericElement( "rift", subtitle="Next-generation virtual reality", item_url="https://www.oculus.com/en-us/rift/", image_url=conf.deRien, buttons=[ Template.ButtonWeb( "Open Web URL", "https://www.oculus.com/en-us/rift/"), Template.ButtonPostBack( "tigger Postback", "DEVELOPED_DEFINED_PAYLOAD"), Template.ButtonPhoneNumber( "Call Phone Number", "+16505551234") ]), Template.GenericElement( "touch", subtitle="Your Hands, Now in VR", item_url="https://www.oculus.com/en-us/touch/", image_url=conf.deRien, buttons=[ Template.ButtonWeb( "Open Web URL", "https://www.oculus.com/en-us/rift/"), Template.ButtonPostBack( "tigger Postback", "DEVELOPED_DEFINED_PAYLOAD"), Template.ButtonPhoneNumber( "Call Phone Number", "+16505551234") ]) ])) else: client.send_text(user_id, res) return "Ok"
def notify_new_event(sender, instance, **kwargs): print("[{}] Sending new event {}".format( get_vi_datetime_now().strftime("%d/%m/%Y %H:%M:%S"), instance.event_to_notification)) subscribers = instance.match.subscriber_set.all() message = Template.Generic([ Template.GenericElement(title="Bàn thắng !!! " + instance.match.scoreboard(), subtitle=instance.event_to_notification) ]) for s in subscribers: page.send(s.subscriber_id, message=message)
def build_template(image, title, subtitle, url=None, postback=None): buttons = [] if url: buttons.append(Template.ButtonWeb(url["text"], url["content"])) if postback: buttons.append( Template.ButtonPostBack(postback["text"], postback["content"])) return Template.GenericElement(title, subtitle=subtitle, image_url=image, item_url=url, buttons=buttons)
def init(): global page TABOT_ACCESS_TOKEN = "EAANbYW2bhcwBAHprKcgSrs86S3MFVdVv37auFZBAo4EPzAMTjKNDQuLj9227ai1Agbryvs2QXcHQgf7vHs2Xv0YynvT7XDo4wPAjSHabFyvbJVQfkUkZCJP7PZBRZBcLctaT7MG0aDSJDFZCBbnxcfR8KB48i9YAWLiIAmSmRevoiIfLGWUIY" page = Page(TABOT_ACCESS_TOKEN) page.show_starting_button("GET_START") page.greeting( "Hi {{user_first_name}}! TaBot is Messenger Bot to help you know more about Celcom Prepaid Package. Let's Get Started!" ) page.show_persistent_menu([ Template.ButtonPostBack("Available command ⚛️", 'COMMAND'), Template.ButtonWeb("Celcom website 📱", "https://www.celcom.com.my"), Template.ButtonPostBack("tabot", 'START') ])
def template_categories(): categories = Category.query.all() elements = [] for category in categories: payload = "SHOW_ITEM_|" + str(category.id) print("------->", payload) element = Template.GenericElement( category.name, subtitle=category.description, image_url=category.thumb_urls, buttons=[Template.ButtonPostBack("Show Products", payload)]) elements.append(element) return Template.Generic(elements)
def template_items(category): items = Item.query.filter_by(cat_id=category) elements = [] for item in items: payload = "ADD_CART_|" + str(item.id) print("------->", payload) element = Template.GenericElement( item.name, subtitle=str(item.price) + "৳\r\n" + item.description, image_url=item.thumb_urls, buttons=[Template.ButtonPostBack("Add to Cart", payload)]) elements.append(element) return Template.Generic(elements, True)
def send_button(recipient): """ Shortcuts are supported page.send(recipient, Template.Buttons("hello", [ {'type': 'web_url', 'title': 'Open Web URL', 'value': 'https://www.oculus.com/en-us/rift/'}, {'type': 'postback', 'title': 'tigger Postback', 'value': 'DEVELOPED_DEFINED_PAYLOAD'}, {'type': 'phone_number', 'title': 'Call Phone Number', 'value': '+16505551234'}, ])) """ page.send(recipient, Template.Buttons("hello", [ Template.ButtonWeb("Open Web URL", "https://www.oculus.com/en-us/rift/"), Template.ButtonPostBack("trigger Postback", "DEVELOPED_DEFINED_PAYLOAD"), Template.ButtonPhoneNumber("Call Phone Number", "+16505551234") ]))
def show_previous_orders(payload, event): a = [] for i in previous_orders: a.append( Template.GenericElement( i['title'], subtitle=i['price'], #item_url=i["link"], image_url=i["image_url"], buttons=[ Template.ButtonPostBack('Check Receipt', 'RECEIPT'), #Template.ButtonPostBack('Bookmark', "ADDTOBOOKMARK"), ])) page.send(event.sender_id, Template.Generic(a))
def get(self, request, *args, **kwargs): page.show_persistent_menu([ Template.ButtonWeb('University of Sargodha', 'https://uos.edu.pk/'), Template.ButtonWeb('ORIC', 'https://oric.uos.edu.pk'), Template.ButtonWeb('File a Complaint', 'https://uos.edu.pk/complaint') ]) page.show_starting_button("Start Asking Your Queries") page.greeting( "University Enquiring Chatbot is here to answer your queries About University" ) return HttpResponse('yaayyyyy')
def send_generic_faculty(recipient, data, dep=""): data = urllib.parse.quote_plus(data) dep = urllib.parse.quote_plus(dep) if (dep): response = requests.get('https://uos.edu.pk/about/bot_faculty/' + data + "/" + dep) result = response.json() if result: page.send( recipient, Template.Generic([ Template.GenericElement( result[0]['name'], subtitle=result[0]['designation'], item_url="https://uos.edu.pk/faculty/profile/" + result[0]['username'], image_url="https://uos.edu.pk/uploads/faculty/profiles/" + result[0]['picture'], buttons=[ Template.ButtonWeb( "Open Profile", "https://uos.edu.pk/faculty/profile/" + result[0]['username']), Template.ButtonPhoneNumber("Contact", '+92 48 9230879') ]) ])) else: send_message( recipient, 'Sorry, but i am unable to Find' + data + " in " + dep) send_typing_off(recipient) else: response = requests.get('https://uos.edu.pk/about/bot_faculty/' + data) result = response.json() if result: page.send( recipient, Template.Generic([ Template.GenericElement( result[0]['name'], subtitle=result[0]['designation'], item_url="https://uos.edu.pk/faculty/profile/" + result[0]['username'], image_url="https://uos.edu.pk/uploads/faculty/profiles/" + result[0]['picture'], buttons=[ Template.ButtonWeb( "Open Profile", "https://uos.edu.pk/faculty/profile/" + result[0]['username']), Template.ButtonPhoneNumber("Contact", '+92 48 9230879') ]) ])) else: send_message(recipient, 'Sorry, but i am unable to Find' + data) send_typing_off(recipient)
def callback_clicked_tech(payload, event, data, raw_data, page): sender_id = event.sender_id message = payload.split('_')[1] print(message) category_idx = -1 event_idx = -1 for event_list in data[2]: for event_name in event_list: if event_name == message: category_idx = data[2].index(event_list) event_idx = event_list.index(event_name) if category_idx == -1: return event_raw_data = raw_data['technical'][category_idx]['events'][event_idx] print(event_raw_data) round_str = '' for n, my_round in enumerate(event_raw_data['rounds'], 1): round_str += 'Round ' + str(n) + ':' round_str += '\n' + str(my_round) + '\n\n' generic_list = [ Template.GenericElement(title=event_raw_data['name'], subtitle=event_raw_data['tagline'], image_url=get_icon_from_name( event_raw_data['name'])), Template.GenericElement(title='Entry Fee: ', subtitle=event_raw_data['fees']) ] if len(event_raw_data['managers']) == 0: # If no manager exists managers = None else: managers = [ Template.ButtonPhoneNumber( "Call Manager", "+91" + str(event_raw_data['managers'][i]['phone'])) for i in range(0, len(event_raw_data['managers'])) if i < 1 ] send_str = round_str page.send( sender_id, Template.List(elements=generic_list, top_element_style='large', buttons=managers)) page.send(sender_id, send_str)
def show_jeans(recipient): page.send( recipient, Template.Generic([ Template.GenericElement( "ONSWARP CAMP - Jeans Skinny Fit - dark ", subtitle="by Only & Sons for £99.99", item_url= "https://www.zalando.co.uk/only-and-sons-onswarp-camp-jeans-skinny-fit-os322g04j-k11.html?wmc=AFF49_IG_DE.51977_60804..", image_url= "https://mosaic01.ztat.net/vgs/media/pdp-gallery/OS/32/2G/03/9K/21/[email protected]", buttons=[ Template.ButtonWeb( "Details & Buy 🛍️🛍", "https://www.zalando.co.uk/only-and-sons-onswarp-camp-jeans-skinny-fit-os322g04j-k11.html?wmc=AFF49_IG_DE.51977_60804.." ), Template.ButtonShare() # Template.ButtonPhoneNumber("Call Branch", "+16505551234") ]), Template.GenericElement( "MICK - Jeans Skinny Fit - seismology", subtitle="by J Brand for £259.99", item_url= "https://www.zalando.co.uk/converse-trainers-athletic-navyblackobsidian-co412b06r-k11.html?wmc=AFF49_IG_DE.51977_60804..", image_url= "https://mosaic01.ztat.net/vgs/media/pdp-zoom/JB/22/2G/00/OK/11/[email protected]", buttons=[ Template.ButtonWeb( "Details & Buy 🛍️🛍", "https://www.zalando.co.uk/j-brand-jeans-skinny-fit-seismology-jb222g00o-k11.html?wmc=AFF49_IG_DE.51977_60804.." ), Template.ButtonShare() ]), Template.GenericElement( "ONSWARP RAW EDGE - Jeans Skinny Fit - light blue denim", subtitle="by Only & Sons for £25.99", item_url= "https://www.zalando.co.uk/only-and-sons-onswarp-raw-edge-jeans-skinny-fit-light-blue-denim-os322g04o-k11.html?wmc=AFF49_IG_DE.51977_60804..", image_url= "https://mosaic01.ztat.net/vgs/media/pdp-zoom/OS/32/2G/04/OK/11/[email protected]", buttons=[ Template.ButtonWeb( "Details & Buy 🛍️🛍", "https://www.zalando.co.uk/only-and-sons-onswarp-raw-edge-jeans-skinny-fit-light-blue-denim-os322g04o-k11.html?wmc=AFF49_IG_DE.51977_60804.." ), Template.ButtonShare() ]) ]))
def generate_summaries(name,sentences): # NOTE : we don't need to store summary , instead storing the links would be enough . articles = subscribe.subscribe_model(name) # link , headline , date==None , image_url , sentences(list) if articles == None : return False results = [] ''' Set a "View More Articles" Option Over here instead of max_articles ''' for article in articles: # breakpoint tests ''' Issue : Default use of Generic Template <subtitle section> 60chars, <title section> 60 chars ,List view( No - Image ) 640 chars ''' article_url = article[0] headline = article[1] publish_date = article[2] top_image_url = article[3] summary_list = [] concate_news = headline if len(article)==5: concate_news = article[4] # recheck TODO sum_keys = sorted(SUMMARIES.keys()) if len(sum_keys) > max_local_summaries : del SUMMARIES[sum_keys[0]] if not len(sum_keys): hash_index = 0 else: hash_index = sum_keys[-1] results.append(Template.GenericElement(headline, subtitle = name , image_url = top_image_url, buttons=[ Template.ButtonWeb("Read More", article_url), Template.ButtonPostBack("Summarize", "DEVELOPED_DEFINED_PAYLOAD" + str(hash_index+1)), # maybe a SHARE button ? # Template.ButtonPhoneNumber("Call Phone Number", "+16505551234") ]) ) SUMMARIES[hash_index+1] = [top_image_url,concate_news] print("reached Line:227") return results
def show_hotel_room(recipient): page.send( recipient, Template.Generic([ Template.GenericElement( "Seven Suns Hotel Template", subtitle="Basic Suite", item_url="https://sevensuns.com", image_url= "http://www.vhotel.sg/Bencoolen/scripts/images/accomodations/rooms/b_twin_display.jpg", buttons=[ # Template.ButtonWeb("Open Web URL", "https://www.oculus.com/en-us/rift/"), Template.ButtonPostBack("Select Room", "SELECT_ROOM") # Template.ButtonPhoneNumber("Call Branch", "+16505551234") ]), Template.GenericElement( "Seven Suns Hotel Template", subtitle="Deluxe Suite", item_url="https://sevensuns.com", image_url= "http://www.vhotel.sg/Bencoolen/scripts/images/accomodations/rooms/b_premier_display.jpg", buttons=[ # {'type': 'web_url', 'title': 'Open Web URL', # 'value': 'https://www.oculus.com/en-us/rift/'}, { 'type': 'postback', 'title': 'Select Room', 'value': 'SELECT_ROOM' }, # {'type': 'phone_number', 'title': 'Call Branch', 'value': '+16505551234'}, ]), Template.GenericElement( "Seven Suns Hotel Template", subtitle="Premium Suite", item_url="https://sevensuns.com", image_url= "http://www.vhotel.sg/Bencoolen/scripts/images/accomodations/rooms/b_patio_display.jpg", buttons=[ # {'type': 'web_url', 'title': 'Open Web URL', # 'value': 'https://www.oculus.com/en-us/rift/'}, { 'type': 'postback', 'title': 'Select Room', 'value': 'SELECT_ROOM' }, # {'type': 'phone_number', 'title': 'Call Branch', 'value': '+16505551234'}, ]) ]))
def send_Aguascalientes(recipient): page.send(recipient, "¿En cuál de nuestros hoteles te gustaría hospedarte?") page.send(recipient, Template.Generic([ Template.GenericElement("Hotel Ibis", subtitle="Haz tu reservación en Hotel Ibis", image_url=CONFIG['SERVER_URL'] + "/assets/hotel_ibis_aguascalientes.jpg", buttons=[ Template.ButtonPostBack("seleccionar", "hotel_ibis") ]), Template.GenericElement("Hotel Francia Aguascalientes", subtitle="Haz tu reservación en Hotel Francia", image_url=CONFIG['SERVER_URL'] + "/assets/hotel_francia_aguascalientes.jpg", buttons=[ Template.ButtonPostBack("seleccionar", "hotel_francia") ]) ]))
def send_account_linking(recipient): page.send( recipient, Template.AccountLink(text="Welcome. Link your account.", account_link_url=CONFIG['SERVER_URL'] + "/authorize", account_unlink_button=True))