Letter templates

Import a letter template

Turns an uploaded Word document into a letter template: the .docx is converted to HTML and stored as the email body. Requires the letter_templates:write permission.

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

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

uploadSessionId must name a session you have already uploaded a .docx to. The file is claimed by the new template, so a session can only be imported once.

uploadSessionIdstringrequired

The sessionId from Start a template file upload. A 64-bit number sent as a string.

namestring

The name shown to the property manager. Up to 250 characters. Leave it out and the file's name without its extension is used.

letterTemplateGroupIdstring

File the template under this group. A 64-bit number sent as a string.

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. Leave it out and the file's name without its extension is used.

chatContentstring

A chat message body to store alongside the imported email body. Up to 5000 characters. There is no way to supply emailBody here — it comes from the document.

Response

200 · The template that was created. `emailBody` is the converted document and `sourceFileId` points at the file it came from.

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 · The uploaded file is not a .docx, the document could not be converted, `communicationChannels` is empty, or the converted body uses a placeholder the named channels do not offer.

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.

422 · The upload session is unknown, expired, already used, or the file was never uploaded to it.

Placeholders survive the conversion, so write {{first_name}} into the Word document and it stays a placeholder in the imported template. They are validated against communicationChannels after conversion, and one the channels do not offer fails the whole import.