main
borja 3 months ago
parent 233f27aa59
commit 4daca04352

Binary file not shown.

@ -12,14 +12,15 @@ if (!API_URL || !INSTANCE_NAME || !API_KEY) {
} }
// Send a message with optional mentions // Send a message with optional mentions
export async function sendMessage(phone: string, message: string | {text: string}, mentions: string[] = []) { export async function sendMessage(phone: string, message: string | { text: string }, mentions: string[] = []) {
try { try {
// Normalize message input to always have text property // Normalize message input to always have text property
const messageText = typeof message === 'string' ? message : message.text; const messageText = typeof message === 'string' ? message : message.text;
console.log(`el phone es ${phone} y el mensaje es ${message}`)
// Build payload according to API specification // Build payload according to API specification
const payload = { const payload = {
number: phone, number: phone,
text: messageText,
textMessage: { textMessage: {
text: messageText text: messageText
}, },

Loading…
Cancel
Save