MailReceivedTriggerMailReceivedTrigger
MailReceivedTriggerCertified

yaml
type: "io.kestra.plugin.microsoft365.outlook.MailReceivedTrigger"
yaml
id: outlook_listen
namespace: company.team

tasks:
  - id: each
    type: io.kestra.plugin.core.flow.EachSequential
    value: "{{ trigger.messages }}"
    tasks:
      - id: log
        type: io.kestra.plugin.core.debug.Return
        format: "New email: {{ taskrun.value.subject }}"

triggers:
  - id: watch
    type: io.kestra.plugin.microsoft365.outlook.MailReceivedTrigger
    interval: PT5M
    tenantId: "{{ secret('AZURE_TENANT_ID') }}"
    clientId: "{{ secret('AZURE_CLIENT_ID') }}"
    clientSecret: "{{ secret('AZURE_CLIENT_SECRET') }}"
    userEmail: "user@example.com"
    folderId: "inbox"

yaml
id: outlook_with_attachments
namespace: company.team

tasks:
  - id: each
    type: io.kestra.plugin.core.flow.EachSequential
    value: "{{ trigger.messages }}"
    tasks:
      - id: process
        type: io.kestra.plugin.core.debug.Return
        format: "Processing {{ taskrun.value.subject }} with {{ taskrun.value.attachments | length }} attachments"
      - id: each_attachment
        type: io.kestra.plugin.core.flow.EachSequential
        values: "{{ taskrun.value.attachments }}"
        tasks:
          - id: log_attachment
            type: io.kestra.plugin.core.log.Log
            message: "Attachment: {{ taskrun.value.name }} stored at {{ taskrun.value.uri }}"

triggers:
  - id: watch
    type: io.kestra.plugin.microsoft365.outlook.MailReceivedTrigger
    interval: PT2M
    tenantId: "{{ secret('AZURE_TENANT_ID') }}"
    clientId: "{{ secret('AZURE_CLIENT_ID') }}"
    clientSecret: "{{ secret('AZURE_CLIENT_SECRET') }}"
    userEmail: "invoices@company.com"
    folderId: "inbox"
    filter: "hasAttachments eq true"
    includeAttachments: true

yaml
id: outlook_filtered_sender
namespace: company.team

tasks:
  - id: process
    type: io.kestra.plugin.core.log.Log
    message: "Received {{ trigger.count }} email(s) from important sender"

triggers:
  - id: watch
    type: io.kestra.plugin.microsoft365.outlook.MailReceivedTrigger
    interval: PT1M
    tenantId: "{{ secret('AZURE_TENANT_ID') }}"
    clientId: "{{ secret('AZURE_CLIENT_ID') }}"
    clientSecret: "{{ secret('AZURE_CLIENT_SECRET') }}"
    userEmail: "user@example.com"
    filter: "from/emailAddress/address eq 'boss@company.com'"
    stateTtl: P30D
Properties
Defaultfalse
Definitions
type*Requiredobject
afterstring
Formatdate-time
beforestring
Formatdate-time
datestring
Default{{ trigger.date }}
dayOfWeek*Requiredstring
Possible Values
MONDAYTUESDAYWEDNESDAYTHURSDAYFRIDAYSATURDAYSUNDAY
type*Requiredobject
datestring
Default{{ trigger.date }}
dayInMonth*Requiredstring
Possible Values
FIRSTLASTSECONDTHIRDFOURTH
dayOfWeek*Requiredstring
Possible Values
MONDAYTUESDAYWEDNESDAYTHURSDAYFRIDAYSATURDAYSUNDAY
type*Requiredobject
datestring
Default{{ trigger.date }}
flowId*Requiredstring
namespace*Requiredstring
type*Requiredobject
labels*Requiredarrayobject
type*Requiredobject
namespace*Requiredstring
type*Requiredobject
comparisonstring
Possible Values
EQUALSPREFIXSUFFIX
prefixbooleanstring
Defaultfalse
expression*Requiredbooleanstring
type*Requiredobject
type*Requiredobject
inarray
SubTypestring
Possible Values
CREATEDSUBMITTEDRUNNINGPAUSEDRESTARTEDKILLINGSUCCESSWARNINGFAILEDKILLEDCANCELLEDQUEUEDRETRYINGRETRIEDSKIPPEDBREAKPOINTRESUBMITTED
notInarray
SubTypestring
Possible Values
CREATEDSUBMITTEDRUNNINGPAUSEDRESTARTEDKILLINGSUCCESSWARNINGFAILEDKILLEDCANCELLEDQUEUEDRETRYINGRETRIEDSKIPPEDBREAKPOINTRESUBMITTED
expression*Requiredstring
type*Requiredobject
flowId*Requiredstring
namespace*Requiredstring
type*Requiredobject
namespace*Requiredstring
type*Requiredobject
prefixboolean
Defaultfalse
type*Requiredobject
inarray
SubTypestring
Possible Values
CREATEDSUBMITTEDRUNNINGPAUSEDRESTARTEDKILLINGSUCCESSWARNINGFAILEDKILLEDCANCELLEDQUEUEDRETRYINGRETRIEDSKIPPEDBREAKPOINTRESUBMITTED
notInarray
SubTypestring
Possible Values
CREATEDSUBMITTEDRUNNINGPAUSEDRESTARTEDKILLINGSUCCESSWARNINGFAILEDKILLEDCANCELLEDQUEUEDRETRYINGRETRIEDSKIPPEDBREAKPOINTRESUBMITTED
conditions*Requiredobject
id*Requiredstring
Validation RegExp^[a-zA-Z0-9][a-zA-Z0-9_-]*
Min length1
type*Requiredobject
resetOnSuccessboolean
Defaulttrue
timeWindow
Default{ "type": "DURATION_WINDOW" }
deadlinestring
Formatpartial-time
endTimestring
Formatpartial-time
startTimestring
Formatpartial-time
typestring
DefaultDURATION_WINDOW
Possible Values
DAILY_TIME_DEADLINEDAILY_TIME_WINDOWDURATION_WINDOWSLIDING_WINDOW
windowstring
Formatduration
windowAdvancestring
Formatduration
windowDeprecatedstring
Formatduration
windowAdvanceDeprecatedstring
Formatduration
conditions*Required
Min items1
type*Requiredobject
conditions*Required
Min items1
type*Requiredobject
type*Requiredobject
countrystring
datestring
Default{{ trigger.date}}
subDivisionstring
type*Requiredobject
afterstring
Formattime
beforestring
Formattime
datestring
Default{{ trigger.date }}
type*Requiredobject
datestring
Default{{ trigger.date }}
Defaultinbox
Defaultfalse
DefaultPT5M
Formatduration
Default10
Defaulthttps://graph.microsoft.com/.default
Formatduration
SubTypestring
Possible Values
CREATEDSUBMITTEDRUNNINGPAUSEDRESTARTEDKILLINGSUCCESSWARNINGFAILEDKILLEDCANCELLEDQUEUEDRETRYINGRETRIEDSKIPPEDBREAKPOINTRESUBMITTED
Definitions
attachmentsarray
contentTypestring
idstring
isInlineboolean
namestring
sizeinteger
uristring
Formaturi
bodystring
bodyContentTypestring
bodyPreviewstring
ccRecipientsarray
SubTypestring
fromstring
fromNamestring
hasAttachmentsboolean
idstring
importancestring
isReadboolean
receivedDateTimestring
Formatdate-time
sentDateTimestring
Formatdate-time
subjectstring
toRecipientsarray
SubTypestring