Email Trigger

The Email Trigger fires a workflow whenever an email is sent to your application’s email address or one of its subaddresses.

Inbound Email Trigger

Node Properties

The Email Trigger takes one optional property: a Subaddress that, when defined, must be included as part of the application email address in order to fire the trigger. More information on subaddressing - also known as “plus addressing” - can be found here.

Usage

The trigger fires when an email is received at the application’s email address, either as a “To”, “CC”, or “BCC” recipient. The message recipients, body, and attachments are available in the trigger’s initial payload.

Your application’s email address is <YourApplicationId>@workflows.losant.com. For example, given an application ID of “abc123def456abc789def012”, you could fire an Email Trigger without a subaddress by sending an email to abc123def456abc789def012@workflows.losant.com. (The address is also listed at the bottom of the trigger’s editor.)

If a Subaddress is configured in the trigger, the Subaddress must be included in the email address after the application ID and a plus sign (+). Given the example above and a Subaddress of “bulkState” provided in the trigger configuration, the trigger will only fire on emails sent to abc123def456abc789def012+bulkState@workflows.losant.com.

Private Installation Setup

If using Losant in a private installation, additional setup is required in the SendGrid account that’s tied to the installation. Until that work is completed, the Email Trigger is hidden from the workflow palette.

Contact your account manager at Losant if you would like to enable the Email Trigger for your private installation.

Payload Consumption

Every email received at your application’s address - with our without a subaddress - counts as one billable payload. It is the receipt of the email that counts as a payload, whether that payload causes zero, one, or several workflows to execute.

Payload

The payload will include the email info in the data field. In the general case, an Email Trigger workflow payload will look like the following:

{
  "applicationId": "555555555555eeeeeeeeeeee",
  "applicationName": "My Great Application",
  "data": {
    "subject": "Example Email Subject",
    "html": "<html><body>Example Email HTML</body></html>",
    "text": "Example Email Text",
    "senderIp": "1.2.3.4",
    "from": {
      "name": "Bob",
      "email": "bob@example.com"
    },
    "to": [
      {
        "email": "568beedeb436ab01007be53d+bulkState@workflows.losant.space"
      }
    ],
    "cc": [
      {
        "name": "John",
        "email": "john@example.com"
      },
      {
        "name": "Alice",
        "email": "alice@example.com"
      }
    ],
    "messageId": "messageIdFromEmailHeaders",
    "attachments": [
      {
        "filename": "example.csv",
        "contentType": "text/csv",
        "url": "https://example.com/example.csv",
        "size": 12345
      }
    ]
  },
  "flowId": "333333333333cccccccccccc",
  "flowName": "My Great Workflow",
  "flowVersion": "myFlowVersion",
  "globals": {
    "aJsonGlobal": {
      "key": "value"
    },
    "aNumberGlobal": 42,
    "aStringGlobal": "My value"
  },
  "relayId": "000000000000000000000000",
  "relayType": "public",
  "time": Fri Feb 19 2016 17:26:00 GMT-0500 (EST),
  "triggerId": "default|mySubAddress",
  "triggerType": "inboundEmail"
}

Recipients

The to, cc, and bcc fields, if present, are each an array of objects with an email property and optionally a name property. These describe the recipients of the email, including the application email address that fired the trigger.

The bcc property is only present if the trigger’s email address was included as a BCC recipient of the message.

The from property takes the form of a recipient object; however, since emails can only have one “From” address, this property is not an array.

Body

The plain-text email subject is included under the subject property. The body of the message may be included under the html property (which includes any markup that was part of the message) and/or the text property (which is the plain-text version of the email body).

Attachments

If any attachments were included in the message, information about the attachments - including a signed URL where each can be downloaded - is included as an array of objects under the attachments property. If you would like to download the contents of an attachment for use in a workflow run, you can do so using the HTTP Node.

The signed URLs expire after 7 days. If you would like to save the attachment long-term, use a File: Create Node to save the contents to your Application Files.

Limitations & Throttling

  • A maximum of 10 attachments will be included on the payload; if the message includes more than 10 attachments, those after the 10th one will not be included.
  • The total size of an entire email message — including all message attachments combined — cannot exceed 10MB. If the message exceeds the 10MB total, the email will be dropped and will not queue a workflow execution.
  • The inbound email rate limit is 30 messages in a 15-second window per application (on average, 2 messages per second). Any messages exceeding this limit will not queue a workflow execution.

Was this page helpful?


Still looking for help? You can also search the Losant Forums or submit your question there.