Webhook negative trigger condition

I want to add a negative condition, for example “Trigger only if record is not…”
Right now the other way around is listing all records except the one I want to avoid (which has it’s own Webhook).

Hi @fran.san.monk,

Welcome to the forum, and thanks for the suggestion! I agree that having more powerful conditions in the webhooks system would be nice. Please remember to vote on it up top:

And hopefully this is something we can add someday soon.

In the meantime, as a workaround, you should be able to also do this sort of filtering on the webhook receiver side, i.e., every record sends a webhook, but the receiver does a quick check when it gets the webhook and if it’s the bad record, just skip it and exit.

I do agree that this would be better done on our side though, so you’re not getting a bunch of useless webhooks just to discard them.

1 Like

Thanks for the reply. Currently we are checking against the api_key of the record we would like to be excluded and early returning in the server.

// 1. Get the ID of the Item Type from the main entity
const itemTypeId = parsedBody?.entity?.relationships.item_type.data.id

// 2. Find the matching definition in related_entities
const itemTypeDefinition = parsedBody?.related_entities?.find(
        (related) => related.id === itemTypeId && related.type === 'item_type'
)

// 3. Check the API key
const exclude = itemTypeDefinition?.attributes?.api_key === 'record_to_exclude'

Exactly — so you’re already doing that. It works, I hope?

But it would still be nice to be able to set better conditionals on our side.

Yep, works.
Would be very nice if we had the option for excluding specific records though :slight_smile:

1 Like