Overview
Entities that create invoices or other financial documents may want to use the same memo note or email message text for multiple documents. These texts can be stored in Monite as text templates and fetched on demand. Templates can include{variables} that serve as placeholders for various customer-specific and document-specific values.
Templates can be created for:
- emails (containing invoices, quotes, credit notes, purchase orders; as well as invoice reminders),
- custom notes included in invoices, quotes, and other documents.
List all templates
Each entity starts with a predefined set of templates. To get all available templates, callGET /text_templates. You can optionally filter the results by type, document_type, and is_default. (More details on these fields are given below.)
Examples:
GET /text_templates?document_type=invoice- get all templates for Accounts Receivable invoices.GET /text_templates?is_default=true- get all default templates.GET /text_templates?type=email_header- get all templates for email subject lines.
The TextTemplate object
Monite stores text templates in this format:
TextTemplate object are:
-
name- the display name of a template. -
document_type- the document type for which this template was created. Can be:- invoice
- quote
- credit_note
- discount_reminder - invoice payment reminders sent before the first and second early payment dates (if any) if the invoice is still unpaid.
- final_reminder - payment reminder sent before the invoice due date.
- overdue_reminder - reminders sent after the invoice due date has passed in case the invoice is still unpaid.
- payables_purchase_order
-
type- where this template is used:- email_header - email subject line.
- email_body
- memo - a custom note to be included in the generated document. This is the text for the
memofield in receivables or themessagefield in purchase orders.
-
template- the actual text of a template as a plain JSON-formatted string, such as “New invoice from Acme Inc”. Multiple lines can be separated by\n. The text can include{variables}as placeholders for customer-specific, document-specific, and entity-specific values. For example,"Invoice {invoice_number} from {entity_name}".
Create a template
To create a new template, callPOST /text_templates and specify the template name (display name), the document_type this template will be used for (for example, “quote”), the template type (email_header, email_body, or memo), and the template contents as a JSON-formatted string.
id assigned to the created template. You can use this ID later to retrieve or update the template contents.
Mark a template as default
Each combination ofdocument_type and type has its default template. The default template is indicated by the is_default field set to true.
Entities can use the default templates as-is, change them, assign other default templates, or create and use any number of custom templates.
What does “default” mean?It just means “preferred template”. Note that this does not mean the default template is automatically used by Monite’s subsystems.
POST /text_templates/{text_template_id}/make_default. This template will become the default one for its associated document_type and type.
Update a template
Entities can modify the templates, including the default ones, at any time. To update a specific template, callPATCH /text_templates/{text_template_id}:
The
type and document_type of existing templates cannot be changed. To change these fields, you’ll have to delete the existing template and create a new one instead.Delete a template
UseDELETE /text_templates/{text_template_id} to delete an existing text template that an entity no longer needs: