Skip to content

Conversation

@MateoMax-hub
Copy link

@MateoMax-hub MateoMax-hub commented Jul 24, 2023

FEATURE:
event for labels.association are now assigned to a a new listener "ON_LABEL_ASSOCIATION" and used on the function "onLabelAssociation", the function will receive a callback to execute each time the events get triggered (adding o removing a label on a chat), in the parameters of the callback you will receive an obj like this:

{
  'labels.association': {
    type: 'add',
    association: {
      type: 'label_jid',
      chatId: '(number-of-the-chat-here)@s.whatsapp.net',
      labelId: '3'
    }
  }
}

type can be add or remove depending if you are adding or removing a label, and labelId is an id for the label selected to do this event, i'm planning on making a function to get the labels an maybe i can at that point integrate it with this so you can get the labelId and it's name too

@MateoMax-hub
Copy link
Author

this works for me, @mimamch if you need me to make any changes on this pr, request them freely i will look into it, and if you don't want this change on your project it's fine too i can use it from my forked repository.
I'm also planning on a function to get the labels created

@MateoMax-hub MateoMax-hub changed the title listener for labels association events created [FEATURE]: listener for labels association events created Jul 24, 2023
@MateoMax-hub
Copy link
Author

i added a listener for labels.edit too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant