We've heard your feedback and understand the frustration of not having, for example, alphanumeric Model IDs included in webhook updates about records.
It makes it difficult to identify the model involved, forces you to make additional API calls, slows down the response.. well worry not, because we have a solution! Please welcome Enhanced Webhook Payloads.
DatoCMS now includes a new key called "related_entities"
in the payload of all webhooks. This key contains an array of all the entities that are linked to the main entity (that is, the one that triggers the event itself).
As an example, let's see the new webhook payload sent for a "record update" event:
{"environment": "foo-bar","entity_type": "item","event_type": "update","entity": { "type": "item", "id": "348295724", ... },"previous_entity": { "type": "item", "id": "348295724", ... },"related_entities": [{ "type": "item_type", "id": "7690234", ... },{ "type": "user", "id": "69003345", ... },],}
Since the Record entity offers relationships with its model and its creator, both objects will be fully included in the webhook payload. This makes it really easy to consume them, and for example, extract the information about the Model ID.
In the case of webhook events caused by changes in Models, the number of related entities will be far larger, as the Model entity offers relationships with all of its fields, fieldsets, etc. Again, very useful data when you need to interact with a model!
We want DatoCMS to be simple and just work©, so we won't be adding any options to enable this behavior. Enhanced Webhook Payloads is already available to everyone, by default.
We hope this new feature saves you time and makes your workflow smoother. Happy coding!