You are reading the documentation for an outdated Corteza release. 2024.9 is the latest stable Corteza release.

Email automation: processing inbound email

Corteza supports email automation and processing of incoming email messages. This can be achieved through local email service like [postfix] or 3rd party provider that forward received emails through webhooks.

Flow:
  1. Email is received by internal or external system

  2. Email is forwarded to sink API endpoint

  3. Corteza sink service extracts header and body data from received email

  4. onReceive triggers are filtered for a match (trigger can be configured to match specific headers like sender or subject)

  5. Automation script is called

Preparing (signing) sink URL

Signing the URL (the sign=…​ parameter and value) is created as a combination of all parameters and Corteza’s secret string. This signature should be kept secret as it is effectively same as password that allows access to Corteza.

Example:
docker-compose exec server system sink signature --method POST --origin postfix --content-type email
Command will output a line that looks like this:
/sink?content-type=email&expires=&method=POST&origin=postfix&sign=6280d530ae74f1f9c55e4dd362c9ef2094221287
Table 1. Parameters:
Parameter Description

method

must match the request method

origin

arbitrary string, can be used to describe

content-type

used to set the processor for the data inputed

expires

can be used to sign link with expiration date.

Validation
echo "
From: 
To: 
Subject: hello
Message-ID: <1234@local.machine.example>

Ola Corteza!
" | curl -i --data-binary @- "https://api.your-corteza-instance.tld/system/sink?content-type=email&expires=&method=POST&origin=postfix&sign=6280d530ae74f1f9c55e4dd362c9ef2094221287'"

This command must return 200 OK response.