Direct mail API for Make
Direct mail API for Make: add the HTTP app's Make a request module to any scenario and it sends the trigger's address to Mailr, which prints and mails the postcard. On a daily schedule, the same module can send a whole sheet of recipients as one batch.
What to mail from Make
| When this happens | Mail this |
|---|---|
| Google Sheets: Watch New Rows | A thank-you postcard for each new customer row. (First-order thank you) |
| Webhooks: Custom webhook, called by your form or app at signup | A founder welcome letter, mailed flat (URL /v1/flats). (Welcome letter) |
| A scenario scheduled Every day: Google Sheets Search Rows for lapsed customers | Win-back postcards, sent as one batch of up to 1,000. (Win-back) |
Set it up
- Save your return address in Mailr. In the Mailr dashboard, open Settings and save your return address. The body can then leave out from.
- Add the module and its keychain. After your trigger, add HTTP > Make a request. Set Authentication type to API key and create a keychain: Key Bearer mlr_test_..., placement in the header, parameter name Authorization. Make's own guidance is to keep credentials there rather than in Headers.
- Set the request. URL https://api.mailr.dev/v1/postcards, method POST, and one header: Idempotency-Key, built from the trigger's record id. Body content type application/JSON.
- Enter the body. With Body input method set to Data structure, Make escapes every mapped value for you. With JSON string, paste the body from the second tab and map fields into it; you escape values yourself.
- Turn on errors and retries. Set Parse response and Return error if HTTP request fails to Yes. Add a Retry error handler to the module, and in scenario settings turn on Store incomplete executions, which the handler needs.
- Write the id back, then go live. Map the response's data id into a later module, such as Google Sheets Update a Row. Run once with the test key and check the postcard in your Mailr dashboard; nothing prints. Then change the keychain's key to your mlr_live_ key.
The Make a request module
Module HTTP > Make a request
Authentication type API key
Keychain Key: Bearer mlr_test_...
API key placement: header
API key parameter name: Authorization
URL https://api.mailr.dev/v1/postcards
Method POST
Headers Idempotency-Key = sheet-thank-you-{{1.id}}
Body content type application/JSON
Body input method JSON string (or Data structure, which escapes values)
Body content the JSON in the next tab
Parse response Yes
Advanced settings
Return error if HTTP request fails Yes
Timeout 30
Error handler on this module: Retry
Automatically complete execution Yes
Scenario settings: Store incomplete executions = Yes- Unless Return error if HTTP request fails is Yes, a 4xx or 5xx answer from Mailr doesn't stop the scenario, so a 422 for a bad address would pass silently.
- The Retry error handler stores the failed bundle as an incomplete execution and runs it again. The Idempotency-Key makes a retry that reaches Mailr within 24 hours return the first piece instead of a second one.
- A JSON string body isn't escaped. A mapped value with a double quote in it breaks the JSON and Mailr answers 400 invalid_json. Data structure input escapes values for you.
- Mailr needs a two-letter state and a 5-digit ZIP or ZIP+4. Google Sheets can drop the leading zero from ZIPs like 02134 if the column is formatted as numbers; format it as plain text.
- Make's Timeout setting takes 1 to 300 seconds. A batch of 1,000 is one request, so 30 seconds leaves plenty of room.
What it costs
Each live piece is paid from your Mailr balance, printing and postage included: a 4x6 postcard is $0.85, a 6x9 $0.89 and an 8.5x11 letter $0.95 on pay as you go, less on a plan. Test pieces are free. All prices.
Templates that fit: First-order thank you (6x9), Welcome letter (8.5x11), Win-back (6x11).
Questions
Is there a Mailr app in Make?
No. Mailr has no Make app yet, so the scenario uses the built-in HTTP app's Make a request module to call the REST API. Older scenarios built on HTTP (legacy) work with the same URL, headers and body.
How do I send a whole sheet at once?
Aggregate the rows into a recipients array and send one request to /v1/batches, as in the Daily batch tab. A batch takes up to 1,000 recipients and is all or nothing: if one address is invalid, nothing is created and the error's field names the recipient, like recipients[3].to.state.
How do I know when a postcard is delivered?
Mailr has no webhooks yet, so it can't start a scenario on its own. A Make a request module with GET https://api.mailr.dev/v1/postcards/{id} and the same keychain returns the status and every event.
What does it cost per postcard?
One price per piece, printing and postage included: $0.89 for a 6x9 postcard on pay as you go, less on a plan. Test pieces are free. Make counts its operations separately.