Crm · Mailings
Send a message
Creates a message mailing as an email or a letter to the selected contacts or shared contacts and starts preparing its recipients at once. A message to one contact type offers the fields of that type, a message to several types only the fields common to every contact type.
Permissions
Send an API key of the organization in the path, using the X-API-Key header.
Permission checks in detail
Required permissions
dispatchDocument.insertmandate.read
Also checked, depending on the request and the records it touches
contact:member.readcontact:address.readcontact:customer.readcontact:sponsor.readcontact:contributor.readcontact:employee.readcontact:supplier.read
Request
Path parameters
-
organizationIdidrequired -
mandateIdidrequired
Body
Content-Type: application/json
-
contactTypestringnullablememberaddresscustomersponsorcontributoremployeesupplier -
textContentobjectrequired2 properties
-
destringrequiredat most 10000 characters
-
enstringrequiredat most 10000 characters
-
-
emailobjectrequirednullable6 properties
-
subjectobjectrequired2 properties
-
destringrequiredat most 998 characters
-
enstringrequiredat most 998 characters
-
-
sendToAlternativeCommunicationsbooleanrequired -
avoidDuplicateEmailsbooleandefault
false -
trackingbooleandefault
true -
replyTostringrequired -
attachmentsobject[]default
[]3 properties
-
fileNamestringat most 128 characters
-
resourcestringrequired -
idstringexactly 6 characters
-
-
-
templateContentsobjectnullable -
letterobjectrequirednullable2 properties
-
sendColorPostalbooleanrequired -
sendWithCheaperMethodbooleanrequired
-
-
recipientsobjectrequired
curl --fail-with-body --silent --show-error --max-time 30 --globoff \
--request POST 'https://cloud.campai.com/api/YOUR_ORGANIZATION_ID/YOUR_MANDATE_ID/crm/mailings/messages/send' \
--header 'X-API-Key: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"templateContents": {
"version": 1,
"channel": "paper",
"container": {
"type": "container",
"id": "letter",
"repeat": null,
"pageSize": {
"width": 210,
"height": 297,
"landscape": false
},
"fontFamily": "Inter",
"items": [
{
"id": "page",
"name": "",
"hidden": false,
"locked": false,
"condition": null,
"type": "page",
"repeat": null,
"margin": [
45,
10,
20,
25
],
"background": {
"backgroundColor": {
"color": "#FFFFFF",
"hide": true
},
"backgroundGradient": {
"hide": true,
"stops": [
{
"color": "#000000",
"position": 0
},
{
"color": "#FFFFFF",
"position": 100
}
],
"angle": 90
},
"backgroundImage": {
"hide": true,
"image": null,
"size": "cover",
"position": "middle center"
}
},
"foldingMarks": [
{
"top": 105,
"left": 5,
"width": 3
},
{
"top": 148.5,
"left": 5,
"width": 6
},
{
"top": 210,
"left": 5,
"width": 3
}
],
"items": [
{
"id": "header",
"name": "",
"hidden": false,
"locked": false,
"condition": null,
"margin": [
10,
10,
0,
25
],
"padding": [
0,
0,
0,
0
],
"radius": 0,
"background": {
"backgroundColor": {
"color": "#FFFFFF",
"hide": true
},
"backgroundGradient": {
"hide": true,
"stops": [
{
"color": "#000000",
"position": 0
},
{
"color": "#FFFFFF",
"position": 100
}
],
"angle": 90
},
"backgroundImage": {
"hide": true,
"image": null,
"size": "cover",
"position": "middle center"
}
},
"border": {
"color": "#000000",
"width": 1,
"style": "solid",
"hide": true
},
"orientation": "vertical",
"placement": "top right",
"gapX": 0,
"gapY": 0,
"type": "pageHeader",
"items": [
{
"id": "logo",
"name": "Logo",
"hidden": true,
"locked": false,
"condition": null,
"margin": [
0,
0,
0,
0
],
"padding": [
0,
0,
0,
0
],
"radius": 4,
"background": {
"backgroundColor": {
"color": "#FFFFFF",
"hide": true
},
"backgroundGradient": {
"hide": true,
"stops": [
{
"color": "#000000",
"position": 0
},
{
"color": "#FFFFFF",
"position": 100
}
],
"angle": 90
},
"backgroundImage": {
"hide": true,
"image": null,
"size": "cover",
"position": "middle center"
}
},
"border": {
"color": "#000000",
"width": 1,
"style": "solid",
"hide": true
},
"type": "image",
"width": {
"value": 20,
"unit": "#"
},
"height": {
"value": 0,
"unit": "#"
},
"image": null,
"alt": {
"mode": "plain",
"values": {
"en": [
{
"kind": "literal",
"value": "Logo"
}
],
"de": [
{
"kind": "literal",
"value": "Logo"
}
]
},
"fallbackLanguage": "en"
},
"link": {
"active": false,
"url": {
"mode": "plain",
"values": {
"en": [
{
"kind": "literal",
"value": ""
}
]
},
"fallbackLanguage": "en"
},
"openInNewTab": true
}
}
]
},
{
"id": "footer",
"name": "",
"hidden": false,
"locked": false,
"condition": null,
"margin": [
0,
10,
10,
25
],
"padding": [
0,
0,
0,
0
],
"radius": 0,
"background": {
"backgroundColor": {
"color": "#FFFFFF",
"hide": true
},
"backgroundGradient": {
"hide": true,
"stops": [
{
"color": "#000000",
"position": 0
},
{
"color": "#FFFFFF",
"position": 100
}
],
"angle": 90
},
"backgroundImage": {
"hide": true,
"image": null,
"size": "cover",
"position": "middle center"
}
},
"border": {
"color": "#000000",
"width": 1,
"style": "solid",
"hide": true
},
"orientation": "vertical",
"placement": "top left",
"gapX": 0,
"gapY": 2,
"type": "pageFooter",
"items": [
{
"id": "footerRule",
"name": "",
"hidden": false,
"locked": false,
"condition": null,
"type": "separator",
"margin": [
0,
0,
0,
0
],
"width": {
"value": 100,
"unit": "%"
},
"align": "left",
"line": {
"color": "#bdbdbd",
"width": 0.2,
"style": "solid"
}
},
{
"id": "footerSender",
"name": "",
"hidden": false,
"locked": false,
"condition": null,
"margin": [
0,
0,
0,
0
],
"padding": [
0,
0,
0,
0
],
"radius": 0,
"background": {
"backgroundColor": {
"color": "#FFFFFF",
"hide": true
},
"backgroundGradient": {
"hide": true,
"stops": [
{
"color": "#000000",
"position": 0
},
{
"color": "#FFFFFF",
"position": 100
}
],
"angle": 90
},
"backgroundImage": {
"hide": true,
"image": null,
"size": "cover",
"position": "middle center"
}
},
"border": {
"color": "#000000",
"width": 1,
"style": "solid",
"hide": true
},
"color": {
"color": "#6b6b6b"
},
"fontWeight": "500",
"fontStyles": [
"uppercase"
],
"type": "text",
"content": {
"mode": "html",
"values": {
"en": [
{
"kind": "value",
"id": "footerSender_en_0",
"expression": {
"variable": "root.letterAddress.sender"
},
"format": null
}
],
"de": [
{
"kind": "value",
"id": "footerSender_de_0",
"expression": {
"variable": "root.letterAddress.sender"
},
"format": null
}
]
},
"fallbackLanguage": "en"
},
"wordBreak": "word",
"textAlign": "center",
"fontSize": 6.5,
"fontFamily": "",
"lineHeight": {
"value": 130,
"unit": "%"
},
"letterSpacing": {
"value": 0.25,
"unit": "#"
},
"width": {
"value": 100,
"unit": "%"
},
"height": {
"value": 0,
"unit": "#"
},
"link": {
"active": false,
"url": {
"mode": "plain",
"values": {
"en": [
{
"kind": "literal",
"value": ""
}
]
},
"fallbackLanguage": "en"
},
"openInNewTab": true
}
}
]
},
{
"id": "addresses",
"name": "",
"hidden": false,
"locked": false,
"condition": null,
"margin": [
0,
0,
0,
0
],
"padding": [
0,
0,
0,
0
],
"radius": 0,
"background": {
"backgroundColor": {
"color": "#FFFFFF",
"hide": true
},
"backgroundGradient": {
"hide": true,
"stops": [
{
"color": "#000000",
"position": 0
},
{
"color": "#FFFFFF",
"position": 100
}
],
"angle": 90
},
"backgroundImage": {
"hide": true,
"image": null,
"size": "cover",
"position": "middle center"
}
},
"border": {
"color": "#000000",
"width": 1,
"style": "solid",
"hide": true
},
"orientation": "vertical",
"placement": "top left",
"gapX": 0,
"gapY": 0,
"type": "section",
"repeat": null,
"height": {
"value": 53.46,
"unit": "#"
},
"items": [
{
"id": "addressGrid",
"name": "",
"hidden": false,
"locked": false,
"condition": null,
"margin": [
0,
0,
0,
0
],
"padding": [
0,
0,
0,
0
],
"radius": 0,
"background": {
"backgroundColor": {
"color": "#FFFFFF",
"hide": true
},
"backgroundGradient": {
"hide": true,
"stops": [
{
"color": "#000000",
"position": 0
},
{
"color": "#FFFFFF",
"position": 100
}
],
"angle": 90
},
"backgroundImage": {
"hide": true,
"image": null,
"size": "cover",
"position": "middle center"
}
},
"border": {
"color": "#000000",
"width": 1,
"style": "solid",
"hide": true
},
"type": "grid",
"width": {
"value": 100,
"unit": "%"
},
"height": {
"value": 45,
"unit": "#"
},
"placement": "top left",
"gapX": 0,
"gapY": 0,
"columns": 2,
"columnsFlex": [
1,
1
],
"items": [
{
"id": "address",
"name": "",
"hidden": false,
"locked": false,
"condition": null,
"margin": [
0,
0,
0,
0
],
"padding": [
0,
0,
0,
0
],
"radius": 0,
"background": {
"backgroundColor": {
"color": "#FFFFFF",
"hide": true
},
"backgroundGradient": {
"hide": true,
"stops": [
{
"color": "#000000",
"position": 0
},
{
"color": "#FFFFFF",
"position": 100
}
],
"angle": 90
},
"backgroundImage": {
"hide": true,
"image": null,
"size": "cover",
"position": "middle center"
}
},
"border": {
"color": "#000000",
"width": 1,
"style": "solid",
"hide": true
},
"orientation": "vertical",
"placement": "inherit",
"gapX": 0,
"gapY": 0,
"type": "gridItem",
"repeat": null,
"items": [
{
"id": "sender",
"name": "",
"hidden": false,
"locked": false,
"condition": null,
"margin": [
0,
0,
0,
0
],
"padding": [
0,
0,
0,
0
],
"radius": 0,
"background": {
"backgroundColor": {
"color": "#FFFFFF",
"hide": true
},
"backgroundGradient": {
"hide": true,
"stops": [
{
"color": "#000000",
"position": 0
},
{
"color": "#FFFFFF",
"position": 100
}
],
"angle": 90
},
"backgroundImage": {
"hide": true,
"image": null,
"size": "cover",
"position": "middle center"
}
},
"border": {
"color": "#000000",
"width": 1,
"style": "solid",
"hide": true
},
"color": {
"color": "#000000"
},
"fontWeight": "400",
"fontStyles": [],
"type": "text",
"content": {
"mode": "html",
"values": {
"en": [
{
"kind": "value",
"id": "sender_en",
"expression": {
"variable": "root.letterAddress.sender"
},
"format": null
}
],
"de": [
{
"kind": "value",
"id": "sender_de",
"expression": {
"variable": "root.letterAddress.sender"
},
"format": null
}
]
},
"fallbackLanguage": "en"
},
"wordBreak": "word",
"textAlign": "left",
"fontSize": 8,
"fontFamily": "",
"lineHeight": {
"value": 0,
"unit": "#"
},
"letterSpacing": {
"value": 0,
"unit": "#"
},
"width": {
"value": 80,
"unit": "#"
},
"height": {
"value": 16.7,
"unit": "#"
},
"link": {
"active": false,
"url": {
"mode": "plain",
"values": {
"en": [
{
"kind": "literal",
"value": ""
}
]
},
"fallbackLanguage": "en"
},
"openInNewTab": true
}
},
{
"id": "receiver",
"name": "",
"hidden": false,
"locked": false,
"condition": null,
"margin": [
0,
0,
0,
0
],
"padding": [
0,
0,
0,
0
],
"radius": 0,
"background": {
"backgroundColor": {
"color": "#FFFFFF",
"hide": true
},
"backgroundGradient": {
"hide": true,
"stops": [
{
"color": "#000000",
"position": 0
},
{
"color": "#FFFFFF",
"position": 100
}
],
"angle": 90
},
"backgroundImage": {
"hide": true,
"image": null,
"size": "cover",
"position": "middle center"
}
},
"border": {
"color": "#000000",
"width": 1,
"style": "solid",
"hide": true
},
"color": {
"color": "#000000"
},
"fontWeight": "400",
"fontStyles": [],
"type": "text",
"content": {
"mode": "plain",
"values": {
"en": [
{
"kind": "value",
"id": "receiver_en",
"expression": {
"variable": "root.letterAddress.receiver"
},
"format": null
}
],
"de": [
{
"kind": "value",
"id": "receiver_de",
"expression": {
"variable": "root.letterAddress.receiver"
},
"format": null
}
]
},
"fallbackLanguage": "en"
},
"wordBreak": "word",
"textAlign": "left",
"fontSize": 10,
"fontFamily": "",
"lineHeight": {
"value": 0,
"unit": "#"
},
"letterSpacing": {
"value": 0,
"unit": "#"
},
"width": {
"value": 80,
"unit": "#"
},
"height": {
"value": 28.3,
"unit": "#"
},
"link": {
"active": false,
"url": {
"mode": "plain",
"values": {
"en": [
{
"kind": "literal",
"value": ""
}
]
},
"fallbackLanguage": "en"
},
"openInNewTab": true
}
}
]
},
{
"id": "details",
"name": "",
"hidden": false,
"locked": false,
"condition": null,
"margin": [
5,
0,
0,
0
],
"padding": [
0,
0,
0,
0
],
"radius": 0,
"background": {
"backgroundColor": {
"color": "#FFFFFF",
"hide": true
},
"backgroundGradient": {
"hide": true,
"stops": [
{
"color": "#000000",
"position": 0
},
{
"color": "#FFFFFF",
"position": 100
}
],
"angle": 90
},
"backgroundImage": {
"hide": true,
"image": null,
"size": "cover",
"position": "middle center"
}
},
"border": {
"color": "#000000",
"width": 1,
"style": "solid",
"hide": true
},
"orientation": "vertical",
"placement": "top right",
"gapX": 0,
"gapY": 0,
"type": "gridItem",
"repeat": null,
"items": []
}
]
}
]
},
{
"id": "body",
"name": "",
"hidden": false,
"locked": false,
"condition": null,
"margin": [
0,
10,
6,
0
],
"padding": [
0,
0,
0,
0
],
"radius": 0,
"background": {
"backgroundColor": {
"color": "#FFFFFF",
"hide": true
},
"backgroundGradient": {
"hide": true,
"stops": [
{
"color": "#000000",
"position": 0
},
{
"color": "#FFFFFF",
"position": 100
}
],
"angle": 90
},
"backgroundImage": {
"hide": true,
"image": null,
"size": "cover",
"position": "middle center"
}
},
"border": {
"color": "#000000",
"width": 1,
"style": "solid",
"hide": true
},
"orientation": "vertical",
"placement": "top left",
"gapX": 0,
"gapY": 0,
"type": "section",
"repeat": null,
"height": {
"value": 0,
"unit": "#"
},
"items": [
{
"id": "eyebrow",
"name": "",
"hidden": false,
"locked": false,
"condition": null,
"margin": [
0,
0,
0,
0
],
"padding": [
0,
0,
0,
0
],
"radius": 0,
"background": {
"backgroundColor": {
"color": "#FFFFFF",
"hide": true
},
"backgroundGradient": {
"hide": true,
"stops": [
{
"color": "#000000",
"position": 0
},
{
"color": "#FFFFFF",
"position": 100
}
],
"angle": 90
},
"backgroundImage": {
"hide": true,
"image": null,
"size": "cover",
"position": "middle center"
}
},
"border": {
"color": "#000000",
"width": 1,
"style": "solid",
"hide": true
},
"color": {
"color": "#6b6b6b"
},
"fontWeight": "600",
"fontStyles": [
"uppercase"
],
"type": "text",
"content": {
"mode": "html",
"values": {
"en": [
{
"kind": "literal",
"value": "Letter"
}
],
"de": [
{
"kind": "literal",
"value": "Schreiben"
}
]
},
"fallbackLanguage": "en"
},
"wordBreak": "word",
"textAlign": "left",
"fontSize": 7.5,
"fontFamily": "",
"lineHeight": {
"value": 130,
"unit": "%"
},
"letterSpacing": {
"value": 0.35,
"unit": "#"
},
"width": {
"value": 100,
"unit": "%"
},
"height": {
"value": 0,
"unit": "#"
},
"link": {
"active": false,
"url": {
"mode": "plain",
"values": {
"en": [
{
"kind": "literal",
"value": ""
}
]
},
"fallbackLanguage": "en"
},
"openInNewTab": true
}
},
{
"id": "eyebrowSpacing",
"name": "",
"hidden": false,
"locked": false,
"condition": null,
"type": "spacer",
"height": {
"value": 2.5,
"unit": "#"
}
},
{
"id": "title",
"name": "",
"hidden": false,
"locked": false,
"condition": null,
"margin": [
0,
0,
0,
0
],
"padding": [
0,
0,
0,
0
],
"radius": 0,
"background": {
"backgroundColor": {
"color": "#FFFFFF",
"hide": true
},
"backgroundGradient": {
"hide": true,
"stops": [
{
"color": "#000000",
"position": 0
},
{
"color": "#FFFFFF",
"position": 100
}
],
"angle": 90
},
"backgroundImage": {
"hide": true,
"image": null,
"size": "cover",
"position": "middle center"
}
},
"border": {
"color": "#000000",
"width": 1,
"style": "solid",
"hide": true
},
"color": {
"color": "#111111"
},
"fontWeight": "600",
"fontStyles": [],
"type": "text",
"content": {
"mode": "html",
"values": {
"en": [
{
"kind": "literal",
"value": "Subject"
}
],
"de": [
{
"kind": "literal",
"value": "Betreff"
}
]
},
"fallbackLanguage": "en"
},
"wordBreak": "word",
"textAlign": "left",
"fontSize": 22,
"fontFamily": "Fraunces",
"lineHeight": {
"value": 115,
"unit": "%"
},
"letterSpacing": {
"value": -0.15,
"unit": "#"
},
"width": {
"value": 100,
"unit": "%"
},
"height": {
"value": 0,
"unit": "#"
},
"link": {
"active": false,
"url": {
"mode": "plain",
"values": {
"en": [
{
"kind": "literal",
"value": ""
}
]
},
"fallbackLanguage": "en"
},
"openInNewTab": true
}
},
{
"id": "titleSpacing",
"name": "",
"hidden": false,
"locked": false,
"condition": null,
"type": "spacer",
"height": {
"value": 4,
"unit": "#"
}
},
{
"id": "titleRule",
"name": "",
"hidden": false,
"locked": false,
"condition": null,
"type": "separator",
"margin": [
0,
0,
0,
0
],
"width": {
"value": 14,
"unit": "#"
},
"align": "left",
"line": {
"color": "#111111",
"width": 0.8,
"style": "solid"
}
},
{
"id": "titleRuleSpacing",
"name": "",
"hidden": false,
"locked": false,
"condition": null,
"type": "spacer",
"height": {
"value": 7,
"unit": "#"
}
},
{
"id": "content",
"name": "",
"hidden": false,
"locked": false,
"condition": null,
"margin": [
0,
0,
0,
0
],
"padding": [
0,
0,
0,
0
],
"radius": 0,
"background": {
"backgroundColor": {
"color": "#FFFFFF",
"hide": true
},
"backgroundGradient": {
"hide": true,
"stops": [
{
"color": "#000000",
"position": 0
},
{
"color": "#FFFFFF",
"position": 100
}
],
"angle": 90
},
"backgroundImage": {
"hide": true,
"image": null,
"size": "cover",
"position": "middle center"
}
},
"border": {
"color": "#000000",
"width": 1,
"style": "solid",
"hide": true
},
"color": {
"color": "#222222"
},
"fontWeight": "400",
"fontStyles": [],
"type": "text",
"content": {
"mode": "markdown",
"values": {
"en": [
{
"kind": "content",
"id": "content_en_0",
"property": {
"variable": "root.content"
},
"mode": "markdown"
}
],
"de": [
{
"kind": "content",
"id": "content_de_0",
"property": {
"variable": "root.content"
},
"mode": "markdown"
}
]
},
"fallbackLanguage": "en"
},
"wordBreak": "word",
"textAlign": "left",
"fontSize": 10.5,
"fontFamily": "",
"lineHeight": {
"value": 155,
"unit": "%"
},
"letterSpacing": {
"value": 0,
"unit": "#"
},
"width": {
"value": 100,
"unit": "%"
},
"height": {
"value": 0,
"unit": "#"
},
"link": {
"active": false,
"url": {
"mode": "plain",
"values": {
"en": [
{
"kind": "literal",
"value": ""
}
]
},
"fallbackLanguage": "en"
},
"openInNewTab": true
}
},
{
"id": "contentSpacing",
"name": "",
"hidden": false,
"locked": false,
"condition": null,
"type": "spacer",
"height": {
"value": 7,
"unit": "#"
}
},
{
"id": "signOff",
"name": "",
"hidden": false,
"locked": false,
"condition": null,
"margin": [
0,
0,
0,
0
],
"padding": [
0,
0,
0,
0
],
"radius": 0,
"background": {
"backgroundColor": {
"color": "#FFFFFF",
"hide": true
},
"backgroundGradient": {
"hide": true,
"stops": [
{
"color": "#000000",
"position": 0
},
{
"color": "#FFFFFF",
"position": 100
}
],
"angle": 90
},
"backgroundImage": {
"hide": true,
"image": null,
"size": "cover",
"position": "middle center"
}
},
"border": {
"color": "#000000",
"width": 1,
"style": "solid",
"hide": true
},
"color": {
"color": "#111111"
},
"fontWeight": "400",
"fontStyles": [
"italic"
],
"type": "text",
"content": {
"mode": "html",
"values": {
"en": [
{
"kind": "literal",
"value": "Kind regards"
}
],
"de": [
{
"kind": "literal",
"value": "Viele Grüße"
}
]
},
"fallbackLanguage": "en"
},
"wordBreak": "word",
"textAlign": "left",
"fontSize": 12,
"fontFamily": "Fraunces",
"lineHeight": {
"value": 155,
"unit": "%"
},
"letterSpacing": {
"value": 0,
"unit": "#"
},
"width": {
"value": 100,
"unit": "%"
},
"height": {
"value": 0,
"unit": "#"
},
"link": {
"active": false,
"url": {
"mode": "plain",
"values": {
"en": [
{
"kind": "literal",
"value": ""
}
]
},
"fallbackLanguage": "en"
},
"openInNewTab": true
}
}
]
}
]
}
]
},
"unit": "mm",
"languages": [
"en",
"de"
],
"onlineLetter": true,
"resources": [],
"attachment": null
},
"textContent": {
"de": "Sehr geehrte Damen und Herren, anbei erhalten Sie Ihre Mitgliedsinformationen. Mit freundlichen Grüßen\n",
"en": ""
},
"email": null,
"letter": {
"sendColorPostal": false,
"sendWithCheaperMethod": true
},
"contactType": "member",
"recipients": {
"source": "contacts",
"selection": {
"ids": [
"6b01bd639a14acdaad4923ca"
],
"selectedCount": 1,
"isAllSelected": false
}
}
}'const response = await fetch("https://cloud.campai.com/api/YOUR_ORGANIZATION_ID/YOUR_MANDATE_ID/crm/mailings/messages/send", {
method: "POST",
headers: {
"X-API-Key": "YOUR_API_KEY",
"Content-Type": "application/json"
},
body: JSON.stringify({
"templateContents": {
"version": 1,
"channel": "paper",
"container": {
"type": "container",
"id": "letter",
"repeat": null,
"pageSize": {
"width": 210,
"height": 297,
"landscape": false
},
"fontFamily": "Inter",
"items": [
{
"id": "page",
"name": "",
"hidden": false,
"locked": false,
"condition": null,
"type": "page",
"repeat": null,
"margin": [
45,
10,
20,
25
],
"background": {
"backgroundColor": {
"color": "#FFFFFF",
"hide": true
},
"backgroundGradient": {
"hide": true,
"stops": [
{
"color": "#000000",
"position": 0
},
{
"color": "#FFFFFF",
"position": 100
}
],
"angle": 90
},
"backgroundImage": {
"hide": true,
"image": null,
"size": "cover",
"position": "middle center"
}
},
"foldingMarks": [
{
"top": 105,
"left": 5,
"width": 3
},
{
"top": 148.5,
"left": 5,
"width": 6
},
{
"top": 210,
"left": 5,
"width": 3
}
],
"items": [
{
"id": "header",
"name": "",
"hidden": false,
"locked": false,
"condition": null,
"margin": [
10,
10,
0,
25
],
"padding": [
0,
0,
0,
0
],
"radius": 0,
"background": {
"backgroundColor": {
"color": "#FFFFFF",
"hide": true
},
"backgroundGradient": {
"hide": true,
"stops": [
{
"color": "#000000",
"position": 0
},
{
"color": "#FFFFFF",
"position": 100
}
],
"angle": 90
},
"backgroundImage": {
"hide": true,
"image": null,
"size": "cover",
"position": "middle center"
}
},
"border": {
"color": "#000000",
"width": 1,
"style": "solid",
"hide": true
},
"orientation": "vertical",
"placement": "top right",
"gapX": 0,
"gapY": 0,
"type": "pageHeader",
"items": [
{
"id": "logo",
"name": "Logo",
"hidden": true,
"locked": false,
"condition": null,
"margin": [
0,
0,
0,
0
],
"padding": [
0,
0,
0,
0
],
"radius": 4,
"background": {
"backgroundColor": {
"color": "#FFFFFF",
"hide": true
},
"backgroundGradient": {
"hide": true,
"stops": [
{
"color": "#000000",
"position": 0
},
{
"color": "#FFFFFF",
"position": 100
}
],
"angle": 90
},
"backgroundImage": {
"hide": true,
"image": null,
"size": "cover",
"position": "middle center"
}
},
"border": {
"color": "#000000",
"width": 1,
"style": "solid",
"hide": true
},
"type": "image",
"width": {
"value": 20,
"unit": "#"
},
"height": {
"value": 0,
"unit": "#"
},
"image": null,
"alt": {
"mode": "plain",
"values": {
"en": [
{
"kind": "literal",
"value": "Logo"
}
],
"de": [
{
"kind": "literal",
"value": "Logo"
}
]
},
"fallbackLanguage": "en"
},
"link": {
"active": false,
"url": {
"mode": "plain",
"values": {
"en": [
{
"kind": "literal",
"value": ""
}
]
},
"fallbackLanguage": "en"
},
"openInNewTab": true
}
}
]
},
{
"id": "footer",
"name": "",
"hidden": false,
"locked": false,
"condition": null,
"margin": [
0,
10,
10,
25
],
"padding": [
0,
0,
0,
0
],
"radius": 0,
"background": {
"backgroundColor": {
"color": "#FFFFFF",
"hide": true
},
"backgroundGradient": {
"hide": true,
"stops": [
{
"color": "#000000",
"position": 0
},
{
"color": "#FFFFFF",
"position": 100
}
],
"angle": 90
},
"backgroundImage": {
"hide": true,
"image": null,
"size": "cover",
"position": "middle center"
}
},
"border": {
"color": "#000000",
"width": 1,
"style": "solid",
"hide": true
},
"orientation": "vertical",
"placement": "top left",
"gapX": 0,
"gapY": 2,
"type": "pageFooter",
"items": [
{
"id": "footerRule",
"name": "",
"hidden": false,
"locked": false,
"condition": null,
"type": "separator",
"margin": [
0,
0,
0,
0
],
"width": {
"value": 100,
"unit": "%"
},
"align": "left",
"line": {
"color": "#bdbdbd",
"width": 0.2,
"style": "solid"
}
},
{
"id": "footerSender",
"name": "",
"hidden": false,
"locked": false,
"condition": null,
"margin": [
0,
0,
0,
0
],
"padding": [
0,
0,
0,
0
],
"radius": 0,
"background": {
"backgroundColor": {
"color": "#FFFFFF",
"hide": true
},
"backgroundGradient": {
"hide": true,
"stops": [
{
"color": "#000000",
"position": 0
},
{
"color": "#FFFFFF",
"position": 100
}
],
"angle": 90
},
"backgroundImage": {
"hide": true,
"image": null,
"size": "cover",
"position": "middle center"
}
},
"border": {
"color": "#000000",
"width": 1,
"style": "solid",
"hide": true
},
"color": {
"color": "#6b6b6b"
},
"fontWeight": "500",
"fontStyles": [
"uppercase"
],
"type": "text",
"content": {
"mode": "html",
"values": {
"en": [
{
"kind": "value",
"id": "footerSender_en_0",
"expression": {
"variable": "root.letterAddress.sender"
},
"format": null
}
],
"de": [
{
"kind": "value",
"id": "footerSender_de_0",
"expression": {
"variable": "root.letterAddress.sender"
},
"format": null
}
]
},
"fallbackLanguage": "en"
},
"wordBreak": "word",
"textAlign": "center",
"fontSize": 6.5,
"fontFamily": "",
"lineHeight": {
"value": 130,
"unit": "%"
},
"letterSpacing": {
"value": 0.25,
"unit": "#"
},
"width": {
"value": 100,
"unit": "%"
},
"height": {
"value": 0,
"unit": "#"
},
"link": {
"active": false,
"url": {
"mode": "plain",
"values": {
"en": [
{
"kind": "literal",
"value": ""
}
]
},
"fallbackLanguage": "en"
},
"openInNewTab": true
}
}
]
},
{
"id": "addresses",
"name": "",
"hidden": false,
"locked": false,
"condition": null,
"margin": [
0,
0,
0,
0
],
"padding": [
0,
0,
0,
0
],
"radius": 0,
"background": {
"backgroundColor": {
"color": "#FFFFFF",
"hide": true
},
"backgroundGradient": {
"hide": true,
"stops": [
{
"color": "#000000",
"position": 0
},
{
"color": "#FFFFFF",
"position": 100
}
],
"angle": 90
},
"backgroundImage": {
"hide": true,
"image": null,
"size": "cover",
"position": "middle center"
}
},
"border": {
"color": "#000000",
"width": 1,
"style": "solid",
"hide": true
},
"orientation": "vertical",
"placement": "top left",
"gapX": 0,
"gapY": 0,
"type": "section",
"repeat": null,
"height": {
"value": 53.46,
"unit": "#"
},
"items": [
{
"id": "addressGrid",
"name": "",
"hidden": false,
"locked": false,
"condition": null,
"margin": [
0,
0,
0,
0
],
"padding": [
0,
0,
0,
0
],
"radius": 0,
"background": {
"backgroundColor": {
"color": "#FFFFFF",
"hide": true
},
"backgroundGradient": {
"hide": true,
"stops": [
{
"color": "#000000",
"position": 0
},
{
"color": "#FFFFFF",
"position": 100
}
],
"angle": 90
},
"backgroundImage": {
"hide": true,
"image": null,
"size": "cover",
"position": "middle center"
}
},
"border": {
"color": "#000000",
"width": 1,
"style": "solid",
"hide": true
},
"type": "grid",
"width": {
"value": 100,
"unit": "%"
},
"height": {
"value": 45,
"unit": "#"
},
"placement": "top left",
"gapX": 0,
"gapY": 0,
"columns": 2,
"columnsFlex": [
1,
1
],
"items": [
{
"id": "address",
"name": "",
"hidden": false,
"locked": false,
"condition": null,
"margin": [
0,
0,
0,
0
],
"padding": [
0,
0,
0,
0
],
"radius": 0,
"background": {
"backgroundColor": {
"color": "#FFFFFF",
"hide": true
},
"backgroundGradient": {
"hide": true,
"stops": [
{
"color": "#000000",
"position": 0
},
{
"color": "#FFFFFF",
"position": 100
}
],
"angle": 90
},
"backgroundImage": {
"hide": true,
"image": null,
"size": "cover",
"position": "middle center"
}
},
"border": {
"color": "#000000",
"width": 1,
"style": "solid",
"hide": true
},
"orientation": "vertical",
"placement": "inherit",
"gapX": 0,
"gapY": 0,
"type": "gridItem",
"repeat": null,
"items": [
{
"id": "sender",
"name": "",
"hidden": false,
"locked": false,
"condition": null,
"margin": [
0,
0,
0,
0
],
"padding": [
0,
0,
0,
0
],
"radius": 0,
"background": {
"backgroundColor": {
"color": "#FFFFFF",
"hide": true
},
"backgroundGradient": {
"hide": true,
"stops": [
{
"color": "#000000",
"position": 0
},
{
"color": "#FFFFFF",
"position": 100
}
],
"angle": 90
},
"backgroundImage": {
"hide": true,
"image": null,
"size": "cover",
"position": "middle center"
}
},
"border": {
"color": "#000000",
"width": 1,
"style": "solid",
"hide": true
},
"color": {
"color": "#000000"
},
"fontWeight": "400",
"fontStyles": [],
"type": "text",
"content": {
"mode": "html",
"values": {
"en": [
{
"kind": "value",
"id": "sender_en",
"expression": {
"variable": "root.letterAddress.sender"
},
"format": null
}
],
"de": [
{
"kind": "value",
"id": "sender_de",
"expression": {
"variable": "root.letterAddress.sender"
},
"format": null
}
]
},
"fallbackLanguage": "en"
},
"wordBreak": "word",
"textAlign": "left",
"fontSize": 8,
"fontFamily": "",
"lineHeight": {
"value": 0,
"unit": "#"
},
"letterSpacing": {
"value": 0,
"unit": "#"
},
"width": {
"value": 80,
"unit": "#"
},
"height": {
"value": 16.7,
"unit": "#"
},
"link": {
"active": false,
"url": {
"mode": "plain",
"values": {
"en": [
{
"kind": "literal",
"value": ""
}
]
},
"fallbackLanguage": "en"
},
"openInNewTab": true
}
},
{
"id": "receiver",
"name": "",
"hidden": false,
"locked": false,
"condition": null,
"margin": [
0,
0,
0,
0
],
"padding": [
0,
0,
0,
0
],
"radius": 0,
"background": {
"backgroundColor": {
"color": "#FFFFFF",
"hide": true
},
"backgroundGradient": {
"hide": true,
"stops": [
{
"color": "#000000",
"position": 0
},
{
"color": "#FFFFFF",
"position": 100
}
],
"angle": 90
},
"backgroundImage": {
"hide": true,
"image": null,
"size": "cover",
"position": "middle center"
}
},
"border": {
"color": "#000000",
"width": 1,
"style": "solid",
"hide": true
},
"color": {
"color": "#000000"
},
"fontWeight": "400",
"fontStyles": [],
"type": "text",
"content": {
"mode": "plain",
"values": {
"en": [
{
"kind": "value",
"id": "receiver_en",
"expression": {
"variable": "root.letterAddress.receiver"
},
"format": null
}
],
"de": [
{
"kind": "value",
"id": "receiver_de",
"expression": {
"variable": "root.letterAddress.receiver"
},
"format": null
}
]
},
"fallbackLanguage": "en"
},
"wordBreak": "word",
"textAlign": "left",
"fontSize": 10,
"fontFamily": "",
"lineHeight": {
"value": 0,
"unit": "#"
},
"letterSpacing": {
"value": 0,
"unit": "#"
},
"width": {
"value": 80,
"unit": "#"
},
"height": {
"value": 28.3,
"unit": "#"
},
"link": {
"active": false,
"url": {
"mode": "plain",
"values": {
"en": [
{
"kind": "literal",
"value": ""
}
]
},
"fallbackLanguage": "en"
},
"openInNewTab": true
}
}
]
},
{
"id": "details",
"name": "",
"hidden": false,
"locked": false,
"condition": null,
"margin": [
5,
0,
0,
0
],
"padding": [
0,
0,
0,
0
],
"radius": 0,
"background": {
"backgroundColor": {
"color": "#FFFFFF",
"hide": true
},
"backgroundGradient": {
"hide": true,
"stops": [
{
"color": "#000000",
"position": 0
},
{
"color": "#FFFFFF",
"position": 100
}
],
"angle": 90
},
"backgroundImage": {
"hide": true,
"image": null,
"size": "cover",
"position": "middle center"
}
},
"border": {
"color": "#000000",
"width": 1,
"style": "solid",
"hide": true
},
"orientation": "vertical",
"placement": "top right",
"gapX": 0,
"gapY": 0,
"type": "gridItem",
"repeat": null,
"items": []
}
]
}
]
},
{
"id": "body",
"name": "",
"hidden": false,
"locked": false,
"condition": null,
"margin": [
0,
10,
6,
0
],
"padding": [
0,
0,
0,
0
],
"radius": 0,
"background": {
"backgroundColor": {
"color": "#FFFFFF",
"hide": true
},
"backgroundGradient": {
"hide": true,
"stops": [
{
"color": "#000000",
"position": 0
},
{
"color": "#FFFFFF",
"position": 100
}
],
"angle": 90
},
"backgroundImage": {
"hide": true,
"image": null,
"size": "cover",
"position": "middle center"
}
},
"border": {
"color": "#000000",
"width": 1,
"style": "solid",
"hide": true
},
"orientation": "vertical",
"placement": "top left",
"gapX": 0,
"gapY": 0,
"type": "section",
"repeat": null,
"height": {
"value": 0,
"unit": "#"
},
"items": [
{
"id": "eyebrow",
"name": "",
"hidden": false,
"locked": false,
"condition": null,
"margin": [
0,
0,
0,
0
],
"padding": [
0,
0,
0,
0
],
"radius": 0,
"background": {
"backgroundColor": {
"color": "#FFFFFF",
"hide": true
},
"backgroundGradient": {
"hide": true,
"stops": [
{
"color": "#000000",
"position": 0
},
{
"color": "#FFFFFF",
"position": 100
}
],
"angle": 90
},
"backgroundImage": {
"hide": true,
"image": null,
"size": "cover",
"position": "middle center"
}
},
"border": {
"color": "#000000",
"width": 1,
"style": "solid",
"hide": true
},
"color": {
"color": "#6b6b6b"
},
"fontWeight": "600",
"fontStyles": [
"uppercase"
],
"type": "text",
"content": {
"mode": "html",
"values": {
"en": [
{
"kind": "literal",
"value": "Letter"
}
],
"de": [
{
"kind": "literal",
"value": "Schreiben"
}
]
},
"fallbackLanguage": "en"
},
"wordBreak": "word",
"textAlign": "left",
"fontSize": 7.5,
"fontFamily": "",
"lineHeight": {
"value": 130,
"unit": "%"
},
"letterSpacing": {
"value": 0.35,
"unit": "#"
},
"width": {
"value": 100,
"unit": "%"
},
"height": {
"value": 0,
"unit": "#"
},
"link": {
"active": false,
"url": {
"mode": "plain",
"values": {
"en": [
{
"kind": "literal",
"value": ""
}
]
},
"fallbackLanguage": "en"
},
"openInNewTab": true
}
},
{
"id": "eyebrowSpacing",
"name": "",
"hidden": false,
"locked": false,
"condition": null,
"type": "spacer",
"height": {
"value": 2.5,
"unit": "#"
}
},
{
"id": "title",
"name": "",
"hidden": false,
"locked": false,
"condition": null,
"margin": [
0,
0,
0,
0
],
"padding": [
0,
0,
0,
0
],
"radius": 0,
"background": {
"backgroundColor": {
"color": "#FFFFFF",
"hide": true
},
"backgroundGradient": {
"hide": true,
"stops": [
{
"color": "#000000",
"position": 0
},
{
"color": "#FFFFFF",
"position": 100
}
],
"angle": 90
},
"backgroundImage": {
"hide": true,
"image": null,
"size": "cover",
"position": "middle center"
}
},
"border": {
"color": "#000000",
"width": 1,
"style": "solid",
"hide": true
},
"color": {
"color": "#111111"
},
"fontWeight": "600",
"fontStyles": [],
"type": "text",
"content": {
"mode": "html",
"values": {
"en": [
{
"kind": "literal",
"value": "Subject"
}
],
"de": [
{
"kind": "literal",
"value": "Betreff"
}
]
},
"fallbackLanguage": "en"
},
"wordBreak": "word",
"textAlign": "left",
"fontSize": 22,
"fontFamily": "Fraunces",
"lineHeight": {
"value": 115,
"unit": "%"
},
"letterSpacing": {
"value": -0.15,
"unit": "#"
},
"width": {
"value": 100,
"unit": "%"
},
"height": {
"value": 0,
"unit": "#"
},
"link": {
"active": false,
"url": {
"mode": "plain",
"values": {
"en": [
{
"kind": "literal",
"value": ""
}
]
},
"fallbackLanguage": "en"
},
"openInNewTab": true
}
},
{
"id": "titleSpacing",
"name": "",
"hidden": false,
"locked": false,
"condition": null,
"type": "spacer",
"height": {
"value": 4,
"unit": "#"
}
},
{
"id": "titleRule",
"name": "",
"hidden": false,
"locked": false,
"condition": null,
"type": "separator",
"margin": [
0,
0,
0,
0
],
"width": {
"value": 14,
"unit": "#"
},
"align": "left",
"line": {
"color": "#111111",
"width": 0.8,
"style": "solid"
}
},
{
"id": "titleRuleSpacing",
"name": "",
"hidden": false,
"locked": false,
"condition": null,
"type": "spacer",
"height": {
"value": 7,
"unit": "#"
}
},
{
"id": "content",
"name": "",
"hidden": false,
"locked": false,
"condition": null,
"margin": [
0,
0,
0,
0
],
"padding": [
0,
0,
0,
0
],
"radius": 0,
"background": {
"backgroundColor": {
"color": "#FFFFFF",
"hide": true
},
"backgroundGradient": {
"hide": true,
"stops": [
{
"color": "#000000",
"position": 0
},
{
"color": "#FFFFFF",
"position": 100
}
],
"angle": 90
},
"backgroundImage": {
"hide": true,
"image": null,
"size": "cover",
"position": "middle center"
}
},
"border": {
"color": "#000000",
"width": 1,
"style": "solid",
"hide": true
},
"color": {
"color": "#222222"
},
"fontWeight": "400",
"fontStyles": [],
"type": "text",
"content": {
"mode": "markdown",
"values": {
"en": [
{
"kind": "content",
"id": "content_en_0",
"property": {
"variable": "root.content"
},
"mode": "markdown"
}
],
"de": [
{
"kind": "content",
"id": "content_de_0",
"property": {
"variable": "root.content"
},
"mode": "markdown"
}
]
},
"fallbackLanguage": "en"
},
"wordBreak": "word",
"textAlign": "left",
"fontSize": 10.5,
"fontFamily": "",
"lineHeight": {
"value": 155,
"unit": "%"
},
"letterSpacing": {
"value": 0,
"unit": "#"
},
"width": {
"value": 100,
"unit": "%"
},
"height": {
"value": 0,
"unit": "#"
},
"link": {
"active": false,
"url": {
"mode": "plain",
"values": {
"en": [
{
"kind": "literal",
"value": ""
}
]
},
"fallbackLanguage": "en"
},
"openInNewTab": true
}
},
{
"id": "contentSpacing",
"name": "",
"hidden": false,
"locked": false,
"condition": null,
"type": "spacer",
"height": {
"value": 7,
"unit": "#"
}
},
{
"id": "signOff",
"name": "",
"hidden": false,
"locked": false,
"condition": null,
"margin": [
0,
0,
0,
0
],
"padding": [
0,
0,
0,
0
],
"radius": 0,
"background": {
"backgroundColor": {
"color": "#FFFFFF",
"hide": true
},
"backgroundGradient": {
"hide": true,
"stops": [
{
"color": "#000000",
"position": 0
},
{
"color": "#FFFFFF",
"position": 100
}
],
"angle": 90
},
"backgroundImage": {
"hide": true,
"image": null,
"size": "cover",
"position": "middle center"
}
},
"border": {
"color": "#000000",
"width": 1,
"style": "solid",
"hide": true
},
"color": {
"color": "#111111"
},
"fontWeight": "400",
"fontStyles": [
"italic"
],
"type": "text",
"content": {
"mode": "html",
"values": {
"en": [
{
"kind": "literal",
"value": "Kind regards"
}
],
"de": [
{
"kind": "literal",
"value": "Viele Grüße"
}
]
},
"fallbackLanguage": "en"
},
"wordBreak": "word",
"textAlign": "left",
"fontSize": 12,
"fontFamily": "Fraunces",
"lineHeight": {
"value": 155,
"unit": "%"
},
"letterSpacing": {
"value": 0,
"unit": "#"
},
"width": {
"value": 100,
"unit": "%"
},
"height": {
"value": 0,
"unit": "#"
},
"link": {
"active": false,
"url": {
"mode": "plain",
"values": {
"en": [
{
"kind": "literal",
"value": ""
}
]
},
"fallbackLanguage": "en"
},
"openInNewTab": true
}
}
]
}
]
}
]
},
"unit": "mm",
"languages": [
"en",
"de"
],
"onlineLetter": true,
"resources": [],
"attachment": null
},
"textContent": {
"de": "Sehr geehrte Damen und Herren, anbei erhalten Sie Ihre Mitgliedsinformationen. Mit freundlichen Grüßen\n",
"en": ""
},
"email": null,
"letter": {
"sendColorPostal": false,
"sendWithCheaperMethod": true
},
"contactType": "member",
"recipients": {
"source": "contacts",
"selection": {
"ids": [
"6b01bd639a14acdaad4923ca"
],
"selectedCount": 1,
"isAllSelected": false
}
}
}),
redirect: 'error',
signal: AbortSignal.timeout(30_000),
});
if (!response.ok) throw new Error(`campai HTTP ${response.status}`);
const text = await response.text();
const result = text ? JSON.parse(text) : null;
console.log(JSON.stringify(result, null, 2));<?php
$body = [
'templateContents' => [
'version' => 1,
'channel' => 'paper',
'container' => [
'type' => 'container',
'id' => 'letter',
'repeat' => null,
'pageSize' => [
'width' => 210,
'height' => 297,
'landscape' => false,
],
'fontFamily' => 'Inter',
'items' => [
[
'id' => 'page',
'name' => '',
'hidden' => false,
'locked' => false,
'condition' => null,
'type' => 'page',
'repeat' => null,
'margin' => [
45,
10,
20,
25,
],
'background' => [
'backgroundColor' => [
'color' => '#FFFFFF',
'hide' => true,
],
'backgroundGradient' => [
'hide' => true,
'stops' => [
[
'color' => '#000000',
'position' => 0,
],
[
'color' => '#FFFFFF',
'position' => 100,
],
],
'angle' => 90,
],
'backgroundImage' => [
'hide' => true,
'image' => null,
'size' => 'cover',
'position' => 'middle center',
],
],
'foldingMarks' => [
[
'top' => 105,
'left' => 5,
'width' => 3,
],
[
'top' => 148.5,
'left' => 5,
'width' => 6,
],
[
'top' => 210,
'left' => 5,
'width' => 3,
],
],
'items' => [
[
'id' => 'header',
'name' => '',
'hidden' => false,
'locked' => false,
'condition' => null,
'margin' => [
10,
10,
0,
25,
],
'padding' => [
0,
0,
0,
0,
],
'radius' => 0,
'background' => [
'backgroundColor' => [
'color' => '#FFFFFF',
'hide' => true,
],
'backgroundGradient' => [
'hide' => true,
'stops' => [
[
'color' => '#000000',
'position' => 0,
],
[
'color' => '#FFFFFF',
'position' => 100,
],
],
'angle' => 90,
],
'backgroundImage' => [
'hide' => true,
'image' => null,
'size' => 'cover',
'position' => 'middle center',
],
],
'border' => [
'color' => '#000000',
'width' => 1,
'style' => 'solid',
'hide' => true,
],
'orientation' => 'vertical',
'placement' => 'top right',
'gapX' => 0,
'gapY' => 0,
'type' => 'pageHeader',
'items' => [
[
'id' => 'logo',
'name' => 'Logo',
'hidden' => true,
'locked' => false,
'condition' => null,
'margin' => [
0,
0,
0,
0,
],
'padding' => [
0,
0,
0,
0,
],
'radius' => 4,
'background' => [
'backgroundColor' => [
'color' => '#FFFFFF',
'hide' => true,
],
'backgroundGradient' => [
'hide' => true,
'stops' => [
[
'color' => '#000000',
'position' => 0,
],
[
'color' => '#FFFFFF',
'position' => 100,
],
],
'angle' => 90,
],
'backgroundImage' => [
'hide' => true,
'image' => null,
'size' => 'cover',
'position' => 'middle center',
],
],
'border' => [
'color' => '#000000',
'width' => 1,
'style' => 'solid',
'hide' => true,
],
'type' => 'image',
'width' => [
'value' => 20,
'unit' => '#',
],
'height' => [
'value' => 0,
'unit' => '#',
],
'image' => null,
'alt' => [
'mode' => 'plain',
'values' => [
'en' => [
[
'kind' => 'literal',
'value' => 'Logo',
],
],
'de' => [
[
'kind' => 'literal',
'value' => 'Logo',
],
],
],
'fallbackLanguage' => 'en',
],
'link' => [
'active' => false,
'url' => [
'mode' => 'plain',
'values' => [
'en' => [
[
'kind' => 'literal',
'value' => '',
],
],
],
'fallbackLanguage' => 'en',
],
'openInNewTab' => true,
],
],
],
],
[
'id' => 'footer',
'name' => '',
'hidden' => false,
'locked' => false,
'condition' => null,
'margin' => [
0,
10,
10,
25,
],
'padding' => [
0,
0,
0,
0,
],
'radius' => 0,
'background' => [
'backgroundColor' => [
'color' => '#FFFFFF',
'hide' => true,
],
'backgroundGradient' => [
'hide' => true,
'stops' => [
[
'color' => '#000000',
'position' => 0,
],
[
'color' => '#FFFFFF',
'position' => 100,
],
],
'angle' => 90,
],
'backgroundImage' => [
'hide' => true,
'image' => null,
'size' => 'cover',
'position' => 'middle center',
],
],
'border' => [
'color' => '#000000',
'width' => 1,
'style' => 'solid',
'hide' => true,
],
'orientation' => 'vertical',
'placement' => 'top left',
'gapX' => 0,
'gapY' => 2,
'type' => 'pageFooter',
'items' => [
[
'id' => 'footerRule',
'name' => '',
'hidden' => false,
'locked' => false,
'condition' => null,
'type' => 'separator',
'margin' => [
0,
0,
0,
0,
],
'width' => [
'value' => 100,
'unit' => '%',
],
'align' => 'left',
'line' => [
'color' => '#bdbdbd',
'width' => 0.2,
'style' => 'solid',
],
],
[
'id' => 'footerSender',
'name' => '',
'hidden' => false,
'locked' => false,
'condition' => null,
'margin' => [
0,
0,
0,
0,
],
'padding' => [
0,
0,
0,
0,
],
'radius' => 0,
'background' => [
'backgroundColor' => [
'color' => '#FFFFFF',
'hide' => true,
],
'backgroundGradient' => [
'hide' => true,
'stops' => [
[
'color' => '#000000',
'position' => 0,
],
[
'color' => '#FFFFFF',
'position' => 100,
],
],
'angle' => 90,
],
'backgroundImage' => [
'hide' => true,
'image' => null,
'size' => 'cover',
'position' => 'middle center',
],
],
'border' => [
'color' => '#000000',
'width' => 1,
'style' => 'solid',
'hide' => true,
],
'color' => [
'color' => '#6b6b6b',
],
'fontWeight' => '500',
'fontStyles' => [
'uppercase',
],
'type' => 'text',
'content' => [
'mode' => 'html',
'values' => [
'en' => [
[
'kind' => 'value',
'id' => 'footerSender_en_0',
'expression' => [
'variable' => 'root.letterAddress.sender',
],
'format' => null,
],
],
'de' => [
[
'kind' => 'value',
'id' => 'footerSender_de_0',
'expression' => [
'variable' => 'root.letterAddress.sender',
],
'format' => null,
],
],
],
'fallbackLanguage' => 'en',
],
'wordBreak' => 'word',
'textAlign' => 'center',
'fontSize' => 6.5,
'fontFamily' => '',
'lineHeight' => [
'value' => 130,
'unit' => '%',
],
'letterSpacing' => [
'value' => 0.25,
'unit' => '#',
],
'width' => [
'value' => 100,
'unit' => '%',
],
'height' => [
'value' => 0,
'unit' => '#',
],
'link' => [
'active' => false,
'url' => [
'mode' => 'plain',
'values' => [
'en' => [
[
'kind' => 'literal',
'value' => '',
],
],
],
'fallbackLanguage' => 'en',
],
'openInNewTab' => true,
],
],
],
],
[
'id' => 'addresses',
'name' => '',
'hidden' => false,
'locked' => false,
'condition' => null,
'margin' => [
0,
0,
0,
0,
],
'padding' => [
0,
0,
0,
0,
],
'radius' => 0,
'background' => [
'backgroundColor' => [
'color' => '#FFFFFF',
'hide' => true,
],
'backgroundGradient' => [
'hide' => true,
'stops' => [
[
'color' => '#000000',
'position' => 0,
],
[
'color' => '#FFFFFF',
'position' => 100,
],
],
'angle' => 90,
],
'backgroundImage' => [
'hide' => true,
'image' => null,
'size' => 'cover',
'position' => 'middle center',
],
],
'border' => [
'color' => '#000000',
'width' => 1,
'style' => 'solid',
'hide' => true,
],
'orientation' => 'vertical',
'placement' => 'top left',
'gapX' => 0,
'gapY' => 0,
'type' => 'section',
'repeat' => null,
'height' => [
'value' => 53.46,
'unit' => '#',
],
'items' => [
[
'id' => 'addressGrid',
'name' => '',
'hidden' => false,
'locked' => false,
'condition' => null,
'margin' => [
0,
0,
0,
0,
],
'padding' => [
0,
0,
0,
0,
],
'radius' => 0,
'background' => [
'backgroundColor' => [
'color' => '#FFFFFF',
'hide' => true,
],
'backgroundGradient' => [
'hide' => true,
'stops' => [
[
'color' => '#000000',
'position' => 0,
],
[
'color' => '#FFFFFF',
'position' => 100,
],
],
'angle' => 90,
],
'backgroundImage' => [
'hide' => true,
'image' => null,
'size' => 'cover',
'position' => 'middle center',
],
],
'border' => [
'color' => '#000000',
'width' => 1,
'style' => 'solid',
'hide' => true,
],
'type' => 'grid',
'width' => [
'value' => 100,
'unit' => '%',
],
'height' => [
'value' => 45,
'unit' => '#',
],
'placement' => 'top left',
'gapX' => 0,
'gapY' => 0,
'columns' => 2,
'columnsFlex' => [
1,
1,
],
'items' => [
[
'id' => 'address',
'name' => '',
'hidden' => false,
'locked' => false,
'condition' => null,
'margin' => [
0,
0,
0,
0,
],
'padding' => [
0,
0,
0,
0,
],
'radius' => 0,
'background' => [
'backgroundColor' => [
'color' => '#FFFFFF',
'hide' => true,
],
'backgroundGradient' => [
'hide' => true,
'stops' => [
[
'color' => '#000000',
'position' => 0,
],
[
'color' => '#FFFFFF',
'position' => 100,
],
],
'angle' => 90,
],
'backgroundImage' => [
'hide' => true,
'image' => null,
'size' => 'cover',
'position' => 'middle center',
],
],
'border' => [
'color' => '#000000',
'width' => 1,
'style' => 'solid',
'hide' => true,
],
'orientation' => 'vertical',
'placement' => 'inherit',
'gapX' => 0,
'gapY' => 0,
'type' => 'gridItem',
'repeat' => null,
'items' => [
[
'id' => 'sender',
'name' => '',
'hidden' => false,
'locked' => false,
'condition' => null,
'margin' => [
0,
0,
0,
0,
],
'padding' => [
0,
0,
0,
0,
],
'radius' => 0,
'background' => [
'backgroundColor' => [
'color' => '#FFFFFF',
'hide' => true,
],
'backgroundGradient' => [
'hide' => true,
'stops' => [
[
'color' => '#000000',
'position' => 0,
],
[
'color' => '#FFFFFF',
'position' => 100,
],
],
'angle' => 90,
],
'backgroundImage' => [
'hide' => true,
'image' => null,
'size' => 'cover',
'position' => 'middle center',
],
],
'border' => [
'color' => '#000000',
'width' => 1,
'style' => 'solid',
'hide' => true,
],
'color' => [
'color' => '#000000',
],
'fontWeight' => '400',
'fontStyles' => [],
'type' => 'text',
'content' => [
'mode' => 'html',
'values' => [
'en' => [
[
'kind' => 'value',
'id' => 'sender_en',
'expression' => [
'variable' => 'root.letterAddress.sender',
],
'format' => null,
],
],
'de' => [
[
'kind' => 'value',
'id' => 'sender_de',
'expression' => [
'variable' => 'root.letterAddress.sender',
],
'format' => null,
],
],
],
'fallbackLanguage' => 'en',
],
'wordBreak' => 'word',
'textAlign' => 'left',
'fontSize' => 8,
'fontFamily' => '',
'lineHeight' => [
'value' => 0,
'unit' => '#',
],
'letterSpacing' => [
'value' => 0,
'unit' => '#',
],
'width' => [
'value' => 80,
'unit' => '#',
],
'height' => [
'value' => 16.7,
'unit' => '#',
],
'link' => [
'active' => false,
'url' => [
'mode' => 'plain',
'values' => [
'en' => [
[
'kind' => 'literal',
'value' => '',
],
],
],
'fallbackLanguage' => 'en',
],
'openInNewTab' => true,
],
],
[
'id' => 'receiver',
'name' => '',
'hidden' => false,
'locked' => false,
'condition' => null,
'margin' => [
0,
0,
0,
0,
],
'padding' => [
0,
0,
0,
0,
],
'radius' => 0,
'background' => [
'backgroundColor' => [
'color' => '#FFFFFF',
'hide' => true,
],
'backgroundGradient' => [
'hide' => true,
'stops' => [
[
'color' => '#000000',
'position' => 0,
],
[
'color' => '#FFFFFF',
'position' => 100,
],
],
'angle' => 90,
],
'backgroundImage' => [
'hide' => true,
'image' => null,
'size' => 'cover',
'position' => 'middle center',
],
],
'border' => [
'color' => '#000000',
'width' => 1,
'style' => 'solid',
'hide' => true,
],
'color' => [
'color' => '#000000',
],
'fontWeight' => '400',
'fontStyles' => [],
'type' => 'text',
'content' => [
'mode' => 'plain',
'values' => [
'en' => [
[
'kind' => 'value',
'id' => 'receiver_en',
'expression' => [
'variable' => 'root.letterAddress.receiver',
],
'format' => null,
],
],
'de' => [
[
'kind' => 'value',
'id' => 'receiver_de',
'expression' => [
'variable' => 'root.letterAddress.receiver',
],
'format' => null,
],
],
],
'fallbackLanguage' => 'en',
],
'wordBreak' => 'word',
'textAlign' => 'left',
'fontSize' => 10,
'fontFamily' => '',
'lineHeight' => [
'value' => 0,
'unit' => '#',
],
'letterSpacing' => [
'value' => 0,
'unit' => '#',
],
'width' => [
'value' => 80,
'unit' => '#',
],
'height' => [
'value' => 28.3,
'unit' => '#',
],
'link' => [
'active' => false,
'url' => [
'mode' => 'plain',
'values' => [
'en' => [
[
'kind' => 'literal',
'value' => '',
],
],
],
'fallbackLanguage' => 'en',
],
'openInNewTab' => true,
],
],
],
],
[
'id' => 'details',
'name' => '',
'hidden' => false,
'locked' => false,
'condition' => null,
'margin' => [
5,
0,
0,
0,
],
'padding' => [
0,
0,
0,
0,
],
'radius' => 0,
'background' => [
'backgroundColor' => [
'color' => '#FFFFFF',
'hide' => true,
],
'backgroundGradient' => [
'hide' => true,
'stops' => [
[
'color' => '#000000',
'position' => 0,
],
[
'color' => '#FFFFFF',
'position' => 100,
],
],
'angle' => 90,
],
'backgroundImage' => [
'hide' => true,
'image' => null,
'size' => 'cover',
'position' => 'middle center',
],
],
'border' => [
'color' => '#000000',
'width' => 1,
'style' => 'solid',
'hide' => true,
],
'orientation' => 'vertical',
'placement' => 'top right',
'gapX' => 0,
'gapY' => 0,
'type' => 'gridItem',
'repeat' => null,
'items' => [],
],
],
],
],
],
[
'id' => 'body',
'name' => '',
'hidden' => false,
'locked' => false,
'condition' => null,
'margin' => [
0,
10,
6,
0,
],
'padding' => [
0,
0,
0,
0,
],
'radius' => 0,
'background' => [
'backgroundColor' => [
'color' => '#FFFFFF',
'hide' => true,
],
'backgroundGradient' => [
'hide' => true,
'stops' => [
[
'color' => '#000000',
'position' => 0,
],
[
'color' => '#FFFFFF',
'position' => 100,
],
],
'angle' => 90,
],
'backgroundImage' => [
'hide' => true,
'image' => null,
'size' => 'cover',
'position' => 'middle center',
],
],
'border' => [
'color' => '#000000',
'width' => 1,
'style' => 'solid',
'hide' => true,
],
'orientation' => 'vertical',
'placement' => 'top left',
'gapX' => 0,
'gapY' => 0,
'type' => 'section',
'repeat' => null,
'height' => [
'value' => 0,
'unit' => '#',
],
'items' => [
[
'id' => 'eyebrow',
'name' => '',
'hidden' => false,
'locked' => false,
'condition' => null,
'margin' => [
0,
0,
0,
0,
],
'padding' => [
0,
0,
0,
0,
],
'radius' => 0,
'background' => [
'backgroundColor' => [
'color' => '#FFFFFF',
'hide' => true,
],
'backgroundGradient' => [
'hide' => true,
'stops' => [
[
'color' => '#000000',
'position' => 0,
],
[
'color' => '#FFFFFF',
'position' => 100,
],
],
'angle' => 90,
],
'backgroundImage' => [
'hide' => true,
'image' => null,
'size' => 'cover',
'position' => 'middle center',
],
],
'border' => [
'color' => '#000000',
'width' => 1,
'style' => 'solid',
'hide' => true,
],
'color' => [
'color' => '#6b6b6b',
],
'fontWeight' => '600',
'fontStyles' => [
'uppercase',
],
'type' => 'text',
'content' => [
'mode' => 'html',
'values' => [
'en' => [
[
'kind' => 'literal',
'value' => 'Letter',
],
],
'de' => [
[
'kind' => 'literal',
'value' => 'Schreiben',
],
],
],
'fallbackLanguage' => 'en',
],
'wordBreak' => 'word',
'textAlign' => 'left',
'fontSize' => 7.5,
'fontFamily' => '',
'lineHeight' => [
'value' => 130,
'unit' => '%',
],
'letterSpacing' => [
'value' => 0.35,
'unit' => '#',
],
'width' => [
'value' => 100,
'unit' => '%',
],
'height' => [
'value' => 0,
'unit' => '#',
],
'link' => [
'active' => false,
'url' => [
'mode' => 'plain',
'values' => [
'en' => [
[
'kind' => 'literal',
'value' => '',
],
],
],
'fallbackLanguage' => 'en',
],
'openInNewTab' => true,
],
],
[
'id' => 'eyebrowSpacing',
'name' => '',
'hidden' => false,
'locked' => false,
'condition' => null,
'type' => 'spacer',
'height' => [
'value' => 2.5,
'unit' => '#',
],
],
[
'id' => 'title',
'name' => '',
'hidden' => false,
'locked' => false,
'condition' => null,
'margin' => [
0,
0,
0,
0,
],
'padding' => [
0,
0,
0,
0,
],
'radius' => 0,
'background' => [
'backgroundColor' => [
'color' => '#FFFFFF',
'hide' => true,
],
'backgroundGradient' => [
'hide' => true,
'stops' => [
[
'color' => '#000000',
'position' => 0,
],
[
'color' => '#FFFFFF',
'position' => 100,
],
],
'angle' => 90,
],
'backgroundImage' => [
'hide' => true,
'image' => null,
'size' => 'cover',
'position' => 'middle center',
],
],
'border' => [
'color' => '#000000',
'width' => 1,
'style' => 'solid',
'hide' => true,
],
'color' => [
'color' => '#111111',
],
'fontWeight' => '600',
'fontStyles' => [],
'type' => 'text',
'content' => [
'mode' => 'html',
'values' => [
'en' => [
[
'kind' => 'literal',
'value' => 'Subject',
],
],
'de' => [
[
'kind' => 'literal',
'value' => 'Betreff',
],
],
],
'fallbackLanguage' => 'en',
],
'wordBreak' => 'word',
'textAlign' => 'left',
'fontSize' => 22,
'fontFamily' => 'Fraunces',
'lineHeight' => [
'value' => 115,
'unit' => '%',
],
'letterSpacing' => [
'value' => -0.15,
'unit' => '#',
],
'width' => [
'value' => 100,
'unit' => '%',
],
'height' => [
'value' => 0,
'unit' => '#',
],
'link' => [
'active' => false,
'url' => [
'mode' => 'plain',
'values' => [
'en' => [
[
'kind' => 'literal',
'value' => '',
],
],
],
'fallbackLanguage' => 'en',
],
'openInNewTab' => true,
],
],
[
'id' => 'titleSpacing',
'name' => '',
'hidden' => false,
'locked' => false,
'condition' => null,
'type' => 'spacer',
'height' => [
'value' => 4,
'unit' => '#',
],
],
[
'id' => 'titleRule',
'name' => '',
'hidden' => false,
'locked' => false,
'condition' => null,
'type' => 'separator',
'margin' => [
0,
0,
0,
0,
],
'width' => [
'value' => 14,
'unit' => '#',
],
'align' => 'left',
'line' => [
'color' => '#111111',
'width' => 0.8,
'style' => 'solid',
],
],
[
'id' => 'titleRuleSpacing',
'name' => '',
'hidden' => false,
'locked' => false,
'condition' => null,
'type' => 'spacer',
'height' => [
'value' => 7,
'unit' => '#',
],
],
[
'id' => 'content',
'name' => '',
'hidden' => false,
'locked' => false,
'condition' => null,
'margin' => [
0,
0,
0,
0,
],
'padding' => [
0,
0,
0,
0,
],
'radius' => 0,
'background' => [
'backgroundColor' => [
'color' => '#FFFFFF',
'hide' => true,
],
'backgroundGradient' => [
'hide' => true,
'stops' => [
[
'color' => '#000000',
'position' => 0,
],
[
'color' => '#FFFFFF',
'position' => 100,
],
],
'angle' => 90,
],
'backgroundImage' => [
'hide' => true,
'image' => null,
'size' => 'cover',
'position' => 'middle center',
],
],
'border' => [
'color' => '#000000',
'width' => 1,
'style' => 'solid',
'hide' => true,
],
'color' => [
'color' => '#222222',
],
'fontWeight' => '400',
'fontStyles' => [],
'type' => 'text',
'content' => [
'mode' => 'markdown',
'values' => [
'en' => [
[
'kind' => 'content',
'id' => 'content_en_0',
'property' => [
'variable' => 'root.content',
],
'mode' => 'markdown',
],
],
'de' => [
[
'kind' => 'content',
'id' => 'content_de_0',
'property' => [
'variable' => 'root.content',
],
'mode' => 'markdown',
],
],
],
'fallbackLanguage' => 'en',
],
'wordBreak' => 'word',
'textAlign' => 'left',
'fontSize' => 10.5,
'fontFamily' => '',
'lineHeight' => [
'value' => 155,
'unit' => '%',
],
'letterSpacing' => [
'value' => 0,
'unit' => '#',
],
'width' => [
'value' => 100,
'unit' => '%',
],
'height' => [
'value' => 0,
'unit' => '#',
],
'link' => [
'active' => false,
'url' => [
'mode' => 'plain',
'values' => [
'en' => [
[
'kind' => 'literal',
'value' => '',
],
],
],
'fallbackLanguage' => 'en',
],
'openInNewTab' => true,
],
],
[
'id' => 'contentSpacing',
'name' => '',
'hidden' => false,
'locked' => false,
'condition' => null,
'type' => 'spacer',
'height' => [
'value' => 7,
'unit' => '#',
],
],
[
'id' => 'signOff',
'name' => '',
'hidden' => false,
'locked' => false,
'condition' => null,
'margin' => [
0,
0,
0,
0,
],
'padding' => [
0,
0,
0,
0,
],
'radius' => 0,
'background' => [
'backgroundColor' => [
'color' => '#FFFFFF',
'hide' => true,
],
'backgroundGradient' => [
'hide' => true,
'stops' => [
[
'color' => '#000000',
'position' => 0,
],
[
'color' => '#FFFFFF',
'position' => 100,
],
],
'angle' => 90,
],
'backgroundImage' => [
'hide' => true,
'image' => null,
'size' => 'cover',
'position' => 'middle center',
],
],
'border' => [
'color' => '#000000',
'width' => 1,
'style' => 'solid',
'hide' => true,
],
'color' => [
'color' => '#111111',
],
'fontWeight' => '400',
'fontStyles' => [
'italic',
],
'type' => 'text',
'content' => [
'mode' => 'html',
'values' => [
'en' => [
[
'kind' => 'literal',
'value' => 'Kind regards',
],
],
'de' => [
[
'kind' => 'literal',
'value' => 'Viele Grüße',
],
],
],
'fallbackLanguage' => 'en',
],
'wordBreak' => 'word',
'textAlign' => 'left',
'fontSize' => 12,
'fontFamily' => 'Fraunces',
'lineHeight' => [
'value' => 155,
'unit' => '%',
],
'letterSpacing' => [
'value' => 0,
'unit' => '#',
],
'width' => [
'value' => 100,
'unit' => '%',
],
'height' => [
'value' => 0,
'unit' => '#',
],
'link' => [
'active' => false,
'url' => [
'mode' => 'plain',
'values' => [
'en' => [
[
'kind' => 'literal',
'value' => '',
],
],
],
'fallbackLanguage' => 'en',
],
'openInNewTab' => true,
],
],
],
],
],
],
],
],
'unit' => 'mm',
'languages' => [
'en',
'de',
],
'onlineLetter' => true,
'resources' => [],
'attachment' => null,
],
'textContent' => [
'de' => 'Sehr geehrte Damen und Herren, anbei erhalten Sie Ihre Mitgliedsinformationen. Mit freundlichen Grüßen
',
'en' => '',
],
'email' => null,
'letter' => [
'sendColorPostal' => false,
'sendWithCheaperMethod' => true,
],
'contactType' => 'member',
'recipients' => [
'source' => 'contacts',
'selection' => [
'ids' => [
'6b01bd639a14acdaad4923ca',
],
'selectedCount' => 1,
'isAllSelected' => false,
],
],
];
$context = stream_context_create(['http' => [
'method' => 'POST',
'header' => [
'X-API-Key: YOUR_API_KEY',
'Content-Type: application/json',
],
'content' => json_encode($body, JSON_THROW_ON_ERROR),
'timeout' => 30,
'follow_location' => 0,
'ignore_errors' => true,
]]);
$text = @file_get_contents('https://cloud.campai.com/api/YOUR_ORGANIZATION_ID/YOUR_MANDATE_ID/crm/mailings/messages/send', false, $context);
preg_match('/^HTTP\/\S+ (\d{3})/', $http_response_header[0] ?? '', $match);
$status = (int) ($match[1] ?? 0);
if ($text === false || $status < 200 || $status >= 300) {
throw new RuntimeException("campai HTTP $status (0 means no response)");
}
$result = $text === '' ? null : json_decode($text, true, 512, JSON_THROW_ON_ERROR);
echo json_encode($result, JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR), PHP_EOL;
A request the admin app sent for “Send a member a letter from a template”.
Response
200 Successful response
Content-Type: application/json
-
_idid -
designRevisionnumber
{
"_id": "000000000000000000000001",
"designRevision": 1
}
Errors
No errors of its own are known for this endpoint.
Errors nearly every request can meet are listed under Errors.