0

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

Z rf
  • 65
  • 3
  • Welcome to Stack Overflow. Please take the [tour] to learn how Stack Overflow works and read [ask] on how to improve the quality of your question. Then [edit] your question to include your source code as a working [mcve], which can be tested by others. – Progman Jan 15 '22 at 09:34

2 Answers2

0

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!

0
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);
      });
  • Thank you for contributing to the Stack Overflow community. This may be a correct answer, but it’d be really useful to provide additional explanation of your code so developers can understand your reasoning. This is especially useful for new developers who aren’t as familiar with the syntax or struggling to understand the concepts. **Would you kindly [edit] your answer to include additional details for the benefit of the community?** – Jeremy Caney Aug 06 '23 at 01:15