Payload
Codex webhooks perform Rest API calls with JSON payload for events that happened related with Content. You can specify different type of HTTP methods to perform in external APIs, but the most common one is POST method with JSON payload. The schema of the body payload contains a set of common fields to give you the context about the webhook and the content body itself. The common fields included in the schema are the event, the model, the organization and the object that triggered the webhook.
{
"event": "insert",
"model": "recipe",
"organization":"codex",
"object": {
//objects body
}
}
Custom Payload
Modifying the JSON request body is accomplished by choosing the 'Compute - Add JSON value' option. You need to provide key-value string pairs, where the key can be any descriptive text for the value, while the value must correspond to a pointer in the default structure. To illustrate, let's consider a scenario where we want to send only the 'Id' property:
{
"Id":"/object/id"
}
Entry webhooks
You can create webhooks about entry events depending on what actions users perform in Codex Admin or Codex API. Entry events can be
Event | Description |
---|---|
Insert | Is fired when the entry has been inserted/created for the first time |
AutoSave | Is fired when the Draft entry has been auto saved in Codex admin |
Delete | Is fired when the entry has been deleted |
Publish | Is fired when the entry has been published |
Update | Is fired when the Published entry has been auto saved in Codex admin |
Unpublish | Is fired when the entry has been unpublished |
Schedule | Is fired when the entry has been scheduled to be published |
Unschedule | Is fired when the entry has been unscheduled |
Archive | Is fired when the entry has been archived |
Entry webhook payload
The payload schema for entry events is a JSON object containing a set of common fields and the entry fields itself. Let's take the previous example for rescipe model created in Codex:
{
"alias": "recipe",
"fields": [
{
"alias": "title",
"type": "text",
"valueType": "single"
},
{
"alias": "timeToCook",
"type": "number",
"valueType": "single"
},
{
"alias": "tags",
"type": "text",
"valueType": "list"
},
{
"alias": "restaurant",
"type": "reference",
"valueType": "list"
},
{
"alias": "image",
"type": "media",
"valueType": "single"
},
{
"alias": "parameters",
"type": "json",
"valueType": "single"
}
]
}
If you have configured a webhook for the recipe model to be fired when you publish an entry of recipe, the following payload will be sent to the configured external API:
{
"event": "publish",
"model": "recipe",
"organization":"codex",
"object": {
"id": "ce9NGrW6Tl",
"system": {
"siteId": "sifew8mzek",
"modelId": "mli12mDBNW",
"modelAlias": "recipe",
"externalId": "",
"status": 3,
"createdAt": "2022-09-20T09:22:04.545Z",
"updatedAt": "2022-09-25T15:40:42.394Z",
"publishedAt": "0001-01-01T00:00:00Z",
"firstPublishedAt": "0001-01-01T00:00:00",
"unpublishedAt": null,
"createdBy": "e92ed2f5-a792-429c-a97d-a278f1123c61",
"updatedBy": "e92ed2f5-a792-429c-a97d-a278f1123c61",
"versionId": "ve2038226b",
"revisionId": "re2436226b",
"title": "My first recipe",
"slug": "my-first-slug",
"labels": [],
"metrics": {
"wordCount": 0,
"characterCount": 0,
"sentenceCount": 0,
"imageCount": 0,
"readingTime": 0
},
"featuredMedia": {
"id": "asOM9vpcNaa25I1AK"
}
},
"content": {
"title": "My first recipe",
"timeToCook": 30,
"healthy": true,
"tags": [
"healthy",
"recipe",
"homemade"
],
"restaurant": [
{
"entryId": "me7p9EqyiC",
"model": "restaurant"
}
],
"image": null,
"parameters": null
},
"attrs": {}
}
}
Lists webhooks
You can create webhooks about lists events depending on what actions users perform in Codex Admin or Codex API. Lists events can be
Event | Description |
---|---|
Insert | Is fired when the list has been inserted |
Update | Is fired when the list has been updated |
Delete | Is fired when the list has been deleted |
Lists webhook payload
The payload schema for lists events is a JSON object containing a set of common fields and the lists fields and objects itself. For this particular webhook type the 'model' field always contains the value 'list'. If you have configured a webhook to be fired when you update a list, the following payload will be sent to the configured external API:
{
"event": "update",
"model": "list",
"organization":"codex",
"object": {
"id": "eluPCiK5Lf",
"alias":"mylist",
"externalId": "",
"name": "My list",
"normalizedName": "MY LIST",
"description": "This is a list for the homepage ",
"siteId": "si3j1dNlSQ",
"entries": [
{
"entryId": "ceZD0GkiFD",
"model": "bug45995",
"startAt": "2022-12-30T14:00:00",
"endAt": "2022-12-23T13:00:00"
},
{
"entryId": "ceErNOqYN8",
"model": "petmodel",
"startAt": null,
"endAt": null
},
{
"entryId": "ce5OHnVjrQ",
"model": "jetlira",
"startAt": "2022-12-29T14:12:00Z",
"endAt": "2022-12-24T15:14:00Z"
}
],
"status": 1,
"createdAt": "2022-12-23T11:52:30.412Z",
"updatedAt": "2022-12-23T12:59:56.8028659Z",
"createdBy": "0b04dc3b-d91d-4c63-bfe9-5f8d308538dd",
"updatedBy": "0b04dc3b-d91d-4c63-bfe9-5f8d308538dd"
}
}
Media webhooks
You can create webhooks about assets events depending on what actions users perform in Codex Admin or Codex API. Assets events can be
Event | Description |
---|---|
Upload | Is fired when the asset has been uploaded |
Update | Is fired when the asset has been updated |
Delete | Is fired when the asset has been deleted |
Media webhook payload
The payload schema for assets events is a JSON object containing a set of common fields and the assets fields and objects itself. For this specific webhook type, the 'model' field contains one of these values, depending on the type of asset that triggers the event:
Model value |
---|
image |
file |
video |
videoplaylist |
audio |
podcast |
If you have configured a webhook to be fired when you update an image asset, the following payload will be sent to the configured external API:
{
"event": "upload",
"model": "image",
"organization":"codex",
"object": {
"id": "as23vpKT8c0BqOMBm",
"externalId": "",
"contentType": "image/png",
"fileName": "my-first-image.png",
"path": "assets/as23vpKT8c0BqOMBm.png",
"compressedPath": null,
"title": "My first image",
"caption": "This is an image about cars",
"alt": null,
"author": null,
"source": null,
"copyright":null,
"size": 27968,
"width": 512,
"height": 512,
"tags": [],
"folderId": "flrOQ4cnR5",
"storageId": "stcTTSogiX",
"provider": "codex",
"duration": 0,
"focalPoint":null,
"attrs": {},
"status": 1,
"type": 1,
"expiresAt": null,
"createdAt": "2022-12-23T14:44:33.876806Z",
"updatedAt": null,
"createdBy": "0b04dc3b-d91d-4c63-bfe9-5f8d308538dd",
"updatedBy": null
}
}
Authors webhooks
You can create webhooks about authors events depending on what actions users perform in Codex Admin or Codex API. Authors events can be
Event | Description |
---|---|
Insert | Is fired when the author has been inserted |
Update | Is fired when the author has been updated |
Delete | Is fired when the author has been deleted |
Authors webhook payload
The payload schema for authors events is a JSON object containing a set of common fields and the authors fields and objects itself. For this particular webhook type the 'model' field always contains the value 'author'. If you have configured a webhook to be fired when you update an author, the following payload will be sent to the configured external API:
{
"event": "insert",
"model": "author",
"organization":"codex",
"object": {
"id": "atNmAq5Flk",
"userId": null,
"externalId": "",
"byline": "Author byline",
"firstName": "James",
"lastName": "Smith",
"url": "/james-smith",
"imageId": "as23vpKT8c0BqOMBm",
"status": 1,
"biography": "The biography of the author",
"profession": [],
"email": "james@codex.com",
"website": null,
"facebook": "https://www.faceboom.com/jamessmith",
"instagram": "https://www.instagram.com/jamessmith",
"twitter": null,
"linkedin": null,
"telegram": null,
"tiktok": null,
"createdAt": "2022-12-23T12:03:28.3016783Z",
"updatedAt": null,
"createdBy": "f8e82b19-38c3-49fd-8455-92c049dc7a8e",
"updatedBy": null
}
}
Section webhooks
You can create webhooks about section events depending on what actions users perform in Codex Admin or Codex API. Section events can be:
Event | Description |
---|---|
Insert | Is fired when the section has been inserted |
Update | Is fired when the section has been updated |
Delete | Is fired when the section has been deleted |
Section webhook payload
The payload schema for entry events is a JSON object containing a set of common fields and the section fields itself. For this particular webhook type the 'model' field always contains the value 'section'. If you have configured a webhook to be fired when you insert a section, the following payload will be sent to the configured external API:
{
"event": "insert",
"model": "section",
"organization":"codex",
"object": {
"id": "seWS9narO5",
"externalId": null,
"parentId": null,
"parentName":null,
"title": "Test",
"titleSlug":"test",
"normalizedTitle":"TEST",
"slug": "test",
"url": "/section/seWS9narO5",
"siteId": "sifew8mzek",
"status": 1,
"media":[
{
"id":"as5vI6BFtRVDrq6m3",
"type":1,
"caption":null
}
],
"description":"Test section",
"references":[],
"path":[
"seWS9narO5"
]
"createdAt": "2022-08-26T07:36:22.297Z",
"updatedAt": "2022-09-21T11:44:07.591Z"
}
}
Url webhooks
You can create webhooks about url events depending on users' actions in Codex Admin or Codex API. Url events can be:
Event | Description |
---|---|
Insert | Is fired when the url has been inserted |
Update | Is fired when the url has been updated |
Url webhook payload
The payload schema for url events is a JSON object containing a set of common fields and the url fields itself. In the case of this specific webhook type, the 'model' field consistently holds either 'entry' or 'section' as its value, depending on the entity associated with the URL. If you have configured a webhook to be fired when you insert a url, the following payload will be sent to the configured external API:
{
"event": "insert",
"model": "entry",
"organization":"codex",
"object": {
"entityType": 1,
"level": 1,
"status": 1,
"siteId": "sifew8mzek",
"model": "urlmodel",
"entityId": "ce6nquOGVn",
"fieldAlias": "url",
"url": "/test",
"isCustom": false,
"statusCode": 0,
"redirectUrl": null,
"id": "urBYDhVi3m",
"createdAt": "2023-08-16T11:09:38.3052857Z",
"updatedAt": null,
"createdBy": "e92ed2f5-a792-429c-a97d-a278f1123c61",
"updatedBy": null
}
}
Tag webhooks
You can create webhooks about tag events depending on users' actions in Codex Admin or Codex API. Tag events can be:
Event | Description |
---|---|
Insert | Is fired when the tag has been inserted |
Update | Is fired when the tag has been updated |
Delete | Is fired when the tag has been deleted |
Tag webhook payload
The payload schema for tag events is a JSON object containing a set of common fields and the tag fields itself. For this particular webhook type the 'model' field always contains the value 'tag'. If you have configured a webhook to be fired when you insert a tag, the following payload will be sent to the configured external API:
{
"event": "insert",
"model": "tag",
"organization":"codex",
"object": {
"siteId": "sifew8mzek",
"parentId": "tgDlzoDBD5",
"externalId": null,
"tagValue": "tag2",
"tagAlias": "tag1/tag2",
"path": [
"tgDlzoDBD5",
"tgnavLJ6Z5"
],
"source": 0,
"status": 1,
"description": null,
"references": null,
"id": "tgnavLJ6Z5",
"createdAt": "2023-08-10T13:23:51.6378447Z",
"updatedAt": null,
"createdBy": "e92ed2f5-a792-429c-a97d-a278f1123c61",
"updatedBy": null
}
}
Label webhooks
You can create webhooks about label events depending on users' actions in Codex Admin or Codex API. Label events can be:
Event | Description |
---|---|
Label Added | Is fired when the label has been added to an entry |
Label Removed | Is fired when the label has been removed from an entry |
Label webhook payload
The payload schema for label events is a JSON object that includes a set of entry fields associated with the label, along with the label ID. For this particular webhook type the 'model' field always contains the value 'entry'. If you have configured a webhook to be fired when you add a label, the following payload will be sent to the configured external API:
{
"organization": "codex-dev",
"event": "insert",
"model": "entry",
"object": {
"id": "lbGrAOJppS",
"entityId": "ceCf0002a8",
"type": 2,
"siteId": "sifew8mzek",
"modelId": "mli12mDBNW",
"modelAlias": "recipe"
}
}
Job webhooks
You can create webhooks about job events depending on users' actions in Codex Admin or Codex API. Job events can be:
Event | Description |
---|---|
Completed | Is fired when the job has been completed successfully |
Failed | Is fired when the job has failed |
Job webhook payload
The payload schema for job events is a JSON object containing a set of common fields and the job fields itself. For this particular webhook type the 'model' field contains the job name. If you have configured a webhook to be fired when a job is completed successfully, the following payload will be sent to the configured external API:
{
"organization": "codex-dev",
"event": "completed",
"model": "importentries",
"object": {
"name": "test import entry",
"fileKey": "imports/importEntriesFile_638578000007040387.json",
"type": 2,
"jobSummary": {
"totalLogs": 0,
"totalErrors": 0,
"totalWarnings": 0,
"totalFails": 0,
"elapsedTime": "00:00:13.9186104",
"startedAt": "2024-07-29T07:46:28.418Z"
},
"id": "jbwEAN00SP",
"createdAt": "2024-07-29T07:46:28.418Z",
"updatedAt": "2024-07-29T07:46:42.3366104Z",
"createdBy": "e92ed2f5-a792-429c-a97d-a278f1123c61",
"updatedBy": null
}
}