Templates
Write a letter once, publish the slug, and send it with the fields filled in.
-
01
Start a draft
Open Templates. Start a blank letter, or use a starter design. A starter saves an unpublished draft you can edit. The starters cover welcome, privacy policy, terms of use, sign-in code, password reset, come back, and latest news.
-
02
Fill the fields
Set the name, slug, subject, and locale. Put {{name}} fields in the subject and the HTML. Preview text is the line an inbox shows under the subject. The editor preview stays on the page.
-
03
Publish it
Publish when the letter is ready. An unpublished slug is rejected. The same slug can exist once in each locale.
-
04
Send by slug
POST /api/emails with template set to the slug and variables for those fields. When that slug exists in more than one locale, send locale as well. With several locales and an English version, omitting locale sends the English one.
A slug is lowercase letters, numbers, and hyphens. variables replaces each {{name}} in the subject, HTML, and text. A subject, html, or text field on the same request replaces that part of the template. Leave those out to send the published letter. Pigeon fills {{unsubscribe}} with a personal link. After someone uses that link, the address is left off later mail from the same domain until you subscribe them again on their audience page.
curl -X POST https://pigeonfs.com/api/emails \ -H "Authorization: Bearer pg_your_api_key" \ -H "Content-Type: application/json" \ -d '{ "from": "Ada <ada@yourdomain.com>", "to": ["person@example.com"], "template": "welcome", "locale": "en", "variables": {"name": "Ada", "url": "https://example.com/start"} }'
Send sample on the editor fills the variables and delivers a real email. It counts toward the quota. Translate saves an unpublished draft of the same slug in another locale, and the {{name}} tokens stay where they are. Publish that locale before you send it. You can file a template under a verified domain so the list groups it there. The from address on the request is still the domain the mail uses, and that domain has to be verified.
A newsletter is a separate subscribe page Send with the API