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
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, {

Loading…
Cancel
Save