|  |  |  | @ -17,25 +17,25 @@ export async function sendMessage(phone: string, message: string | {text: string | 
		
	
		
			
				|  |  |  |  |     // Normalize message input to always have text property
 | 
		
	
		
			
				|  |  |  |  |     const messageText = typeof message === 'string' ? message : message.text; | 
		
	
		
			
				|  |  |  |  |      | 
		
	
		
			
				|  |  |  |  |     // Always include number and text at top level
 | 
		
	
		
			
				|  |  |  |  |     let payload: any = { | 
		
	
		
			
				|  |  |  |  |     // Build payload according to API specification
 | 
		
	
		
			
				|  |  |  |  |     const payload = { | 
		
	
		
			
				|  |  |  |  |       number: phone, | 
		
	
		
			
				|  |  |  |  |       text: messageText, | 
		
	
		
			
				|  |  |  |  |       textMessage: { | 
		
	
		
			
				|  |  |  |  |         text: messageText | 
		
	
		
			
				|  |  |  |  |       }, | 
		
	
		
			
				|  |  |  |  |       options: { | 
		
	
		
			
				|  |  |  |  |         delay: 1200, | 
		
	
		
			
				|  |  |  |  |         presence: 'composing', | 
		
	
		
			
				|  |  |  |  |         linkPreview: false | 
		
	
		
			
				|  |  |  |  |         linkPreview: false, | 
		
	
		
			
				|  |  |  |  |         ...(mentions.length > 0 && { | 
		
	
		
			
				|  |  |  |  |           mentions: { | 
		
	
		
			
				|  |  |  |  |             everyOne: false, | 
		
	
		
			
				|  |  |  |  |             mentioned: mentions.map(phone => phone.split('@')[0]) | 
		
	
		
			
				|  |  |  |  |           } | 
		
	
		
			
				|  |  |  |  |         }) | 
		
	
		
			
				|  |  |  |  |       } | 
		
	
		
			
				|  |  |  |  |     }; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     if (mentions.length > 0) { | 
		
	
		
			
				|  |  |  |  |       // Add mentions if provided
 | 
		
	
		
			
				|  |  |  |  |       payload.options.mentions = { | 
		
	
		
			
				|  |  |  |  |         everyOne: false, | 
		
	
		
			
				|  |  |  |  |         mentioned: mentions.map(phone => phone.split('@')[0]) | 
		
	
		
			
				|  |  |  |  |       }; | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     await axios.post(`${API_URL}/message/sendText/${INSTANCE_NAME}`, payload, { | 
		
	
		
			
				|  |  |  |  |       headers: { | 
		
	
		
			
				|  |  |  |  |         'Content-Type': 'application/json', | 
		
	
	
		
			
				
					|  |  |  | 
 |