diff --git a/src/bot/utils/messaging.ts b/src/bot/utils/messaging.ts index 3873ee6..7d66200 100644 --- a/src/bot/utils/messaging.ts +++ b/src/bot/utils/messaging.ts @@ -14,13 +14,10 @@ if (!API_URL || !INSTANCE_NAME || !API_KEY) { // Send a message with optional mentions export async function sendMessage(phone: string, message: string, mentions: string[] = []) { try { - const payload: any = { - number: phone, - text: message, - }; - - // Add mentions if provided + let payload: any; + if (mentions.length > 0) { + // Format with mentions payload = { number: phone, options: { @@ -36,6 +33,12 @@ export async function sendMessage(phone: string, message: string, mentions: stri text: message } }; + } else { + // Simple message format + payload = { + number: phone, + text: message + }; } await axios.post(`${API_URL}/message/sendText/${INSTANCE_NAME}`, payload, {