Create a template with quick reply in gupshup

637 Views Asked by At

I'm using the gupshup API for create templates and templates simples and with call to action works, the problem come when a try to create with quick replies. I send the data of this way:

"buttons": [ { "type": "text", "text": "Call" } ],

data: The response of gupShup should of are this: Hello this a test. | [Call]

but is only:

data: The response of gupShup should of are this: Hello this a test.

My question is how is object for create a template whith quick replais in the gupShup API

2

There are 2 best solutions below

0
Santiago C. On BEST ANSWER

you need to change the type inside the buttons object.

"buttons": [{"type":"QUICK_REPLY","text":"connect here"}],

There 3 are the different types of buttons: PHONE_NUMBER, URL and QUICK_REPLY

You can find the facebook documentation in here: https://developers.facebook.com/docs/whatsapp/business-management-api/message-templates#creating-message-templates

Good luck!

1
developmedev On
axios({
        method: "POST", // Required, HTTP method, a string, e.g. POST, GET
        url:
          "https://graph.facebook.com/v17.0/" +
          phone_number_id +
          "/messages?access_token=" +
          token,
        data: {
          messaging_product: "whatsapp",
          to: from,
          type: "interactive",
          interactive: {
            type: "button",
            header: {
              type: "text",
              text: "HEADER_TEXT",
            },
            body: {
              text: "" + msg_body,
            },
            footer: {
              text: "footer text",
            },
            action: {
              buttons: [
                {
                  type: "reply",
                  reply: {
                    id: msg_body,
                    title: "Save As Note",
                  },
                },
              ],
            },
          },
        },

        headers: { "Content-Type": "application/json" },
      }).catch((error) => {
        // Handle the error
        console.error(error);
      });