Webhook Subscription Payload

Ranjith Kumar Jain 20 Reputation points
2024-05-22T12:54:46.37+00:00

Created a subscription using url --> https://graph.microsoft.com/v1.0/subscriptions

And added notification url 'https://xxx.com/webhook ' with chatid in the body of the API call.

In the handler function expecting message Headers which are sent by message but nothing is received except subscription id ,resource ,tenant id etc.

I want an identifier in the webhook handler request object so that message sent through Graph API should not be auto replied and message sent by the 'user' should be auto replied by saying "Team will get back to your query soon"

Microsoft Security | Microsoft Graph
{count} votes

1 answer

Sort by: Most helpful
  1. Deepanshu Sharma 500 Reputation points Microsoft External Staff
    2024-05-26T19:09:06.2666667+00:00

    Hi Ranjith,

    Unfortunately, the Graph API itself doesn’t provide a built-in way to include custom identifiers in webhook payloads. However, you can work around this limitation.

    You can modify your webhook endpoint to accept custom headers in addition to the standard payload. When sending a message via the Graph API, include a custom header (e.g., X-Message-Origin: GraphAPI). In your webhook handler, check this header to determine the message origin.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.