How i stop unnecessary callbacks from presence subscription.

Amir Sohail 411 Reputation points
2022-01-03T14:55:15.123+00:00

Aoa,

I hope all of you are feeling well!

Currently, I have created a subscription for the presence of my user using "create subscription API".
1)The subscription is working but it is frequently sending unnecessary notifications without a change to my presence/status in M.teams

My current status in M.teams is DoNotDistrub
161944-my-status.jpg

but I am receiving different statuses like(DoNotDisturb then Away then Offwork repeatedly after some seconds) in a callback from subscription without any change in my M.teams status.
161938-different-statues.png

it sends nonstop notifications/callbacks means it's sending my old and current statuses repeatedly.

My Requirement: I just want a notification when the user changes his status/presence manually or M.teams changes his status automatically.

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

Accepted answer
  1. Hunaid Hanfee-MSFT 976 Reputation points
    2022-01-04T12:50:14.063+00:00

    We have tried with the sample https://github.com/OfficeDev/Microsoft-Teams-Samples/blob/main/samples/graph-change-notification/nodejs/ and we are not getting incorrect status. It's only sending request when we are changing it or automatically change by some Team's Activity.

    Could you please try sending status as 202. Whenever you are getting that request successfully.?

    console.log("api is working");
    if (req.body && req.body.value && req.body.value.length > 0) {
        req.body.value.map(i => {
        console.log(i.resourceData)
        })
        res.sendStatus(202);
        }  
    

    Please give it a try and let us know if you are still facing it.

    Thanks,

    Hunaid Hanfee


    If the response is helpful, please click "Accept Answer" and upvote it. You can share your feedback via Microsoft Teams Developer Feedback link. Click here to escalate.

    1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Amir Sohail 411 Reputation points
    2022-01-11T14:35:54.32+00:00

    it's working fine with req.sendStatus(202)

    0 comments No comments