import axios from "axios";

async function sendTemplateMessage(full_name, form_body) {
  const response = await axios({
    url: `https://graph.facebook.com/v21.0/500384213149538/messages`,
    method: "post",
    headers: {
      Authorization: `Bearer EAAZAAssQOC1ABO8m33nyhEZBX9ZBZCUzCunOSriapfnt5sjNy6r4kNGWMJBKm24JQN0IlhA2ZCZBzzXsmWxTKCZAfdXKuf57tarVoesKf3lGgRZAm5ZATyxRk6B06bHkOZB9sLhSTGknasOo4qn369kGnUlzSSZBSudomqoi72ZA932bwHq6yujOjC7dmzsXCPpZAXHiNQAZDZD`,
      "Content-Type": "application/json",
    },
    data: JSON.stringify({
      messaging_product: "whatsapp",
      to: "918057467015",
      type: "template",
      template: {
        name: "info_ticket",
        language: { code: "en_US" },
        components: [
          {
            type: "header",
            parameters: [{ type: "text", text: full_name }],
          },
          {
            type: "body",
            parameters: [{ type: "text", text: form_body }],
          },
        ],
      },
    }),
  });
  console.log(response.data);
}

export default sendTemplateMessage;
