This is the code please help me
const WHATSAPP_ACCESS_TOKEN = "EAAHEuqo9pXUBANzrGgoXGaZAHAcCgI7ZAoKZAH19aVMBZBiX85iWqcxk5M2EGHK9Ooukb5jh8q4duEKaLJFIbx3fp84ZCD14J81ipb7ejwsAasLJ3ZB56zPBSadGt8hI9PA6vkPJwClXirS1Vhg1dae7Lr7XqseuQPdNyNwmLiUazvJxY5Tp67o1jPWgqZAJuW9z6y4XFEcOEbUiNZAZCvSeI9LDimcwUsrIZD";
const WHATSAPP_TEMPLATE_NAME = "mbautoworld";
const LANGUAGE_CODE = "en";
const sendMessage_ = ({
recipient_number,
customer_name,
item_name,
delivery_date,
}) => {
const request = UrlFetchApp.fetch(apiUrl, {
muteHttpExceptions: true,
method: "POST",
headers: {
Authorization: `Bearer ${WHATSAPP_ACCESS_TOKEN}`,
"Content-Type": "application/json",
},
"payload": JSON.stringify({
"messaging_product": "whatsapp",
"type": "template",
"to": "recipient_number",
"template": {
"name": "mbautoworld",
"language": { "code": "en" },
"components": [
{
"type": "body",
"parameters": [
{
"type": 'text',
"text": "customer_name",
},
{
"type": 'text',
"text": "item_name",
},
{
"type": 'text',
"text": "delivery_date",
},
],
},
],
},
}),
});
const { error } = JSON.parse(request);
const status = error ? `Error: ${JSON.stringify(error)}` : `Message sent to ${recipient_number}`;
Logger.log(status);
};
const getSheetData_ = () => {
const [header, ...rows] = SpreadsheetApp.getActiveSheet().getDataRange().getDisplayValues();
const data = [];
rows.forEach((row) => {
const recipient = { };
header.forEach((title, column) => {
recipient[title] = row[column];
});
data.push(recipient);
});
return data;
};
const main = () => {
const data = getSheetData_();
data.forEach((recipient) => {
const status = sendMessage_({
recipient_number: recipient["Phone Number"].replace(/[^\d]/g, ""),
customer_name: recipient["Customer Name"],
item_name: recipient["Item Name"],
delivery_date: recipient["Delivery Date"],
});
});
};