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 Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,101 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Deepanshu Sharma 490 Reputation points Microsoft Vendor
    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.