简体   繁体   中英

Add buttons in whatsapp message response twilio

I currently have the following code which successfully replies any message I send with "Ola":

@app.route("/bot", methods=["POST"])
def bot():
  incoming_msg = request.values.get('Body', '').lower()
  resp = MessagingResponse()
  msg = resp.message()
  quote = 'Ola'
  msg.body(quote)
  return str(resp)

I would like to have response buttons to my reply. Please see attached image, I'd like to add the "Got it" button with my message text. Is that possible for python. Thanks.

在此处输入图像描述

To send quick reply or call to action buttons over WhatsApp using Twilio, you need to create a template and add the buttons to the template. To trigger the template, you need to send a message containing the text of the template in the body. This is all covered in more detail in the Twilio documentation on using buttons in WhatsApp .

Note, you need to have a working WhatsApp number in your account to create and send templates. You cannot use the Sandbox to test out this feature.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM