Webhook when specific field is updated in contact

I’m attempting to send a ‘contact updated’ webhook event, but only when a specific field is updated in the contact

OR

I just need a way to check to see which specific field has been updated when I receive the contact data at the endpoint.

My use case is that if a specific boolean field is set from ‘false’ to ‘true’, I want to do some stuff at the receiving end. Right now, any time any field is updated, the data is sent to the endpoint, so I’m not able to tell if this field has specifically been updated.

1 Like

Hi, I need exactly the same thing!
Did you find how to do it?

1 Like

Hi, as I see it you have two options:

  • you can add logic in external system in a way that you check if condition to do some stuff in external system is met

  • you can subscribe to LeadEvents::LEAD_POST_SAVE event and call external api only when field has a specific value

Thanks for the answer!

When I’m subscribing to the LEAD_POST_SAVE event, do I get the lead before and after the save? as I want to check if a specific field changed, it’s not enough just to check its value.
I have a boolean field, and I want to know when that boolean changed from false to true (for example, if it is true and remain true, I don’t care about this case).

LEAD_POST_SAVE is after contact has been persisted. LEAD_PRE_SAVE is before.

When you are hooked to LEAD_POST_SAVE you can get updated lead and you can see what has been changed by calling getChanges() method I think its a member of Lead class.

From those changes and current state of $lead you should be able to achieve what you want.

1 Like

there are a few ways I could think of doing this:

  1. Inside a campaign with conditions and webhoook action.
  2. Using the SQL plugin to write your query inside Mautic interface and then use this as a condition inside a campaign with a webhoook action

Has this been resolved? I sort of have the same question: Is it possible to fire a webhook from a campaign with the value of a certain contact’s field? It would be great if there was an automatic drop-down list that I could choose the available field types from inside the ‘send a webhook’ function. Thank you.