fix: Change const to let in messaging utility to allow payload reassignment

main
brobert (aider) 3 months ago
parent de13ca8115
commit b63c4cd2ec

@ -14,13 +14,10 @@ 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, mentions: string[] = []) { export async function sendMessage(phone: string, message: string, mentions: string[] = []) {
try { try {
const payload: any = { let payload: any;
number: phone,
text: message,
};
// Add mentions if provided
if (mentions.length > 0) { if (mentions.length > 0) {
// Format with mentions
payload = { payload = {
number: phone, number: phone,
options: { options: {
@ -36,6 +33,12 @@ export async function sendMessage(phone: string, message: string, mentions: stri
text: message text: message
} }
}; };
} else {
// Simple message format
payload = {
number: phone,
text: message
};
} }
await axios.post(`${API_URL}/message/sendText/${INSTANCE_NAME}`, payload, { await axios.post(`${API_URL}/message/sendText/${INSTANCE_NAME}`, payload, {

Loading…
Cancel
Save