Appearance
Receivers
Receivers are similar to Jobs in that they allow endpoints to be invoked by means other than calling them directly. In this case, they allow for monitoring an email or GovNotify SMS inbox, and run the endpoint with the content of any messages that arrive with the chosen Subject prefix. MESH receivers are also available for tenants which have been granted access.
Creating an email or GovNotify SMS Receiver
Creating a Receiver is simple enough, and just requires a few details to be able to log into the account you wish to monitor. To quickly get started, you can follow these steps:
- Enter a name for the Receiver in the
Name
field - Select the receiver type
- Enter an email in the
Error Email
field if you want to be notified of any problems - Tick
Disable on failure
if you want to stop attempting to process other messages when there's a problem - Select the endpoint you wish to run
- Select the version of the endpoint you wish to run - if you don't select a version then Production will be set
- Shape your endpoint input (see
Shaping the data
below for details on how to do this)
If using email:
- Enter the POP3 address for the server in the
POP3 Email Receiver
field. e.g.pop.gmail.com:995
- Choose a Subject Prefix for your emails. The Receiver will trigger whenever an email with a subject that starts with this arrives
- Enter your email's username and password. Your username is often the email address, or the start of your email address (before the @) depending on your provider
If using GovNotify SMS:
- Enter the source and destination number
- Choose a Message pattern for your emails. The Receiver will trigger whenever a message that starts with this pattern arrives
- Enter the password associated with your GovNotify account
Shaping the data
Often, the email will not directly contain exactly the information you want in exactly the right format. In order to better allow you to get what you need, you can access various properties in the email using the Liquid object data
. This object takes the following shape:
Email receiver:
json
{
"Headers": {
"From": "<email>",
"To": "<email>",
"Subject": "<text>",
"Date": "<date>"
},
"Content": "<text>",
"Attachments": [{
"FileName": "<text>",
"Bytes": "<base64>",
"Text": "<text>",
"FileSize": <int>,
"ContentType": "<mimetype>"
}
]
}
For example, if you wanted to get the sender of the email, you would use \{\{ data.Headers.From }}
.
SMS receiver:
json
{
"id": "unique message identifier",
"sourceNumber": "sender's phone number",
"destinationNumber": "receiving phone number",
"message": "SMS content",
"received": "timestamp of receipt",
"authToken": "authentication token"
}
{{ data.message }} // Get message content
{{ data.sourceNumber }} // Get sender's number
{{ data.received }} // Get receipt timestamp
Archive Attachments (Email only)
AireGlu has the ability to extract files from ZIP archives and provide the data from that field instead. To do this, you should enter the expected filename of the ZIP file, and the file name of the file you wish to extract. If the ZIP file is password protected, then you should enter the password needed to extract it.
The extracted file can be accessed via the Attachments
property.
MESH Receiver
Data can be retrieved from a MESH mailbox and made available in the following format:
json
{
"Headers": {
"SenderMailboxId": "<mailbox id>",
"RecipientMailboxId": "<mailbox id>",
"Subject": "<text>",
"WorkflowId": "<id>",
"MessageId": "<id>"
},
"Content": "<base64>"
}
The content of a MESH message can be either text or binary file type. Therefore, AireGlu will return the content of the message as a base64 string. If you are expecting a text file, you can decode the base64 string by calling the inbuilt mapping function like so:
--*AG:Base64Decode({{data.Content}})*--