Send text message
Copy
const BASE_URL = 'https://api.wazapin.id';
async function sendTextMessage(apiKey, channelId, to, text) {
const res = await fetch(`${BASE_URL}/v1/messages`, {
method: 'POST',
headers: {
'X-Api-Key': apiKey,
'Content-Type': 'application/json'
},
body: JSON.stringify({
channel_id: channelId,
to,
type: 'text',
text
})
});
if (!res.ok) {
throw new Error(`sendTextMessage failed: ${res.status}`);
}
return await res.json();
}
Get message by ID
cURL
Copy
curl -X GET "https://api.wazapin.id/v1/messages/{messageID}" \
-H "X-Api-Key: YOUR_API_KEY"