{"id":5036,"date":"2020-07-07T15:01:24","date_gmt":"2020-07-07T22:01:24","guid":{"rendered":"https:\/\/officedevblogs.wpengine.com\/?p=5036"},"modified":"2020-07-07T15:01:24","modified_gmt":"2020-07-07T22:01:24","slug":"get-notified-of-presence-changes-the-microsoft-graph-presence-subscription-api-is-now-available-in-public-preview","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/get-notified-of-presence-changes-the-microsoft-graph-presence-subscription-api-is-now-available-in-public-preview\/","title":{"rendered":"Get notified of presence changes &#8211; the Microsoft Graph presence subscription API is now available in public preview"},"content":{"rendered":"<p>We\u2019re excited to announce that our presence subscription API is now in Microsoft Graph beta! As part of our <a href=\"https:\/\/docs.microsoft.com\/en-us\/graph\/cloud-communications-concept-overview?view=graph-rest-1.0\">Cloud communications API set<\/a>, this API is used to subscribe to the Teams presence information of other users. Use <a href=\"https:\/\/docs.microsoft.com\/en-us\/graph\/api\/resources\/webhooks?view=graph-rest-beta\">webhooks<\/a> to receive notifications when a user\u2019s presence changes.<\/p>\n<p>This is an <strong>alternative<\/strong> to polling for presence by using the <a href=\"https:\/\/docs.microsoft.com\/en-us\/graph\/api\/presence-get?view=graph-rest-beta&amp;tabs=http\">GET presence<\/a> and <a href=\"https:\/\/docs.microsoft.com\/en-us\/graph\/api\/cloudcommunications-getpresencesbyuserid?view=graph-rest-beta&amp;tabs=http\">POST getPresencesByUserId<\/a> APIs.<\/p>\n<p>This API uses the Presence.Read.All delegated permission. A signed-in user is required. Follow these steps to set up a <a href=\"https:\/\/docs.microsoft.com\/en-us\/graph\/webhooks\">webhook<\/a> and retrieve these notifications:<\/p>\n<ol>\n<li>Subscribe to a single user&#8217;s presence through the <code>\/communications\/presences\/{id}<\/code> path.<\/li>\n<li>Subscribe to a maximum number of 650 users by using <code>\/communications\/presences?$filter=id in ({id},{id}...)<\/code><em>. <\/em>The {id} represents a user ID GUID.<\/li>\n<\/ol>\n<p>Subscriptions expire every hour and must be renewed.<\/p>\n<h3>Presence overview<\/h3>\n<p>Presence refers to the status of the user. This information allows users to see which users are active and likely to engage with them. It adds a new level of transparency to how we communicate with each other.<\/p>\n<p>The APIs return two key properties that make up presence:<\/p>\n<ol>\n<li>The <strong>availability<\/strong>, or base presence information (Available, Away, Busy)<\/li>\n<li>The <strong>activity<\/strong>, or information that\u2019s supplemental to the availability (InAMeeting, InACall)<\/li>\n<\/ol>\n<p>Note that the availability and activity can be the same value.<\/p>\n<h3>Sample use cases<\/h3>\n<ul>\n<li>Display the presence of users in the user interface of a custom business application.<\/li>\n<li>Automate tasks to be completed based on a user\u2019s presence status.<\/li>\n<li>Integrate with IoT devices. View an <a href=\"https:\/\/github.com\/isaacrlevin\/PresenceLight\">open source<\/a> example and a <a href=\"https:\/\/www.youtube.com\/watch?v=8Mi1K4cSiCE\">demo video<\/a> where a user&#8217;s presence information is used to change the color of a smart light bulb.<\/li>\n<\/ul>\n<h3>Learn more<\/h3>\n<ul>\n<li>View the <a href=\"https:\/\/docs.microsoft.com\/en-us\/graph\/api\/resources\/presence?view=graph-rest-beta\">presence<\/a> resource type.<\/li>\n<li>Learn about <a href=\"https:\/\/docs.microsoft.com\/en-us\/graph\/api\/resources\/webhooks?view=graph-rest-beta\">change notifications<\/a> in Microsoft Graph<\/li>\n<li>Learn about <a href=\"https:\/\/docs.microsoft.com\/en-us\/graph\/webhooks\">webhooks<\/a> in Microsoft Graph<\/li>\n<\/ul>\n<h3>Feedback<\/h3>\n<p>For questions or feedback, visit the <a href=\"https:\/\/developer.microsoft.com\/en-us\/graph\/support\">Microsoft Graph Support<\/a> page.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We\u2019re excited to announce that our presence subscription API is now in Microsoft Graph beta! As part of our Cloud communications API set, this API is used to subscribe to the Teams presence information of other users. Use webhooks to receive notifications when a user\u2019s presence changes.<\/p>\n","protected":false},"author":69100,"featured_media":25159,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[3,128],"tags":[],"class_list":["post-5036","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-microsoft-graph","category-microsoft-teams"],"acf":[],"blog_post_summary":"<p>We\u2019re excited to announce that our presence subscription API is now in Microsoft Graph beta! As part of our Cloud communications API set, this API is used to subscribe to the Teams presence information of other users. Use webhooks to receive notifications when a user\u2019s presence changes.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/posts\/5036","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/users\/69100"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/comments?post=5036"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/posts\/5036\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/media\/25159"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/media?parent=5036"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/categories?post=5036"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/tags?post=5036"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}