File tree Expand file tree Collapse file tree 1 file changed +28
-2
lines changed
src/api/integrations/channel/whatsapp Expand file tree Collapse file tree 1 file changed +28
-2
lines changed Original file line number Diff line number Diff line change @@ -1591,12 +1591,38 @@ export class BaileysStartupService extends ChannelStartupService {
15911591 } ) ;
15921592 } ,
15931593
1594- 'group-participants.update' : ( participantsUpdate : {
1594+ 'group-participants.update' : async ( participantsUpdate : {
15951595 id : string ;
15961596 participants : string [ ] ;
15971597 action : ParticipantAction ;
15981598 } ) => {
1599- this . sendDataWebhook ( Events . GROUP_PARTICIPANTS_UPDATE , participantsUpdate ) ;
1599+ try {
1600+ // Usa o mesmo método que o endpoint /group/participants
1601+ const groupParticipants = await this . findParticipants ( { groupJid : participantsUpdate . id } ) ;
1602+
1603+ // Filtra apenas os participantes que estão no evento
1604+ const resolvedParticipants = participantsUpdate . participants . map ( ( participantId ) => {
1605+ const participantData = groupParticipants . participants . find ( p => p . id === participantId ) ;
1606+
1607+ return {
1608+ jid : participantId ,
1609+ phoneNumber : participantData ?. phoneNumber || participantId ,
1610+ name : participantData ?. name ,
1611+ imgUrl : participantData ?. imgUrl ,
1612+ } ;
1613+ } ) ;
1614+
1615+ const enhancedParticipantsUpdate = {
1616+ ...participantsUpdate ,
1617+ participants : resolvedParticipants
1618+ } ;
1619+
1620+ this . sendDataWebhook ( Events . GROUP_PARTICIPANTS_UPDATE , enhancedParticipantsUpdate ) ;
1621+ } catch ( error ) {
1622+ console . log ( 'Erro ao buscar dados dos participantes para webhook:' , error ) ;
1623+ // Fallback - envia sem conversão
1624+ this . sendDataWebhook ( Events . GROUP_PARTICIPANTS_UPDATE , participantsUpdate ) ;
1625+ }
16001626
16011627 this . updateGroupMetadataCache ( participantsUpdate . id ) ;
16021628 } ,
You can’t perform that action at this time.
0 commit comments