The email.parse: command parses a MIME-encoded email message into a ticket.

start:
  email.parse/parse:
    output: results
    inputs:
      message@text:
        From: customer@cerb.example
        To: support@cerb.example
        Subject: This is an example
        
        This is an example message.
    on_simulate:
      set:
        results:
          _context: ticket
          id@int: 123
    on_success:
      return:
        ticket_id@key: results:id

Syntax

inputs:

Key  
message@text: A MIME-encoded email message as a text block. At minimum this should contain headers, a blank line, and a plaintext body.

output:

Save the results in this placeholder.

on_simulate:

The commands to run during simulation instead of parsing the email.

If omitted, the email is parsed during simulation.

on_success:

The commands to run on success.

The output: placeholder receives a ticket dictionary.

on_error:

The commands to run on failure. If omitted, the automation exits in the error state.

The output: placeholder receives a dictionary with these keys:

Key  
error The error message.

Examples

Parse a quoted-printable message with emoji

  • start:
      set:
        message_subject: Welcome 🌟 to our service!
        message_body@text:
          Hello and welcome to our new service! 😀
          
          We're delighted 🎉 to have you as a member of our community.
          This is a sample email with emojis 🚀 and quoted-printable encoding.
          
          Have a great day! 🌈
          
          Best regards,
          The Team 👋
        
      email.parse:
        output: new_ticket
        inputs:
          message@text:
            From: sender@example.com
            To: recipient@example.com
            Date: {{'now'|date('r')}}
            MIME-Version: 1.0
            Content-Type: text/plain; charset="UTF-8"
            Content-Transfer-Encoding: quoted-printable
            Subject: =?UTF-8?Q?{{message_subject|qp_encode}}?=
            
            {{message_body|qp_encode}}
  • commands:
      email.parse:
        allow@bool: yes