Skip to main content
View as Markdown

Manage Email Templates - Messaging

Manage Email Templates​

5.1 Create a Template​

POST /api/v1/email-template/add
Content-Type: application/json
Authorization: Bearer <KS>
{
"appGuid": "app-guid-from-registry",
"name": "Event Invitation",
"subject": "You're invited to {eventName}",
"body": "<html><body><p>Hi {recipient.firstName},</p><p>Join us at {eventName}!</p><p><a href='{joinLink}'>Register</a></p></body></html>",
"toAttributePath": "{recipient.email}",
"msgParamsMap": {
"recipient": {"type": "User"},
"eventName": {"type": "String"},
"joinLink": {"type": "MagicLink"}
},
"unsubscribeGroups": ["event-invitations"]
}
FieldTypeRequiredDescription
appGuidstringYesApp Registry GUID (see App Registry API)
namestringYesTemplate name
subjectstringYesEmail subject (supports token references)
bodystringYesEmail HTML body (supports token references)
toAttributePathstringYesToken expression for recipient email
msgParamsMapobjectYesToken definitions (name → {type} mapping)
descriptionstringNoTemplate description
fromstringNoSender email address
fromNamestringNoSender display name
ccstringNoCC email address
bccstringNoBCC email address
unsubscribeGroupsstring[]NoUnsubscribe group IDs
statusstringNoDefaults to "enabled"
adminTagsstringNoComma-separated filter tags
customHeadersobjectNoCustom email headers

Response: Full template object with generated id.

curl -X POST "$KALTURA_MESSAGING_URL/email-template/add" \
-H "Authorization: Bearer $KALTURA_KS" \
-H "Content-Type: application/json" \
-d '{
"appGuid": "'$APP_GUID'",
"name": "Event Invitation",
"subject": "Join us at {eventName}",
"body": "<p>Hi {recipient.firstName}, you are invited to {eventName}.</p>",
"toAttributePath": "{recipient.email}",
"msgParamsMap": {
"recipient": {"type": "User"},
"eventName": {"type": "String"}
}
}'

Save the id from the response as TEMPLATE_ID.

5.2 Get a Template​

POST /api/v1/email-template/get
Content-Type: application/json
Authorization: Bearer &lt;KS&gt;
FieldTypeRequiredDescription
idstringYesTemplate ID
curl -X POST "$KALTURA_MESSAGING_URL/email-template/get" \
-H "Authorization: Bearer $KALTURA_KS" \
-H "Content-Type: application/json" \
-d "{\"id\": \"$TEMPLATE_ID\"}"

Response: Full template object (see section 3 for field definitions).

5.3 Update a Template​

POST /api/v1/email-template/update
Content-Type: application/json
Authorization: Bearer &lt;KS&gt;
FieldTypeRequiredDescription
idstringYesTemplate ID to update
namestringNoUpdated name
subjectstringNoUpdated subject
bodystringNoUpdated HTML body
descriptionstringNoUpdated description
fromstringNoUpdated sender email
fromNamestringNoUpdated sender display name
ccstringNoUpdated CC address
bccstringNoUpdated BCC address
msgParamsMapobjectNoUpdated token definitions
unsubscribeGroupsstring[]NoUpdated unsubscribe group IDs
statusstringNoenabled, disabled, or deleted
adminTagsstringNoUpdated admin tags
customHeadersobjectNoUpdated custom headers
curl -X POST "$KALTURA_MESSAGING_URL/email-template/update" \
-H "Authorization: Bearer $KALTURA_KS" \
-H "Content-Type: application/json" \
-d "{
\"id\": \"$TEMPLATE_ID\",
\"subject\": \"Updated: Join us at {eventName}\",
\"description\": \"Updated event invitation template\"
}"

Fields not included remain unchanged. The version increments on each update.

Response: Full updated template object with incremented version.

5.4 List Templates​

curl -X POST "$KALTURA_MESSAGING_URL/email-template/list" \
-H "Authorization: Bearer $KALTURA_KS" \
-H "Content-Type: application/json" \
-d '{
"filter": {
"appGuidIn": ["'$APP_GUID'"],
"status": "enabled"
},
"pager": {"offset": 0, "limit": 25}
}'

Filter Fields​

FieldTypeDescription
idInstring[]Filter by template IDs
appGuidInstring[]Filter by App Registry GUIDs
namestringFilter by name substring
nameEqstringFilter by exact name match
subjectstringFilter by subject substring
statusstringenabled, disabled, or deleted
adminTagsstringFilter by admin tags substring
adminTagsAllstringMatch templates with all specified tags
excludeAdminTagsstringExclude templates with these tags
createdAtGreaterThanOrEqualstringISO 8601 minimum creation date
createdAtLessThanOrEqualstringISO 8601 maximum creation date
updatedAtGreaterThanOrEqualstringISO 8601 minimum update date
updatedAtLessThanOrEqualstringISO 8601 maximum update date

Pager​

FieldTypeDefaultDescription
offsetinteger0Records to skip
limitinteger30Max records to return

Response: {objects: [...], totalCount: N}

5.5 Delete a Template​

POST /api/v1/email-template/delete
Content-Type: application/json
Authorization: Bearer &lt;KS&gt;
FieldTypeRequiredDescription
idstringYesTemplate ID to delete
curl -X POST "$KALTURA_MESSAGING_URL/email-template/delete" \
-H "Authorization: Bearer $KALTURA_KS" \
-H "Content-Type: application/json" \
-d "{\"id\": \"$TEMPLATE_ID\"}"

Sets the template status to deleted. The template is excluded from list results filtered by status: "enabled".