|  |  | @ -78,12 +78,17 @@ export class WebhookServer { | 
			
		
	
		
		
			
				
					
					|  |  |  | 			// 	data: payload.data ? '[...]' : null
 |  |  |  | 			// 	data: payload.data ? '[...]' : null
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 			// });
 |  |  |  | 			// });
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 			switch (payload.event) { |  |  |  | 			// Normalize event name to handle different casing/format (e.g., MESSAGES_UPSERT)
 | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			const evt = String(payload.event); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			const evtNorm = evt.toLowerCase().replace(/_/g, '.'); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			switch (evtNorm) { | 
			
		
	
		
		
			
				
					
					|  |  |  | 				case 'messages.upsert': |  |  |  | 				case 'messages.upsert': | 
			
		
	
		
		
			
				
					
					|  |  |  | 					if (process.env.NODE_ENV !== 'test') { |  |  |  | 					if (process.env.NODE_ENV !== 'test') { | 
			
		
	
		
		
			
				
					
					|  |  |  | 						console.log('ℹ️ Handling message upsert:', { |  |  |  | 						console.log('ℹ️ Handling message upsert:', { | 
			
		
	
		
		
			
				
					
					|  |  |  | 							groupId: payload.data?.key?.remoteJid, |  |  |  | 							groupId: payload.data?.key?.remoteJid, | 
			
		
	
		
		
			
				
					
					|  |  |  | 							message: payload.data?.message?.conversation |  |  |  | 							message: payload.data?.message?.conversation, | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 							rawEvent: evt | 
			
		
	
		
		
			
				
					
					|  |  |  | 						}); |  |  |  | 						}); | 
			
		
	
		
		
			
				
					
					|  |  |  | 					} |  |  |  | 					} | 
			
		
	
		
		
			
				
					
					|  |  |  | 					await WebhookServer.handleMessageUpsert(payload.data); |  |  |  | 					await WebhookServer.handleMessageUpsert(payload.data); | 
			
		
	
	
		
		
			
				
					|  |  | 
 |