Skip to main content

Office 365 Email Receiver (Webhook)

Triggered by Microsoft Graph subscription notifications. Iterates the webhookBody.value[] envelope and fetches each email by ID. Use this for any inbound webhook / subscription / Outlook email handler.

Steps

#ActivityWhat it does
1LoadEnvVariablesLoad Office 365 app credentials from environment
2Office365Authenticate with Microsoft Graph (application permissions)
3AssignExtract messageId from the Graph notification envelope
4GetMessagesByIdFetch the full email message by ID

Workflow

# Microsoft Graph change notifications arrive wrapped in {"value": [ ... ]}.
# webhookBody IS that envelope — always iterate webhookBody['value'].
LoadEnvVariables('{"environmentId": "<env-uuid>", "secrets": ["client_id", "client_secret", "tenant_id"]}')
for notification in webhookBody['value']:
with Office365(client_id, tenant_id, clientSecret=client_secret,
emailAddress="inbox@example.com", permissionsType="application"):
Assign({'messageId': '{{ notification["resourceData"]["id"] }}'})
emailData = GetMessagesById(messageId=messageId, includeAttachments=True)
WriteLine("{{ emailData['Subject'] }}")