create-custom-destination-template
Description
Creates a destination with a custom message template. This command allows you to define both the message template and destination configuration in a single operation, useful when the standard templates (Journey, Interact, CDP, Generic) don't meet your requirements.
Syntax
Windows:
CliTool.bat create-custom-destination-template -f <path-to-json-file>
Linux:
./CliTool.sh create-custom-destination-template -f <path-to-json-file>
Example Execution
Windows:
CliTool.bat create-custom-destination-template -f "C:\destinations\create-destination-new-template.json"
Linux:
./CliTool.sh create-custom-destination-template -f /home/user/destinations/create-destination-new-template.json
Sample Output
Success:
Custom destination message template created successfully with ID: 58
Error:
Error creating custom destination message template: Custom message template configuration is missing required field 'type'
JSON Payload Example
Sample file: Use the create-destination-new-template.json file located in <path-to-resource-folder>.
{
"type": "CUSTOM_EVENT",
"template": "{ \"event\": { \"eventId\": \"${event.eventId}\"<#-- Iterate over the dynamic attributes (Profile and Tuple attributes) --><#if (event.profileAttributes)?? && event.profileAttributes?has_content>,<#list event.profileAttributes as attr>\"${attr.name}\": \"${attr.value}\"<#sep>,</#sep></#list></#if><#if (event.tupleAttributes)?? && event.tupleAttributes?has_content>,<#list event.tupleAttributes as attr>\"${attr.name}\": \"${attr.value}\"<#sep>,</#sep></#list></#if>}}",
"templateConfig": {}
}
JSON Schema Breakdown
Note: This schema describes
DestinationMessageTemplateDto, the payload for the
create-custom-destination-template command. It is used
only when defining a new message template. The newly created template's
ID can subsequently be referenced from a create-destination
payload.| Field | Type | Required | Description |
|---|---|---|---|
type |
string | ✅ Yes | Custom message type identifier (e.g., "MY_CUSTOM_TYPE", "CUSTOM_EVENT"). Must be unique across all templates (case-insensitive). Automatically uppercased on save. |
template |
string | ✅ Yes | FreeMarker template string defining the message body format. Must not be blank. |
templateConfig |
object | ❌ No | Template-specific configuration as key-value pairs. Keys defined
here become required in the messageConfig of any
destination using this template. |
id |
integer | ❌ Read-only | Assigned by the system on save — ignored if provided on input. |
name |
string | ❌ Ignored | Derived from type (lowercased +
-template suffix). Any value supplied is
ignored. |
Example Template Configs:
Simple Template:
"templateConfig": {
"messageSource": "Unica-Detect"
}
Custom Event Template:
"templateConfig": {
"eventSchema": "custom_event_v2",
"includeTimestamp": "true",
"compressionType": "gzip"
}
Important Notes
- Template-only payload: This command creates a message template
only — no
Destinationis persisted. To create a destination that uses the new template, retrieve its ID viaget-all-message-templatesand invokecreate-destinationwith thattemplateId. - Template Type: Must be unique across all templates (case-insensitive).
- Template Config: Template Config is optional. Any key declared here must
be supplied in the
messageConfigwhen creating a destination from this template. - Use Cases:
- Custom message formats not supported by Journey/Interact/CDP/Generic templates
- Testing and prototyping new message formats