Skip to content

TemplateService

Manages message templates with append-only versioning. Templates define the content delivered to campaign recipients.

MethodDescription
CreateTemplateCreate a new template
UpdateTemplateUpdate a template (creates new version)
GetTemplateGet a template by ID
ListTemplatesList templates for the organization

Create a new template (version 1).

Authorization: Requires MANAGE_TEMPLATES permission

FieldTypeDescription
namestringTemplate name. Max 200 characters.
bodystringMarkdown template content. Max 100,000 characters.
typeTemplateTypeTemplate type (PUSH, REMINDER, GENERAL).
variablesTemplateVariable[]Variable definitions.
FieldTypeDescription
templateTemplateThe created template (version 1).

TypeScript (Connect-Web)

const response = await templateClient.createTemplate({
name: "security-update",
body: "# Security Update\n\nHi {{name}},\n\nPlease review...",
type: TemplateType.PUSH,
variables: [
{ name: "name", source: TemplateVariableSource.AUDIENCE },
],
});

Go (gRPC)

resp, err := templateClient.CreateTemplate(ctx, &pidgrv1.CreateTemplateRequest{
Name: "security-update",
Body: "# Security Update\n\nHi {{name}},\n\nPlease review...",
Type: pidgrv1.TemplateType_PUSH,
Variables: []*pidgrv1.TemplateVariable{
{Name: "name", Source: pidgrv1.TemplateVariableSource_AUDIENCE},
},
})

Update a template. Creates a new version — previous versions are preserved.

Authorization: Requires MANAGE_TEMPLATES permission

FieldTypeDescription
idstringTemplate ID.
bodystringUpdated Markdown content.
variablesTemplateVariable[]Updated variable definitions.
FieldTypeDescription
templateTemplateThe updated template with incremented version.

Authorization: Requires VIEW_TEMPLATES permission

FieldTypeDescription
idstringTemplate ID.
versionint32Specific version to retrieve. 0 returns latest.
FieldTypeDescription
templateTemplateThe template.

Authorization: Requires VIEW_TEMPLATES permission

FieldTypeDescription
paginationPaginationPagination parameters.
FieldTypeDescription
templatesTemplate[]List of templates (latest versions).
paginationPaginationMetaPagination metadata.
FieldTypeDescription
idstringUnique identifier.
namestringTemplate name.
bodystringMarkdown content.
versionint32Current version number.
typeTemplateTypeTemplate type.
variablesTemplateVariable[]Variable definitions.
created_atTimestampCreation timestamp.
updated_atTimestampLast update timestamp.
FieldTypeDescription
namestringVariable name (used in {{name}} syntax).
sourceTemplateVariableSourceWhere the variable value comes from.
ValueDescription
PUSHPush notification template
REMINDERReminder template
GENERALGeneral-purpose template
ValueDescription
AUDIENCEPer-user value from campaign audience
CUSTOMStep-level value from workflow config