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
| # | Activity | What it does |
|---|---|---|
| 1 | LoadEnvVariables | Load Office 365 app credentials from environment |
| 2 | Office365 | Authenticate with Microsoft Graph (application permissions) |
| 3 | Assign | Extract messageId from the Graph notification envelope |
| 4 | GetMessagesById | Fetch 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'] }}")