following these docs https://mukulsib.readme.io/reference/sendwhatsappmessage
i wrote this code:
import axios from 'axios';
const API_KEY = '/i got api key from brevo SMTP & API page/';
export default async function handler(req, res) {
if (req.method === 'POST') {
const { phoneNumbers, Message } = req.body;
for (const phone of phoneNumbers) {
const options = {
method: 'POST',
headers: {
accept: 'application/json',
'content-type': 'application/json',
'api-key': API_KEY,
},
body: JSON.stringify({
senderNumber: '123456789',
text: Message,
contactNumbers: [phone,]
})
};
try {
const response = await axios.request(options);
console.log(`Message sent successfully to ${phone}`);
console.log('Response data:', response.data);
} catch (error) {
console.error(`Error sending message to ${phone}:`, error.message);
}
}
res.status(200).json({ message: 'Messages sent' });
} else {
res.status(405).json({ error: 'Method not allowed' });
}
}
and when i try it on the docs page i get this error:
{“code”: “permission_denied”, “message”: “Your account is not registered”}