Skip to content
POST/{organizationId}/{mandateId}/crm/messageTemplates

Create message template

Creates a new message template

Required permissions:

  • mandate.read

  • dispatchDocument.insert

Path Parameters

organizationIdstringrequired
mandateIdstringrequired

Request Body required

Content-Type: application/json

namestringrequired

minLength: 1

maxLength: 100

descriptionstringrequired

maxLength: 140

typestringrequired

Options:

emailletter
templateContentsDefaultbooleanrequired
scopestring | nullrequired

Options:

localglobal
draftboolean | nullrequired
contactTypestring | nullrequired

Options:

memberaddresscustomersponsorcontributoremployeesupplier
copyOrgEmailTemplateContentsbooleanoptional

Default: false

Authentication: X-API-Key

Request

POST/{organizationId}/{mandateId}/crm/messageTemplates
curl --request POST 'https://cloud.campai.com/api/{organizationId}/{mandateId}/crm/messageTemplates' \
  --header 'X-API-Key: YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
  "name": "string",
  "description": "string",
  "type": "email",
  "templateContentsDefault": true,
  "templateContents": {},
  "email": {
    "subject": "string",
    "previewText": "string"
  },
  "scope": "local",
  "allowedPlaces": [
    "mailings"
  ],
  "draft": true,
  "contactType": "member",
  "letter": {
    "sendColorPostal": true,
    "sendWithCheaperMethod": true
  },
  "templateAttachment": {}
}'

Responses

This endpoint returns different response codes based on the request outcome.

200Successful response

Content-Type: application/json

ObjectId as string

Response

200
{
  "_id": "000000000000000000000001"
}

400Invalid input data

Content-Type: application/json

The error information

messagestringrequired

The error message

codestringrequired

The error code

An array of issues that were responsible for the error

Response

400
{
  "code": "BAD_REQUEST",
  "message": "Invalid input data",
  "issues": []
}

401Authorization not provided

Content-Type: application/json

The error information

messagestringrequired

The error message

codestringrequired

The error code

An array of issues that were responsible for the error

Response

401
{
  "code": "UNAUTHORIZED",
  "message": "Authorization not provided",
  "issues": []
}

403Insufficient access

Content-Type: application/json

The error information

messagestringrequired

The error message

codestringrequired

The error code

An array of issues that were responsible for the error

Response

403
{
  "code": "FORBIDDEN",
  "message": "Insufficient access",
  "issues": []
}

500Internal server error

Content-Type: application/json

The error information

messagestringrequired

The error message

codestringrequired

The error code

An array of issues that were responsible for the error

Response

500
{
  "code": "INTERNAL_SERVER_ERROR",
  "message": "Internal server error",
  "issues": []
}