Webhooks

Located at DrEdition: "Settings" -> "Webhooks".

You can register webhooks, and you may decide under what circumstances it will be called, as listed below.

Webhook can be added as default for all products, or it can be added to single/many products. Go to edit product page to enable it for an individual product.

You should respond with a 2xx status on the webhook's POST request, or you will see repeated requests from DrEdition.

Publish

Used for product types 'frontpage' and 'magazine'.

Payload:

{
"data": {
"product": {
"id": "{productId}",
"name": "{productName}",
"productType": "{productType}"
},
"edition": {
"id": "{editionId}",
"name": "{editionName}"
"renderedLayout": {
"css": "https://smooth-storage.aptoma.no/users/user/files/edition-layouts/edition-id/2017/05/15/HJ735WvxZ/styles.css",
"html": "https://smooth-storage.aptoma.no/users/user/files/edition-layouts/edition-id/2017/05/15/HJ735WvxZ/layout.html"
}
}
}
}

Print Page Send to Print

When you press "Approve & Send to print" on a page in product type 'print', this event will be triggered.

The payload contains an array of pages along with associated metadata about the publisher and the edition.

{
"data": {
"product": {
"_id": "5cadd11c86893774bbaeccfb",
"name": "dn-dn-print-automation"
},
"edition": {
"_id": "5e130e957ed0ab7395dec896",
"publishDate": "2020-01-20T10:40:02.222Z",
"data": {}
},
"pages": [
{
"_id": "5e1c5299737c6941554334aa",
"number": 1,
"pdfImageUrl": "https://...",
"pdfUrl": "https://...",
"properties": {
"section": "News",
"folioStyle": "Normal"
}
}
],
"issuedBy": {
"user": {
"id": "595bae459d6f165fedcc6dd6",
"name": "Test Person",
"email": "person@test.com"
}
}
}
}

The number property tells you the page number, which start at 1.

Print Edition Archive

When "Archive edition" is pressed, this event will be triggered.

The archive payload is organized into three major groups:

{
"data": {
"edition": {
"items": {...},
"objects": {...},
"pages": {...}
}
}
}

First, the items object contains information about each piece of content in the edition, this includes anything from articles to ads.

{
"data": {
"edition": {
"items": {
"5e206a059298100fe8b7b0c8": {
"sourceId": "738793",
"title": "Test",
"imageUrl": "https://...",
"data": {
"intendedPrintDate": "2020-01-20T00:00:00.000+01:00",
"page": "5",
"topic": "News"
},
"contentSchema": {
"id": "5caafa3cb27ceb338c10edc8",
"version": 2
},
"sourceName": "drpublish",
"_id": "5e206a059298100fe8b7b0c8"
}
}
}
}
}

In the above example, the item is an article from DrPublish. Different content sources may place different metadata along with their items when they are imported into an edition.

The objects object contains information about the placement of items in an edition. There may be multiple objects for each item, if an item has been used more than once.

{
"data": {
"edition": {
"objects": {
"5e1c52d1ba6ea225da3ac3da": {
"x": 112.5,
"y": 33.814,
"width": 133.5,
"height": 330.624,
"_id": "5e1c52d1ba6ea225da3ac3da",
"type": "article",
"pages": [
"5e1c529aba6ea225da3ac27d"
],
"imageUrl": "https://...",
"itemId": "5e21ab8182a8a954c2111328"
}
}
}
}
}

The itemId property can be used to find the corresponding item in the itemobject. The pages array contains a list of the pages this object is placed on.

The pages object contains information about each page in the edition, along with metadata such as page number and a link to the finished PDF.

{
"data": {
"edition": {
"pages": {
"5e1c529aba6ea225da3ac27d": {
"_id": "5e1c529aba6ea225da3ac27d",
"title": "Test",
"objects": [
"5e1c52d1ba6ea225da3ac3d9",
"5e1c52d1ba6ea225da3ac3da",
"5e1c52d1ba6ea225da3ac3db",
"5e1c52d1ba6ea225da3ac3dc"
],
"properties": {
"section": "News",
"folioStyle": "Normal"
},
"number": 2,
"pdfStatus": "completed",
"pdfImageUrl": "https://...",
"pdfUrl": "https://...",
"deliveryStatus": "completed"
}
}
}
}
}

The objects property contain links back to the objects placed on this page. The objects in turn contain references back to the items they represent.

Finally, the archive payload also contains assorted metadata about the edition itself:

{
"data": {
"edition": {
"_id": "5e20407c9298100fe8b69b9a",
"items": {},
"objects": {},
"pages": {},
"pageOrder": [
"5e20408282a8a954c20bf1f6",
"..."
],
"name": "avis-mandag-20--januar",
"title": "Avis mandag 20. januar",
"publishDate": "2020-01-20T10:52:02.865Z",
"data": {
"week": "Uke 4",
"issue": "Nr. 16",
"volume": "1. årgang",
"price": "Kr 20,-",
"homepage": "www.test.no",
"issueNumber": 16
},
"objectUnit": "mm",
"margin": {
"top": 20.3,
"bottom": 12.675,
"inside": 16,
"outside": 16,
"unit": "mm"
},
"dimension": {
"height": 398,
"width": 278,
"unit": "mm"
},
"createdAt": "2020-01-16T10:52:44.520Z",
"updatedAt": "2020-01-19T20:19:37.323Z",
"lastChangedBy": {
"user": {
"id": "5922c8c0ad4bf90704bd5b80",
"name": "Jørgen Dahl Kristensen",
"email": "Jorgen.DahlKristensen@budstikka.no"
}
},
"archivedAt": "2020-01-19T20:19:37.323Z"
}
}
}