Skip to content

templates command

Igor Balos edited this page May 21, 2019 · 13 revisions

Provides a push and pull workflow for your email templates. This lets you store your templates in version control and push to Postmark via a CI/CD pipeline.

⚠️ Before you get started, make sure that all of your templates have an alias. Check out our help doc for more info.

pull <output directory> [options]

Download templates from a Postmark server to your local file system.

$ postmark templates pull ~/Desktop/my_templates

# Options
--overwrite, -o  Overwrite templates if they already exist
                                                    [boolean] [default: false]

Here’s an example of the directory structure that is downloaded:

my_templates
├── password_reset
│   ├── content.html
│   ├── content.txt
│   └── meta.json
└── welcome
    ├── content.html
    └── meta.json

Each template is stored in its own subdirectory with the HTML and text content, and metadata. The metadata contains the template’s name, subject, and alias.

NOTE: If you update the template alias in meta.json, be sure to rename the template’s directory so it matches. This prevents conflicts down the line when pulling templates.

push <templates directory> [options]

Pushes templates from the local file system to a Postmark server.

$ postmark templates push ~/Desktop/my_templates

# Options
--force, -f  Disable confirmation before pushing templates           [boolean]

By default, you will be asked to confirm your changes before pushing your templates.

You can force push templates which disables the confirmation by including the -f flag.

$ postmark templates push ~/Desktop/my_templates -f
Clone this wiki locally