1

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.

enter image description here

Chognificent
  • 393
  • 6
  • 20

1 Answers1

3

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.

philnash
  • 70,667
  • 10
  • 60
  • 88