mail.received automation events can react to received messages after they are appended to a ticket. For instance, sending an auto-reply confirmation to new tickets.

Placeholders

The automation event dictionary starts with the following values:

Key Type Notes
is_new_ticket bool true if the message opened a new ticket, false if a reply to an existing ticket
message_* record The message record. Supports key expansion.

Outputs

(none)

Legacy behaviors

When both automations and legacy bot behaviors are active on the mail.received event, they run in this order based on automation priority:

Priority Execution order
0–127 Automation runs before legacy behaviors
128–255 Automation runs after legacy behaviors

This ordering was introduced in 11.1.8. Prior to that version, automations always ran before legacy behaviors regardless of priority.

Examples

Send an autoresponder when a new ticket is created:

  • start:
      record.create:
        output: new_draft
        inputs:
          record_type: draft
          fields:
            name: Auto-Response
            type: ticket.reply
            ticket_id: {{message_ticket_id}}
            is_queued: 1
            queue_delivery_date@date: 5 mins
            to: {{message_sender_address}}
            params:
              to: {{message_sender_address}}
              subject: [#{{message_ticket_mask}}] {{message_ticket_subject}}
              headers:
                In-Reply-To@optional: {{message_headers['in-reply-to']}}
                Auto-Submitted: auto-replied
              content: Thank you for contacting us. We will respond as soon as possible.
  • commands:
      record.create:
        deny/type@bool: {{inputs.record_type is not record type ('draft')}}
        allow@bool: yes
  • automation/autoreply:
      uri: cerb:automation:example.newticket.autoresponder
      disabled@bool:
        {{
          not is_new_ticket
          or not message_ticket_group_auto_responder_enabled
          or message_ticket_subject is pattern (
            '*out of the office*',
            '*out of office*',
            '*auto response*',
            '*autoreply*',
          )
        }}
  • message__context: message
    message_id: 1