Changes attribute missing in OnContactUpdate product event

Hi @channel,

We are facing a challenge with getting the full payload details for a custom app triggered with an OnContactUpdate product event.

Here am not getting the changes field of a contact, which shows the Updated field values when a contact field is updated.

  "changes": {
        "model_changes": {
          "last_name": [
            "owner",
            "owner Update"
          ],
          "created_at": [
            "2020-06-24T18:23:27Z",
            "2020-06-24T18:23:27Z"
          ],
          "updater_id": [
            null,
            39897
          ]

Are there any possible ways to get the payload?

Please help me out with the above challenge.

Thanks
Anish Karthick S

Hi @kaustavdm ,

Kindly give us an update on the above query. It would help us take this forward?

Looking forward to hearing from you.

Hi @kaustavdm,

Good Day!

Are there any updates regarding the same?

Thanks.

-Anish

Hi @kaustavdm,

Can you please help me out with this issue?

Since the topic was created a week ago.

Till I didn’t even get any first response.

Kind Regards,
Anish S

Hi @Anish ,

Good day!

Sorry for the delay in response. Aren’t you getting the changes payload in your response itself (or) some parts that you’re expecting is not returned properly?

Can you share more details on this for us to debug better? If you can share the app zip privately also would help. Let me know how you’d like to proceed.

Thanks

@Anish,
currently, in the product events payload, it is not possible to get the modal changes and you will get the entire payload with the updated values only.

Hope it helps

Thanks

Hi @mariappan,

Sure please find the below attached logs and the snippet I used.

Server.js

exports = {
  onContactUpdateCallback: function (args) {
    console.log(
      "-=======================lifecycle_stage_id==============================-"
    );
    console.log(JSON.stringify(args.data.contact.lifecycle_stage_id));

    console.log(
      "-===========================changes==========================-"
    );
    console.log(JSON.stringify(args.data.contact));

    console.log(
      "-===========================changes==========================-"
    );
    console.log(JSON.stringify(args.data.contact.changes));

    Object.keys(args.data.contact).filter((k) => {
      if (k === "changes") {
        console.log("check changes1>>>", args.data.contact[k]);
      }

      if (k.includes("cha")) console.log("check changes2>>>", k);
    });
  },
};

Logs

Time Id Message
8 Nov 2022, 11:12:32 fa2d5 -=======================lifecycle_stage_id==============================-
8 Nov 2022, 11:12:33 fa2d5 {“label”:“Lifecycle stage”,“type”:“dropdown”,“value”:71013675515}
8 Nov 2022, 11:12:33 fa2d5 -===========================changes==========================-
8 Nov 2022, 11:12:33 fa2d5 {“first_name”:{“label”:“First name”,“type”:“text”,“value”:“10”},“last_name”:{“label”:“Last name”,“type”:“text”,“value”:“11”},“owner_id”:{“label”:“Sales owner”,“type”:“dropdown”,“value”:70000113309},“recent_note”:{“label”:“Recent note”,“type”:“paragraph”,“value”:null},“tags”:{“label”:“Tags”,“type”:“auto_complete”,“value”:[{“id”:70000162303,“name”:“Tag31”,“created_at”:“2022-11-07T07:45:17Z”,“updated_at”:“2022-11-07T07:45:17Z”,“is_public”:true,“creator_id”:70000113309,“tag_type_id”:1,“is_system_tag”:false,“_association_id”:70016341667}]},“job_title”:{“label”:“Job title”,“type”:“text”,“value”:“CTO”},“emails”:{“label”:“Emails”,“type”:“group_field”,“value”:[{“id":70049815260,“contact_id”:70058699027,“email”:"10@99.com”,“is_primary”:true,“created_at”:“2022-11-07T07:45:17Z”,“updated_at”:“2022-11-07T07:45:17Z”,“unsubscribe”:false,“email_status”:1,“label_id”:null}]},“work_number”:{“label”:“Work”,“type”:“phone_number”,“value”:“+14731608271”},“mobile_number”:{“label”:“Mobile”,“type”:“phone_number”,“value”:“+19265559515”},“contact_status_id”:{“label”:“Status”,“type”:“dropdown”,“value”:70000787055},“country”:{“label”:“Country”,“type”:“text”,“value”:“ID”},“time_zone”:{“label”:“Time zone”,“type”:“dropdown”,“value”:“83309”},“address”:{“label”:“Address”,“type”:“text”,“value”:“Tag16”},“city”:{“label”:“City”,“type”:“text”,“value”:“Tag17”},“state”:{“label”:“State”,“type”:“text”,“value”:“9351 Circle St.”},“zipcode”:{“label”:“Zipcode”,“type”:“text”,“value”:“Twin Falls”},“do_not_disturb”:false,“linkedin”:{“label”:“LinkedIn”,“type”:“text”,“value”:“jane-doe”},“territory_id”:{“label”:“Territory”,“type”:“dropdown”,“value”:null},“lead_source_id”:{“label”:“Source”,“type”:“dropdown”,“value”:null},“facebook”:{“label”:“Facebook”,“type”:“text”,“value”:“Blog”},“twitter”:{“label”:“Twitter”,“type”:“text”,“value”:“B2C”},“campaign_id”:{“label”:“Campaign”,“type”:“dropdown”,“value”:null},“medium”:{“label”:“Medium”,“type”:“text”,“value”:“(GMT-7:00) Arizona”},“keyword”:{“label”:“Keyword”,“type”:“text”,“value”:“Referral”},“last_contacted”:{“label”:"Last co

Show less|
|8 Nov 2022, 11:12:33|fa2d5|-===========================changes==========================-|
|8 Nov 2022, 11:12:33|fa2d5|undefined|
|8 Nov 2022, 11:12:33|fa2d5|check changes2>>> last_seen_chat|
|8 Nov 2022, 11:12:33|fa2d5|check changes2>>> first_seen_chat|

Hi @Santhosh,

As you said we can get the updated data but not which field is updated.

But in the documentation, we found that we can get changes in the attribute which gives the |Updated field values.

Reference : https://developers.freshworks.com/crm/docs/product-events/#oncontactupdate

ATTRIBUTE DATA TYPE DESCRIPTION
actor actor object Details of the entity that triggered the onContactUpdate event.
contact contact object Details of the contact object.
associations associations object Associated objects related to the contact object.
changes object Updated field values.

Thanks

Hi @Anish ,

I can see from your logs args.data.contact.changes logged as undefined. Hope your query is about the same. But, when I tried to reproduce the same in my local simulating contactUpdate event & the above server.js able to get values as expected.

Attaching the zip for your reference. Check if it helps by any means.
product-events.zip (2.4 KB)

We have no issue in Local. When we published the application as a custom app. We can’t able to locate the changes value as per the documentation.

Hi @mariappan,

is there any information required from our end?

If not kindly update regarding the same.

Thanks.

Hi @Anish ,

I was able to reproduce the same in published state. As Santhosh mentioned earlier in this conversation not sure if the support to get modal changes in payload is available completely & if doc has any mismatch regards the same. Let me check this with our devrels and confirm on it.
cc: @Raviraj @Saif

Sure @mariappan,

Awaiting your response.

Thanks

Hi @mariappan,

Kindly please update us regarding the same as we are stuck in a use case to move forward.

Once we got a solution we can proceed further, please expedite the process.

Thanks

Hi @Anish ,

I’ve escalated the discussion with our team again today. Will keep you posted as soon as I get update. Meanwhile, can you please share details on the usecase you’re trying to achieve with this changes object from the payload? Will see if there is any quick way to deal with the same in case if this is getting longer than expected.

Thanks

Yeah, sure, we need to sync the contact details to a product where it would be a two-way sync.
So it would be helpful if we get the updated contact fields to update the same on the other side.

Hi @Anish ,

Got it. Since you’re getting the updated data anyway, check if you can deal this with simple client side comparison against the previous value something like,

Object.keys(a).filter( key => a[key] !== b[key] )

But, I’ll make sure to follow up with the team & keep you posted on further updates in this space as soon as I get one.

Thanks

Sure @mariappan,

Will check with these and get back to you.

And also, please help me out with the exact solution.

Thanks.

Hi @mariappan ,

Gentle Reminder!!

Did you get any update regarding the same?