Coming soon: Your brand new Help Center & Community! Get a sneak-peek here

Webhook double-fires when assigning Contact to a Person

Hi Guys,

I have created a webhook to 'listen' for changes to the Person entity through Super Office API.

It has worked like a charm so far. However, when I assign a Contact to a Person (ie. telling Super Office this person is associated with this company) the webhook fires twice for some reason fucking up several interal processes I have going outside of Super Office.

The two bodies of the output the webhook produces are almost identical:

Webhook Body #2:

{

  "EventId": "5000bae9-789f-4184-b02d-d5bcde958f85",

  "Timestamp": "2020-09-23T10:33:14.4098474Z",

  "Changes": [

    "person_id",

    "rank",

    "updated",

    "updated_associate_id"

  ],

  "Event": "person.changed",

  "PrimaryKey": 14200,

  "Entity": "person",

  "ContextIdentifier": "Cust21800",

  "ChangedByAssociateId": 225,

  "WebhookName": "Webhook Test 01"

}

 

Webhook Body #1:

{

  "EventId": "fbe63204-d31c-404f-8c7b-fbcbcd8f630f",

  "Timestamp": "2020-09-23T10:33:14.2848349Z",

  "Changes": [

    "person_id",

    "rank",

    "contact_id",

    "updated_associate_id",

    "updated",

    "x_test"

  ],

  "Event": "person.changed",

  "PrimaryKey": 14200,

  "Entity": "person",

  "ContextIdentifier": "Cust21800",

  "ChangedByAssociateId": 225,

  "WebhookName": "Webhook Test 01"

}

 

Note that the eventID differs from each other and that the first webhook notifies me of a change in 'contact_id' and something called 'x_test' (what is that?) and that the second webhook basically informs me of what I already knew (minus the contact_id).

Can anyone tell me what is going on, and more importantly: Is it possible to get the webhook to only fire once, when the actual contact is assigned?

Best Regards,

Henrik

RE: Webhook double-fires when assigning Contact to a Person

Hi Henrik,

When you get all webhooks, are you certain you only have one for the "person.changed" event? 

The field x_test is probably an extrafield?

 

Af: Tony Yates 23. sep 2020

RE: Webhook double-fires when assigning Contact to a Person

Hi Tony,
Thanks for the fast reply!

We have 4 webhooks of which only one is active. That webhook reacts to the following events:

  • "person.created",
  • "person.changed",
  • "person.deleted",
  • "contact.created",
  • "contact.changed",
  • "contact.deleted"

We tried temporarily making it just react to events dealing with Person, but we got the same result, still double-fires. Also bare in mind that we have had this webhook up and running and working perfectly when just making changes to either Person or Contact. 

It seems to go wrong when we assign a contact to a person, and we are running out of things to check our end.

Best Regards,

Henrik

Af: Henrik Povlsen 24. sep 2020

RE: Webhook double-fires when assigning Contact to a Person

Hi Henrik,

To avoid guessing or experimenting with trial and error, could you explain how you are assigning the person to the company? Is it via the Person panel in SuperOffice, in a CRMScript, or other API?

Best regards.

Af: Tony Yates 24. sep 2020

RE: Webhook double-fires when assigning Contact to a Person

Hi Tony,

I assign it via the Person panel in SuperOffice:

Best Regards,

Henrik

Af: Henrik Povlsen 24. sep 2020

RE: Webhook double-fires when assigning Contact to a Person

Hi,

this is Win client talking....
Changing the contact id of an exisiting disonnected person (thus an orphan with contact_id = 0) to some existing contact is (in Win anyway) a comlex operation that involves first saving the Person model and then defering to the Move/Merge engine.

I suspect, that deep down, as far as messaging is concerned, this is very hard to keep 100% clean.
(I couldn't in WIn where we have the additional challenge of the hybrid where Move/Merge is performed by netserver).

Just thought this might be usefull to note.

/conrad

 

Af: Conrad Weyns 24. sep 2020

RE: Webhook double-fires when assigning Contact to a Person

Hi Conrad,
Thank you for your input. Based on that, I am half expecting the end-result to be that this behaviour cannot be changed and I will somehow have to deal with the double-triggered webhook. Is there any way to get more detailed info in the webhook body or is it possible to filter webhooks to only fire then certain conditions are met.
I am probably grasping at straws here, but any and all input is greatly appreciated :-)

Best Regards,

Henrik

Af: Henrik Povlsen 25. sep 2020