webhook_v3_post_didUpdate - data needed before and after change

Hi,

I’m listening to the Amity webhook which informs my application of a new community post being created. Here are your docs:

https://api-docs.amity.co/#/WebhookEvent/get_webhook_v3_post_didCreate

Note that response.data.posts[0] object includes a “mentionees” array. This is great as I can see if anyone was mentioned in the post.

In my use case I now send an email to anyone mentioned in the post.

Now imagine the case where the original user who created the post makes an edit to the post and changes the mentionees (for example, they want to mention a second person). They edit the post, mention a second person and save the post.

Now, I’m also listening to the webhook for notification of a post update: Amity API

Note that the data structure for mentionees is the same, so I now get an array of two mentionees. Here’s the problem…

I don’t want to send another email to the original mentionee (that’s spammy). I only want to send an email to the second mentionee. To do this, either I need a before and after change snapshot of the data so that I can compare the two mentionee arrays and run some simple logic to decide if an email is needed.

Most services send before and after change data in an “update” type event. Can you suggest something I am missing or perhaps update your API to handle use cases like mine?

Thanks

Hello @ham we would recommend you to store original mentionee on your system, then compare with the mentionee after editing post, does this sound ok to you? pls do share if you have any concerns :))

Thanks @SocialPlus_Support I did think about this as an option. I can definitely do it this way, but it is far from ideal.

My database would expand rapidly in size (which costs me significantly).

I’m paying Amity fees (which are significant already) so really, this kind of feature (change before & change after in event data) should be handled on the Amity side.

Thanks

Hi @ham thank you for your honest feedback, I will pass your concern to our team and submit it as a feature request.

1 Like