Skip to content
Branch: master
Find file History
Type Name Latest commit message Commit time
Failed to load latest commit information. cleanup Jul 2, 2019
index.js cleanup Jul 2, 2019
package.json fix(deps): update dependency postmark to v2.2.9 Aug 7, 2019
yarn.lock fix(deps): update dependency postmark to v2.2.9 Aug 7, 2019

Order Confirmation Email

This example demonstrates how you can send order confirmation emails via Postmark using Moltin webhooks.

How to use locally

When running this example locally it's recommended you use a service like ngrok to tunnel your dev environment to the outside world.

Once you have the repo running locally, you'll want to add the integration via the Moltin Dashboard. The URL will be the one provided by ngrok.

1. Download the example

Clone the repository:

git clone

Install dependencies with Yarn

cd integration-examples/order-confirmation-email

2. Configure Postmark

In this example we will use Postmark to send our emails. They also take care of hosting the email template.

Once you signed up to Postmark, create a new server and add a new template with the following code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <style type="text/css"></style>
      Thank you for your order {{customer_name}}. The total for your order was
        {{#each order_items}}
          <td>{{quantity}} x {{meta.display_price.with_tax.unit.formatted}}</td>

This template is just an example, but anything you provide inside the templateModel object you will have access to inside this template.

Once you've saved the template, you will need to make a note the ID of the template:

Postmark template ID

Next you will need a Server API token from the Credentials tab.

Postmark API tokens

3. Configure your ENV variables

You will want to create an .env inside the directory /order-confirmation-email containing all the keys for the below:


MOLTIN_WEBHOOK_SECRET can be anything you want.

4. Start the server and ngrok

Start the development server

yarn dev

The server will typically start on PORT 3000, if not, make a note for the next step.

Start ngrok

ngrok http 3000

This will expose PORT 3000 to the outside world. Make a note of the http URL ngrok provides.

5. Create a new Moltin integration

You must now tell Moltin the ngrok URL above. Head to the Moltin Dashboard, login and go to Settings > Integrations and click Create.

Enter a name and description for your Integration. We recommend you prefix the name with DEVELOPMENT:.

Next, enter the URL and Secret Key that match those inside .env.

URL and Secret Key

Now finally you'll want to configure when this webhook will be invoked, in this example check the Paid/Captured box.

Observes selection

That's it! Click Save

You can’t perform that action at this time.