Email Trigger
Know the trigger and how to use it.
Email trigger delivers data from an email inbox into the pipeline. Learn the configuration parameters on the example below:
1. Open the trigger settings and select the email type.
2. Specify the values on each field:
- Account: specify the account for the trigger to access the correct email.
- Operation: choose the option "mark as read" (there're other options, which we'll explain ahead).
- Hostname: insert the name of the IMAP server host (eg.: imap.uol.com).
- Port: determine the port.
- E-mail Folder: define the folder / inbox name that will be read (eg.: inbox). This folder cannot have more than 100 messages (read / unread).
- Destination E-mail Folder: point which folder the message should be moved to. Keep in mind that this field appears only when the option "move to another folder" is selected in the Operation parameter. In this example, "mark as read" was selected, so the field will not be available.
- Maximum Timeout: fill in the maximum trigger execution time.
- Allow Redelivery Of Messages: if activated, the option allows messages to be redelivered in case of Pipeline Engine failure.
3. Click on "Confirm".
4. Move on with the pipeline building.
5. Connect its components.
6. Deploy the pipeline:
- Click on "Run", located in the upper part of the screen.
- Select the environment, which can be test or prod.
- Click on "Create new deploy".
- Select the pipeline with its version and capacity.
- Click on "Confirm".
7. When triggered, the pipeline will receive a payload similar to the one below:
{
"textMessage": "",
"htmlMessage": "Hi, Pedro\r\nI still have not received the report for this month.
Can you send it until the end of the day?",
"attachments": ["attachment_fileName1", "attachment_fileName2",
"attachment_fileName3"]
"subject": "Monthly Report",
"from": ["Renato Peixe Junior <[email protected]>"],
"to": ["[email protected]"],
"cc": [],
"bcc": [],
"replyTo": ["Renato Peixe Junior <[email protected]>"],
"sentDate": "2020-02-10T17:54:40Z[UTC]",
"receivedDate": "2020-02-10T17:54:52Z[UTC]"
}
- data: content of the message
- subject: topic of the message
- from: e-mail of the sender
- to: e-mail of the recipient
- cc: recipients put on copy
- bcc: recipients put on blind-copy
- replyTo: destination e-mail of the answer
- sentDate: dispatch date of the message
- receivedDate: receivement date of the message
- mark as read: select this option if, after processed, you want the message to be marked as “read”.
- move to another folder: select this option if, after processed, you want the message to be moved to a predetermined folder. The destination is specified in the "Destination email folder" field, which appears in the configurations only when "move to another folder" is selected.
- delete: select this option if, after processed, you want the message to be deleted.
If there's an attachment in the body message received by the trigger, it will download and make them available inside the pipeline execution directory. The name of the attachments will be contained inside the property attachments and this property will be an array of strings containing the name of the attachments.
IMPORTANT: if there're 2 attachments with the same name in the message, an unique identifier will be added in the name of the downloaded attachment.
Example:
There're 2 attachments with the name "file.csv" inside the message. Therefore, the content of the property attachments will be:
{
"attachments": ["file.csv", "0072e485-8ba2-4f79-bba5-8068e37ee792_file.csv"]
}
The identifier varies at each execution.
Note: When using Gmail as the IMAP server host, it's necessary to authorize the support of less secure applications. Click here to see the step-by-step.
Last modified 5mo ago