Search

Connectors

Contact support

Helpdesk portal

Postmark - Getting started in Peliqan

Postmark - Getting started in Peliqan

Postmark is one of the connectors offered in Peliqan to send emails and receive emails.

Postmark offers a free license that does not expire, for up to 100 emails per month.

More info: https://postmarkapp.com/pricing

Connect Postmark

Sign up for an account on Postmark first. Create a “Server” in Postmark.

Copy the API token of the Server. In Peliqan, go to Connections > Add connection.

Find Postmark in the list of available connectors and select it. Paste the API token and save.

Send out emails

Here are example scripts in Peliqan to send out emails.

Send an email

Send email with text file as attachment

Send email with CSV or PDF as attachment

See the Alerting & Messaging section for examples on how to send out CSV files with data from a Peliqan table:

Alerting & messaging

See the Reporting section for a detailed example on how to generate a PDF file and send that PDF file as an attachment in an email:

Generate and distribute PDF reports

Receive emails (incoming emails)

In Peliqan, go to Admin > Settings and copy your Account Webhook URL.

This is your Peliqan URL to receive incoming webhook events. Every incoming webhook event will be stored in your Peliqan data warehouse, in a table webhook.incoming_webhooks. This table will automatically be created on the first incoming webhook.

In Postmark, go to your Server > Message Streams > Default inbound Stream.

Paste your Peliqan Account Webhook URL in Postmark in the field inbound webhook URL.

Note down your Postmark email address to receive emails. It will look like this:

41b12...569d@inbound.postmarkapp.com

Send an email to this address. Check if it is processed by Postmark and forwarded to the Peliqan webhook URL. Next, check if you can find a new row in the table webhook.incoming_webhooks in your Peliqan DWH.

Finally, you can process these incoming emails with a script in Peliqan:

Set webhooks as processed

To avoid reprocessing webhook records, add a column “status” to the table and update this field after processing a webhook:

dw.update(dw_name, 'webhook', 'incoming_webhooks', incoming_webhook["id"], {"status": "processed"})

In the above script, exclude processed webhooks using a query:

incoming_webhooks = dw.fetch(pq.DW_NAME, query = "SELECT * FROM webhook.incoming_webhooks WHERE status != 'processed'; ")

Receive emails with attachments

Here’s an example to process incoming emails with attachments (example with Excel files):

Troubleshooting

If you use special characters in HTML such as ø or ö, you need to replace them with escaped unicode, before sending to Postmark. Example:

There are various other special characters that have to be replaced in HTML, such as line breaks, tabs, double quotes. Here’s another example where we replace characters such as ö with o: