Webhook Response Code

Describe the problem/error/question

I want to use a webhook to subscribe to the microsoft graph notification (new email in inbox) - Create subscription - Microsoft Graph v1.0 | Microsoft Learn. To create the notification-subscription, I have to POST the following code:

{
    "changeType": "created",
    "notificationUrl": "Webhook-URL",
    "resource": "me/mailFolders('Inbox')/messages",
    "expirationDateTime": "2024-08-02T18:23:00.9356913Z",
    "clientState": "secretClientValue",
    "latestSupportedTlsVersion": "v1_2"
}

The Webhook (in n8n) should responde with Code 200 to validate. So I created a webhook, pasted the url into the POST-Request from above and set the option “Response Code” in the webhook to 200.

Now, if I send the POST-Request from above, I get the following error:

{
    "error": {
        "code": "ValidationError",
        "message": "{\"message\":\"Workflow was started\"}",
        "innerError": {
            "date": "2024-08-02T10:09:43",
            "request-id": "f6ad736c-a60f-4041-bf88-4673e5cfa6ec",
            "client-request-id": "fce0725a-a1e9-57e0-04a4-f0c7c90db3f6"
        }
    }
}

Does somebody know what I have to change in my webhook-configurations to make it work?

This is my webhook:

Please share your workflow

Information on your n8n setup

  • n8n version: 1.45.1

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

Hey @prcode,

Looking at the docs you need to do more then reply back with a 200 status you also need to return the validation token which could be the part you are missing, You can find more details on that here; Receive change notifications through webhooks - Microsoft Graph | Microsoft Learn

This would look something like this…

1 Like

Yes, that worked! Thank you verry much!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.