Suggest best practice to save 3rd party webhook requests timestamp details with in AEM 6.5 to avoid older request from processing. | Community
Skip to main content
Level 4
August 13, 2024
Solved

Suggest best practice to save 3rd party webhook requests timestamp details with in AEM 6.5 to avoid older request from processing.

  • August 13, 2024
  • 1 reply
  • 1072 views

Hi All,

 

I have an use case where a 3rd party system make a post call to AEM author and post a payload (this is webhook scenario).

Based on the timestamp of the request, I should ignore older requests.

For this I’m thinking to store under /content to verify timestamp like below,

/content/abc/en

                      /webhooks

                        /webhook-id

                         -timestamp - Date - <time stamp value>

 

So that, whenever requests comes in, i can fetch respective node and compare timestamps.

If that is latest one process the request & update the timestamp.

If that is older than existed timestamp will ignore.

 

Please suggest me the best practice in this case.

 

Thanks,

Raju.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by arunpatidar

Hi @arunpatidar ,

 

Thanks for the explanation.

But i still didn't get the point of storing webhook request timestamp in each article page instead in webhook id page (as i mentioned above).

  • I have limited webhooks vs numerous article pages.
  • And the timestamp is belongs to webhook but not page, technically.

 

Thanks,

Raju.

 


Hi @rajumuddana 
Creating a page solely for storing data is not the optimal solution; instead, you can create nodes under `/var`.

1 reply

arunpatidar
Community Advisor
Community Advisor
August 13, 2024

Hi @rajumuddana 

It depends on what webhook/request payload used for

  • Content-related payload: If the payload affects the creation or update of content, pages, or assets, it's appropriate to store the timestamp directly as a property(e.g. webhook-sync-timestamp) in the related content node (e.g., under /content/abc/en).
  • Non-content-related payload: If the payload is not directly related to content, storing timestamps and other webhook-related data under /var is more appropriate. The /var directory is designed for storing system-related or process-related data that isn’t directly tied to the content hierarchy. Example/var/webhooks/abc/en/webhook-id - timestamp - Date - <time stamp value> ​
Arun Patidar
Level 4
August 13, 2024

Hi @arunpatidar ,

 

Thanks for the response.

Yes, it is related to Content. I'm attaching sequence diagram for better understanding. Please take a look.

 

arunpatidar
Community Advisor
Community Advisor
August 13, 2024

Hi @rajumuddana 
If you are not getting many events to Author within a time period then you can add timestamp in the Article page properties.

The only drawback I can see with storing this data in page properties if you are running too many/frequent queries for filtering out outdated pages.

However If you are already running a query to find out pages based on article id then adding timestamp in the query will optimize this.

Arun Patidar