Graph Api Subscription List Empty

Roja Ranjith 25 Reputation points
2023-10-30T08:44:40.1933333+00:00

I am trying to create a presence subscription to listen to any presence changes. However, I do not receive any subscriptionId as response.

After creating a subscription, when I try to get the list using https://graph.microsoft.com/v1.0/subscriptions/, the list is always empty.

Code:

subscription = await client?.api('/subscriptions').post(subscriptionCreationInformation);

// where
subscriptionCreationInformation.changeType = 'updated',
  subscriptionCreationInformation.clientState: = 'secretClientState',
  subscriptionCreationInformation.latestSupportedTlsVersion = 'v1_2',
subscriptionCreationInformation.resource = `communications/presences/${userId}`;
    subscriptionCreationInformation.notificationUrl = `${process.env.NOTIFICATION_URL}/endpoint`;
    subscriptionCreationInformation.expirationDateTime = new Date(
      Date.now() + 3600000,).toISOString();

I have added the Subscriptions.Read.All permission to my add. I used to receive the subscriptionId earlier but recently not receiving it all the time. Requesting your help with this issue.

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
9,154 questions
Microsoft Teams Development
Microsoft Teams Development
Microsoft Teams: A Microsoft customizable chat-based workspace.Development: The process of researching, productizing, and refining new or existing technologies.
2,540 questions
{count} votes