This workflow follows the HTTP Request → Microsoft Outlook recipe pattern — see all workflows that pair these two integrations.
The workflow JSON
Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →
{
"name": "Secretary \u2014 Outlook Email & Calendar Operations",
"nodes": [
{
"parameters": {
"httpMethod": "POST",
"path": "secretary",
"responseMode": "responseNode",
"options": {}
},
"id": "webhook-trigger",
"name": "Secretary Webhook",
"type": "n8n-nodes-base.webhook",
"typeVersion": 2,
"position": [
240,
840
]
},
{
"parameters": {
"rules": {
"values": [
{
"conditions": {
"combinator": "and",
"conditions": [
{
"leftValue": "={{ $json.body.action }}",
"rightValue": "list",
"operator": {
"type": "string",
"operation": "equals",
"singleValue": true
}
}
]
}
},
{
"conditions": {
"combinator": "and",
"conditions": [
{
"leftValue": "={{ $json.body.action }}",
"rightValue": "search",
"operator": {
"type": "string",
"operation": "equals",
"singleValue": true
}
}
]
}
},
{
"conditions": {
"combinator": "and",
"conditions": [
{
"leftValue": "={{ $json.body.action }}",
"rightValue": "get",
"operator": {
"type": "string",
"operation": "equals",
"singleValue": true
}
}
]
}
},
{
"conditions": {
"combinator": "and",
"conditions": [
{
"leftValue": "={{ $json.body.action }}",
"rightValue": "send",
"operator": {
"type": "string",
"operation": "equals",
"singleValue": true
}
}
]
}
},
{
"conditions": {
"combinator": "and",
"conditions": [
{
"leftValue": "={{ $json.body.action }}",
"rightValue": "reply",
"operator": {
"type": "string",
"operation": "equals",
"singleValue": true
}
}
]
}
},
{
"conditions": {
"combinator": "and",
"conditions": [
{
"leftValue": "={{ $json.body.action }}",
"rightValue": "delete",
"operator": {
"type": "string",
"operation": "equals",
"singleValue": true
}
}
]
}
},
{
"conditions": {
"combinator": "and",
"conditions": [
{
"leftValue": "={{ $json.body.action }}",
"rightValue": "move",
"operator": {
"type": "string",
"operation": "equals",
"singleValue": true
}
}
]
}
},
{
"conditions": {
"combinator": "and",
"conditions": [
{
"leftValue": "={{ $json.body.action }}",
"rightValue": "mark",
"operator": {
"type": "string",
"operation": "equals",
"singleValue": true
}
}
]
}
},
{
"conditions": {
"combinator": "and",
"conditions": [
{
"leftValue": "={{ $json.body.action }}",
"rightValue": "forward",
"operator": {
"type": "string",
"operation": "equals",
"singleValue": true
}
}
]
}
},
{
"conditions": {
"combinator": "and",
"conditions": [
{
"leftValue": "={{ $json.body.action }}",
"rightValue": "create_draft",
"operator": {
"type": "string",
"operation": "equals",
"singleValue": true
}
}
]
}
},
{
"conditions": {
"combinator": "and",
"conditions": [
{
"leftValue": "={{ $json.body.action }}",
"rightValue": "flag",
"operator": {
"type": "string",
"operation": "equals",
"singleValue": true
}
}
]
}
},
{
"conditions": {
"combinator": "and",
"conditions": [
{
"leftValue": "={{ $json.body.action }}",
"rightValue": "list_folders",
"operator": {
"type": "string",
"operation": "equals",
"singleValue": true
}
}
]
}
},
{
"conditions": {
"combinator": "and",
"conditions": [
{
"leftValue": "={{ $json.body.action }}",
"rightValue": "get_attachments",
"operator": {
"type": "string",
"operation": "equals",
"singleValue": true
}
}
]
}
},
{
"conditions": {
"combinator": "and",
"conditions": [
{
"leftValue": "={{ $json.body.action }}",
"rightValue": "calendar_list",
"operator": {
"type": "string",
"operation": "equals",
"singleValue": true
}
}
]
}
},
{
"conditions": {
"combinator": "and",
"conditions": [
{
"leftValue": "={{ $json.body.action }}",
"rightValue": "calendar_create",
"operator": {
"type": "string",
"operation": "equals",
"singleValue": true
}
}
]
}
}
]
},
"options": {
"fallbackOutput": "extra"
}
},
"id": "switch-action",
"name": "Route by Action",
"type": "n8n-nodes-base.switch",
"typeVersion": 3,
"position": [
460,
840
]
},
{
"parameters": {
"resource": "message",
"operation": "getAll",
"returnAll": false,
"limit": "={{ $('Secretary Webhook').first().json.body.params?.limit || 20 }}",
"filters": {},
"options": {
"folderId": "={{ $('Secretary Webhook').first().json.body.params?.folder || 'inbox' }}"
}
},
"id": "list-emails",
"name": "List Emails",
"type": "n8n-nodes-base.microsoftOutlook",
"typeVersion": 2,
"position": [
720,
50
],
"credentials": {
"microsoftOutlookOAuth2Api": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"method": "GET",
"url": "https://graph.microsoft.com/v1.0/me/messages",
"authentication": "predefinedCredentialType",
"nodeCredentialType": "microsoftOutlookOAuth2Api",
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "$search",
"value": "={{ '\"' + ($('Secretary Webhook').first().json.body.params?.query || '') + '\"' }}"
},
{
"name": "$top",
"value": "={{ $('Secretary Webhook').first().json.body.params?.limit || 20 }}"
},
{
"name": "$select",
"value": "id,subject,from,toRecipients,receivedDateTime,bodyPreview,isRead,hasAttachments,importance,parentFolderId"
}
]
},
"options": {
"timeout": 15000
}
},
"id": "search-emails",
"name": "Search Emails",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.4,
"position": [
720,
210
],
"credentials": {
"microsoftOutlookOAuth2Api": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"resource": "message",
"operation": "get",
"messageId": "={{ $('Secretary Webhook').first().json.body.params?.message_id }}"
},
"id": "get-email",
"name": "Get Email",
"type": "n8n-nodes-base.microsoftOutlook",
"typeVersion": 2,
"position": [
720,
370
],
"credentials": {
"microsoftOutlookOAuth2Api": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"method": "POST",
"url": "https://graph.microsoft.com/v1.0/me/sendMail",
"authentication": "predefinedCredentialType",
"nodeCredentialType": "microsoftOutlookOAuth2Api",
"sendBody": true,
"contentType": "json",
"specifyBody": "json",
"jsonBody": "={{ JSON.stringify({ message: { subject: $('Secretary Webhook').first().json.body.params?.subject || '(no subject)', body: { contentType: $('Secretary Webhook').first().json.body.params?.body_type || 'Text', content: $('Secretary Webhook').first().json.body.params?.body || '' }, toRecipients: ($('Secretary Webhook').first().json.body.params?.to || '').split(',').map(e => ({ emailAddress: { address: e.trim() } })), ccRecipients: $('Secretary Webhook').first().json.body.params?.cc ? $('Secretary Webhook').first().json.body.params.cc.split(',').map(e => ({ emailAddress: { address: e.trim() } })) : [] } }) }}",
"options": {
"timeout": 15000
}
},
"id": "send-email",
"name": "Send Email",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.4,
"position": [
720,
530
],
"credentials": {
"microsoftOutlookOAuth2Api": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"resource": "message",
"operation": "reply",
"messageId": "={{ $('Secretary Webhook').first().json.body.params?.message_id }}",
"comment": "={{ $('Secretary Webhook').first().json.body.params?.body || '' }}"
},
"id": "reply-email",
"name": "Reply to Email",
"type": "n8n-nodes-base.microsoftOutlook",
"typeVersion": 2,
"position": [
720,
690
],
"credentials": {
"microsoftOutlookOAuth2Api": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"resource": "message",
"operation": "delete",
"messageId": "={{ $('Secretary Webhook').first().json.body.params?.message_id }}"
},
"id": "delete-email",
"name": "Delete Email",
"type": "n8n-nodes-base.microsoftOutlook",
"typeVersion": 2,
"position": [
720,
850
],
"credentials": {
"microsoftOutlookOAuth2Api": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"resource": "message",
"operation": "move",
"messageId": "={{ $('Secretary Webhook').first().json.body.params?.message_id }}",
"destinationId": "={{ $('Secretary Webhook').first().json.body.params?.destination || 'junkemail' }}"
},
"id": "move-email",
"name": "Move Email",
"type": "n8n-nodes-base.microsoftOutlook",
"typeVersion": 2,
"position": [
720,
1010
],
"credentials": {
"microsoftOutlookOAuth2Api": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"resource": "message",
"operation": "update",
"messageId": "={{ $('Secretary Webhook').first().json.body.params?.message_id }}",
"updateFields": {
"isRead": "={{ $('Secretary Webhook').first().json.body.params?.is_read !== false }}"
}
},
"id": "mark-email",
"name": "Mark Email",
"type": "n8n-nodes-base.microsoftOutlook",
"typeVersion": 2,
"position": [
720,
1170
],
"credentials": {
"microsoftOutlookOAuth2Api": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"method": "POST",
"url": "=https://graph.microsoft.com/v1.0/me/messages/{{ $('Secretary Webhook').first().json.body.params?.message_id }}/forward",
"authentication": "predefinedCredentialType",
"nodeCredentialType": "microsoftOutlookOAuth2Api",
"sendBody": true,
"contentType": "json",
"specifyBody": "json",
"jsonBody": "={{ JSON.stringify({ toRecipients: ($('Secretary Webhook').first().json.body.params?.to || '').split(',').map(e => ({ emailAddress: { address: e.trim() } })), comment: $('Secretary Webhook').first().json.body.params?.comment || '' }) }}",
"options": {
"timeout": 15000
}
},
"id": "forward-email",
"name": "Forward Email",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.4,
"position": [
720,
1330
],
"credentials": {
"microsoftOutlookOAuth2Api": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"method": "POST",
"url": "https://graph.microsoft.com/v1.0/me/messages",
"authentication": "predefinedCredentialType",
"nodeCredentialType": "microsoftOutlookOAuth2Api",
"sendBody": true,
"contentType": "json",
"specifyBody": "json",
"jsonBody": "={{ JSON.stringify({ subject: $('Secretary Webhook').first().json.body.params?.subject || '(draft)', body: { contentType: $('Secretary Webhook').first().json.body.params?.body_type || 'Text', content: $('Secretary Webhook').first().json.body.params?.body || '' }, toRecipients: ($('Secretary Webhook').first().json.body.params?.to || '').split(',').filter(e => e.trim()).map(e => ({ emailAddress: { address: e.trim() } })), ccRecipients: $('Secretary Webhook').first().json.body.params?.cc ? $('Secretary Webhook').first().json.body.params.cc.split(',').map(e => ({ emailAddress: { address: e.trim() } })) : [] }) }}",
"options": {
"timeout": 15000
}
},
"id": "create-draft",
"name": "Create Draft",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.4,
"position": [
720,
1490
],
"credentials": {
"microsoftOutlookOAuth2Api": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"method": "PATCH",
"url": "=https://graph.microsoft.com/v1.0/me/messages/{{ $('Secretary Webhook').first().json.body.params?.message_id }}",
"authentication": "predefinedCredentialType",
"nodeCredentialType": "microsoftOutlookOAuth2Api",
"sendBody": true,
"contentType": "json",
"specifyBody": "json",
"jsonBody": "={{ JSON.stringify({ flag: { flagStatus: $('Secretary Webhook').first().json.body.params?.flag_status || 'flagged' } }) }}",
"options": {
"timeout": 15000
}
},
"id": "flag-email",
"name": "Flag Email",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.4,
"position": [
720,
1650
],
"credentials": {
"microsoftOutlookOAuth2Api": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"method": "GET",
"url": "https://graph.microsoft.com/v1.0/me/mailFolders",
"authentication": "predefinedCredentialType",
"nodeCredentialType": "microsoftOutlookOAuth2Api",
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "$select",
"value": "id,displayName,totalItemCount,unreadItemCount"
},
{
"name": "$top",
"value": "50"
}
]
},
"options": {
"timeout": 15000
}
},
"id": "list-folders",
"name": "List Folders",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.4,
"position": [
720,
1810
],
"credentials": {
"microsoftOutlookOAuth2Api": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"method": "GET",
"url": "=https://graph.microsoft.com/v1.0/me/messages/{{ $('Secretary Webhook').first().json.body.params?.message_id }}/attachments",
"authentication": "predefinedCredentialType",
"nodeCredentialType": "microsoftOutlookOAuth2Api",
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "$select",
"value": "id,name,contentType,size,isInline"
}
]
},
"options": {
"timeout": 15000
}
},
"id": "get-attachments",
"name": "Get Attachments",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.4,
"position": [
720,
1970
],
"credentials": {
"microsoftOutlookOAuth2Api": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"method": "GET",
"url": "https://graph.microsoft.com/v1.0/me/events",
"authentication": "predefinedCredentialType",
"nodeCredentialType": "microsoftOutlookOAuth2Api",
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "$top",
"value": "={{ $('Secretary Webhook').first().json.body.params?.limit || 10 }}"
},
{
"name": "$select",
"value": "id,subject,start,end,location,attendees,bodyPreview,isAllDay,organizer"
},
{
"name": "$orderby",
"value": "start/dateTime asc"
},
{
"name": "$filter",
"value": "={{ 'start/dateTime ge \\'' + new Date().toISOString() + '\\'' }}"
}
]
},
"options": {
"timeout": 15000
}
},
"id": "calendar-list",
"name": "Calendar List",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.4,
"position": [
720,
2130
],
"credentials": {
"microsoftOutlookOAuth2Api": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"method": "POST",
"url": "https://graph.microsoft.com/v1.0/me/events",
"authentication": "predefinedCredentialType",
"nodeCredentialType": "microsoftOutlookOAuth2Api",
"sendBody": true,
"contentType": "json",
"specifyBody": "json",
"jsonBody": "={{ JSON.stringify({ subject: $('Secretary Webhook').first().json.body.params?.subject || '(Meeting)', body: { contentType: 'Text', content: $('Secretary Webhook').first().json.body.params?.body || '' }, start: { dateTime: $('Secretary Webhook').first().json.body.params?.start, timeZone: $('Secretary Webhook').first().json.body.params?.timezone || 'UTC' }, end: { dateTime: $('Secretary Webhook').first().json.body.params?.end, timeZone: $('Secretary Webhook').first().json.body.params?.timezone || 'UTC' }, location: { displayName: $('Secretary Webhook').first().json.body.params?.location || '' }, attendees: ($('Secretary Webhook').first().json.body.params?.attendees || '').split(',').filter(e => e.trim()).map(e => ({ emailAddress: { address: e.trim() }, type: 'required' })) }) }}",
"options": {
"timeout": 15000
}
},
"id": "calendar-create",
"name": "Calendar Create",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.4,
"position": [
720,
2290
],
"credentials": {
"microsoftOutlookOAuth2Api": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"mode": "runOnceForAllItems",
"language": "javaScript",
"jsCode": "const action = $('Secretary Webhook').first().json.body?.action || '?';\nreturn [{ json: { success: false, error: `Unknown action: \"${action}\". Valid actions: list, search, get, send, reply, forward, create_draft, delete, move, mark, flag, list_folders, get_attachments, calendar_list, calendar_create` } }];"
},
"id": "unknown-action",
"name": "Unknown Action",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
720,
2450
]
},
{
"parameters": {
"mode": "runOnceForAllItems",
"language": "javaScript",
"jsCode": "const items = $input.all();\nconst wb = $('Secretary Webhook').first().json;\nconst action = wb.body?.action || 'unknown';\nconst first = items[0]?.json || {};\n\n// Error passthrough (unknown action or explicit error)\nif (first.success === false || first.error) {\n return [{ json: { success: false, action, error: first.error } }];\n}\n\n// Graph API responses with { value: [...] }\nif (first.value && Array.isArray(first.value)) {\n return [{ json: { success: true, action, count: first.value.length, data: first.value } }];\n}\n\n// sendMail / forward return 202 No Content\nif (['send', 'forward'].includes(action) && !first.id) {\n return [{ json: { success: true, action, message: `${action} completed successfully` } }];\n}\n\n// create_draft returns the new message object\nif (action === 'create_draft' && first.id) {\n return [{ json: { success: true, action, message: 'Draft saved', data: first } }];\n}\n\n// delete / move / mark / flag return empty or minimal\nif (['delete', 'move', 'mark', 'flag'].includes(action) && (items.length === 0 || !first.id)) {\n return [{ json: { success: true, action, message: `${action} completed successfully` } }];\n}\n\n// calendar_create returns the new event\nif (action === 'calendar_create' && first.id) {\n return [{ json: { success: true, action, message: 'Event created', data: first } }];\n}\n\n// list (getAll) returns multiple items \u2014 one n8n item per email\nif (items.length > 1) {\n return [{ json: { success: true, action, count: items.length, data: items.map(i => i.json) } }];\n}\n\n// get / reply / single result\nreturn [{ json: { success: true, action, data: first } }];"
},
"id": "format-response",
"name": "Format Response",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
1060,
840
]
},
{
"parameters": {
"respondWith": "json",
"responseBody": "={{ JSON.stringify($json) }}",
"options": {
"responseCode": 200,
"responseHeaders": {
"entries": [
{
"name": "Content-Type",
"value": "application/json"
}
]
}
}
},
"id": "respond-webhook",
"name": "Respond to Webhook",
"type": "n8n-nodes-base.respondToWebhook",
"typeVersion": 1.1,
"position": [
1280,
840
]
}
],
"connections": {
"Secretary Webhook": {
"main": [
[
{
"node": "Route by Action",
"type": "main",
"index": 0
}
]
]
},
"Route by Action": {
"main": [
[
{
"node": "List Emails",
"type": "main",
"index": 0
}
],
[
{
"node": "Search Emails",
"type": "main",
"index": 0
}
],
[
{
"node": "Get Email",
"type": "main",
"index": 0
}
],
[
{
"node": "Send Email",
"type": "main",
"index": 0
}
],
[
{
"node": "Reply to Email",
"type": "main",
"index": 0
}
],
[
{
"node": "Delete Email",
"type": "main",
"index": 0
}
],
[
{
"node": "Move Email",
"type": "main",
"index": 0
}
],
[
{
"node": "Mark Email",
"type": "main",
"index": 0
}
],
[
{
"node": "Forward Email",
"type": "main",
"index": 0
}
],
[
{
"node": "Create Draft",
"type": "main",
"index": 0
}
],
[
{
"node": "Flag Email",
"type": "main",
"index": 0
}
],
[
{
"node": "List Folders",
"type": "main",
"index": 0
}
],
[
{
"node": "Get Attachments",
"type": "main",
"index": 0
}
],
[
{
"node": "Calendar List",
"type": "main",
"index": 0
}
],
[
{
"node": "Calendar Create",
"type": "main",
"index": 0
}
],
[
{
"node": "Unknown Action",
"type": "main",
"index": 0
}
]
]
},
"List Emails": {
"main": [
[
{
"node": "Format Response",
"type": "main",
"index": 0
}
]
]
},
"Search Emails": {
"main": [
[
{
"node": "Format Response",
"type": "main",
"index": 0
}
]
]
},
"Get Email": {
"main": [
[
{
"node": "Format Response",
"type": "main",
"index": 0
}
]
]
},
"Send Email": {
"main": [
[
{
"node": "Format Response",
"type": "main",
"index": 0
}
]
]
},
"Reply to Email": {
"main": [
[
{
"node": "Format Response",
"type": "main",
"index": 0
}
]
]
},
"Delete Email": {
"main": [
[
{
"node": "Format Response",
"type": "main",
"index": 0
}
]
]
},
"Move Email": {
"main": [
[
{
"node": "Format Response",
"type": "main",
"index": 0
}
]
]
},
"Mark Email": {
"main": [
[
{
"node": "Format Response",
"type": "main",
"index": 0
}
]
]
},
"Forward Email": {
"main": [
[
{
"node": "Format Response",
"type": "main",
"index": 0
}
]
]
},
"Create Draft": {
"main": [
[
{
"node": "Format Response",
"type": "main",
"index": 0
}
]
]
},
"Flag Email": {
"main": [
[
{
"node": "Format Response",
"type": "main",
"index": 0
}
]
]
},
"List Folders": {
"main": [
[
{
"node": "Format Response",
"type": "main",
"index": 0
}
]
]
},
"Get Attachments": {
"main": [
[
{
"node": "Format Response",
"type": "main",
"index": 0
}
]
]
},
"Calendar List": {
"main": [
[
{
"node": "Format Response",
"type": "main",
"index": 0
}
]
]
},
"Calendar Create": {
"main": [
[
{
"node": "Format Response",
"type": "main",
"index": 0
}
]
]
},
"Unknown Action": {
"main": [
[
{
"node": "Format Response",
"type": "main",
"index": 0
}
]
]
},
"Format Response": {
"main": [
[
{
"node": "Respond to Webhook",
"type": "main",
"index": 0
}
]
]
}
},
"settings": {
"executionOrder": "v1",
"saveManualExecutions": true,
"callerPolicy": "workflowsFromSameOwner"
}
}
Credentials you'll need
Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.
microsoftOutlookOAuth2Api
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
Secretary — Outlook Email & Calendar Operations. Uses microsoftOutlook, httpRequest. Webhook trigger; 20 nodes.
Source: https://github.com/gelson12/super-agent/blob/aeb812f679f48777a12790d2ecba7d4e351c2838/n8n/secretary_workflow.json — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
Agent Workflow. Uses googleSheetsTool, microsoftOutlook, googleDocsTool, httpRequest. Webhook trigger; 27 nodes.
Marketing, growth, and automation teams that need to ship polished bilingual newsletters—complete with images, optional video, and multi-channel distribution—without writing a line of code. A Webhook
This workflow receives an intake-form webhook, validates and enriches firm details, uses OpenAI and SerpAPI to research AI governance obligations, generates four branded policy documents, converts the
Webhook Code. Uses stickyNote, erpNext, lmChatGoogleGemini, httpRequest. Webhook trigger; 39 nodes.
Webhook Code. Uses stickyNote, erpNext, lmChatGoogleGemini, httpRequest. Webhook trigger; 39 nodes.