日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

发送不同类型的ActivityFeed

發(fā)布時(shí)間:2023/12/9 编程问答 31 豆豆
生活随笔 收集整理的這篇文章主要介紹了 发送不同类型的ActivityFeed 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

上一篇文章講到了如何使用最新的Graph API來給一個(gè)用戶發(fā)送一個(gè)簡單的 Activity Feed。我們這篇文章來詳細(xì)講一下發(fā)送三種不同類型的消息。

發(fā)送 Chat 相關(guān)的 Activity Notification

API 為?POST https://graph.microsoft.com/beta/chats/{chat-id}/sendActivityNotification

http請求的內(nèi)容為:

{"topic": {"source": "entityUrl","value": "https://graph.microsoft.com/beta/chats/{chat-id}"},"activityType": "taskCreated","previewText": {"content": "New Task Created"},"recipient": {"@odata.type": "microsoft.graph.aadUserNotificationRecipient","userId": "569363e2-1111-2222-3333-16f245c5d66a"},"templateParameters": [{"name": "taskId","value": "Task 12322"}] }

其中?activityType?和?templateParameters?我已經(jīng)在前面一篇文章中介紹過,previewText?從名字上也很容易理解,是推送的消息的文本內(nèi)容,recipient?是接受推送消息的用戶的 id 信息。

這里比較關(guān)鍵的是?topic,這個(gè)指明了這個(gè)推送的消息是針對哪個(gè)聊天 (chat) 或者哪個(gè) 聊天消息 (chatMessage) 的,如果是針對 chat 的,那么?topic?里的?value?就是?https://graph.microsoft.com/beta/chats/{chat-id}?這種格式,如果是 chatMessage,格式就是?https://graph.microsoft.com/beta/chats/{chat-id}/messages/{message-id}

大家可能會(huì)問,如何獲得這個(gè) chat id 和 message id 呢,這兩個(gè)可以在發(fā)送 message 是返回,或者也可以通過調(diào)用 graph api 來獲取。

發(fā)送 Team 相關(guān)的 Activity Notification

API 為?POST https://graph.microsoft.com/beta/teams/{teamId}/sendActivityNotification

http請求的內(nèi)容和之前的很像:

{"topic": {"source": "entityUrl","value": "https://graph.microsoft.com/beta/teams/{team-id}"},"activityType": "pendingFinanceApprovalRequests","previewText": {"content": "Internal spending team has a pending finance approval requests"},"recipient": {"@odata.type": "microsoft.graph.aadUserNotificationRecipient","userId": "569363e2-1111-2222-3333-16f245c5d66a"},"templateParameters": [{"name": "pendingRequestCount","value": "5"}] }

它支持的 entity url 有好幾種:

  • team,格式為?https://graph.microsoft.com/beta/teams/{team-id}
  • channel,格式為?https://graph.microsoft.com/beta/teams/{team-id}/channels/{channel-id}
  • chatMesage,格式為?https://graph.microsoft.com/beta/teams/{team-id}/channels/{channel-id}/messages/{message-id}
  • teamsTab,格式為?https://graph.microsoft.com/beta/teams/{team-id}/channels/{channel-id}/tabs/{tab-id}

發(fā)送 User 相關(guān)的 Activity Notification

API 為?POST https://graph.microsoft.com/beta/users/{userId}/teamwork/sendActivityNotification

http請求的內(nèi)容和之前的很像:

{"topic": {"source": "entityUrl","value": "https://graph.microsoft.com/beta/users/{user-id}/teamwork/installedApps/{installation-id}"},"activityType": "taskCreated","previewText": {"content": "New Task Created"},"templateParameters": [{"name": "taskId","value": "Task 342342"}] }

它支持的 entity url 有兩種:

  • teamsAppInstallation,格式為?https://graph.microsoft.com/beta/users/{user-id}/teamwork/installedApps/{installation-id}
  • teamsCatalogApp,格式為?https://graph.microsoft.com/beta/appCatalogs/teamsApps/{app-id}

總結(jié)

以上是生活随笔為你收集整理的发送不同类型的ActivityFeed的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。