Work with events from Bluestone PIM

Bluestone PIM can post messages/notifications to a given external URL. This is called a webhook. Webhooks are managed under settings in Bluestone PIM IU or External Notifications API.


Order      Delivery      Create a webhook   Find webhook ID   Subscribe to events



Order

Messages are not guaranteed to be in the correct order. A product-created message is likely sent before the product updated message, but it is not guaranteed.

If the order of events are critical, it is recommended not to use data from the message directly. Instead, it should be treated as a signal that something has changed. Use API calls to origin to get the latest information.

Link: https://bluestonepim.readme.io

Password: Contact us on the chat, and we will send you the password. 



Delivery

If the subscriber is unavailable at the moment of delivery, the message might be retried later. This depends on the response status.

  • If the status code is 503 or 429, the time to wait will be decided by looking at the "Retry-After" header in the response. If this header is missing, the delivery will not be retried.
  • If the status code is 401 or 403, the delivery will not be retried.
  • For all other status codes, the delivery will be retried two times with a ten minute interval.

If the total number of failed delivery attempts for a webhook exceeds a certain threshold, the webhook will be blocked for a while. The threshold and the blocking time can vary between environments.

A log of messages, including the content of the message and the response from subscriber, is available in Get messages endpoint. It is also possible to filter on the message status, SENT or ERROR for example.


Back to the top


Create a webhook

https://bluestonepim.readme.io/reference#create-2

Parameter: url
Description: The URL that receives the message. This will always be an HTTP(s) POST. Use http://webhook.site/ to test
Example value: http://webhook.site/6e124229-d797-4551-8451-d2fb0f21b10a


Parameter: active
Description: Messages will not be posted to webhook if inactive
Example value: true


Parameter: active
Description: A password made by a subscriber. It can be used to validate that the message is legitimate. All messages will be signed with a SHA256 hash based on the request payload and this secret. This signature will be included in the request header x-bs-signature. 

Use https://www.freeformatter.com/hmac-generator.html and select SHA256 to see how this works.


Example value: LongAndSecretPassword

Back to the top


Find webhook ID

https://bluestonepim.readme.io/reference#search-1

Get a list of webhooks for organizations and find the ID.


Subscribe to events

https://bluestonepim.readme.io/reference#subscribe

Subscribe to events of interest. 

Name: webhookId
Description: Id of webhook
Example:
5df0ca49cff47e000df7809c

Name: eventTypes
Description: List of events to listen for. Comma-separated list of strings. 
Example:

{

  "eventTypes": [

    "PRODUCT_CREATED",

    "PRODUCT_SYNC_DONE"

  ]

}


Go to event types page to see a complete list and examples.

 


Back to the top