Letter templates

Create a letter template

Writes a new letter template from email and chat content you supply. Every placeholder in that content is checked against the channels you name, and the whole call fails if one of them is not offered. Requires the letter_templates:write permission.

POST
https://services.magicdoor.com/communications/company-portal/letter-templates

Authorization

Authorizationstringrequired
Bearer token — Send your API token in the Authorization header as Bearer <token>. Requests without a valid token are rejected with 401 Unauthorized.

Body

application/json

At least one of emailBody and chatContent must be filled in — a template with neither is rejected.

namestring

The name shown to the property manager. Up to 250 characters.

letterTemplateGroupIdstring

File the template under this group. A 64-bit number sent as a string. Leave it out to keep the template ungrouped.

communicationChannelsenum<string>[]required

The kinds of recipient this template can be addressed to. Each value decides which placeholders the content may use — a lease template can use {{rent_amount}}, a vendor template cannot. When several are listed, only the placeholders every one of them offers are allowed.

tenantownervendorleasemaintenanceRequestworkOrderrentalApplicationpropertyManagercompany
emailSubjectstring

Subject line for the email form of this template. Up to 500 characters. Placeholders are allowed and are validated the same way as the body.

emailBodystring

The email body, as HTML. No length limit.

chatContentstring

The chat message body, as plain text. Up to 5000 characters.

Response

200 · The template that was created.

idstringrequired

The letter template. A 64-bit number sent as a string — do not parse it as a JavaScript number.

letterTemplateGroupIdstring

The group this template is filed under. Absent while the template is ungrouped.

namestring

The name shown to the property manager. Absent when the template was created without one.

communicationChannelsenum<string>[]required

The kinds of recipient this template can be addressed to.

tenantownervendorleasemaintenanceRequestworkOrderrentalApplicationpropertyManagercompany
emailSubjectstring

Subject line used when the template is sent as an email. Absent when the template is chat-only.

emailBodystring

The email body, as HTML, with placeholders still in {{key}} form. Absent when the template is chat-only.

chatContentstring

The chat message body, as plain text, with placeholders still in {{key}} form. Absent when the template is email-only.

sourceFileIdstring

The uploaded Word file this template was imported from. Present only on imported templates, and it is what isImported filters on.

createdstring · date-timerequired

When the template was created, in the company's timezone and with no offset.

updatedstring · date-timerequired

When the template was last changed, in the company's timezone and with no offset.

400 · `communicationChannels` is empty, both `emailBody` and `chatContent` are blank, or the content uses a placeholder the named channels do not offer. The `detail` names the offending placeholders.

401 · The access token is missing, expired, or not a property-manager token.

403 · The token is valid but the caller does not hold the `letter_templates:write` permission.

404 · `letterTemplateGroupId` names a group that does not exist, or belongs to another company.

Errors come back as application/problem+json. See Errors for the shape.