Is there any way that I can monitor a channel of MS Teams so that I can get all real-time messages posted in the channel?I used to use websocket connection to meet that kind of requirement,but this time I can't find any websocket related information in the Graph API documentation or anywhere.So where should I begin?
Asked
Active
Viewed 1,397 times
1
-
1Not sure about web sockets, but you can create a subscription to a team channel resource and then get near real time notifications (HTTP request) whenever a new message is sent in that channel, https://learn.microsoft.com/en-us/graph/api/subscription-post-subscriptions?view=graph-rest-beta&tabs=http – Noam Jul 29 '20 at 13:29
-
I notice that ```NotificationUrl``` is set in the sample code.I wonder what url should I set if I want to craft a winform application to create a subscription on each channel of teams. – Xia Jul 30 '20 at 05:51
-
The url needs to be publicly available from the internet. This isn't going to work in a Windows Forms app. – Stephan Jul 30 '20 at 12:16
-
@Stephan Thanks a lot.So I guess I can't use channel subscription on my app.Is there any other way that I can get real-time message? – Xia Jul 30 '20 at 13:03
-
How about using the change feed and then start polling? – Stephan Jul 30 '20 at 14:35
-
@Stephan any sample code about chnage feed?It's just I am new to the Graph API. – Xia Jul 31 '20 at 02:28
-
I'm not sure if also supported with chatMessages, but this link show you how it works with messages https://learn.microsoft.com/en-us/graph/delta-query-messages – Stephan Jul 31 '20 at 10:51
-
so if I want to know if there is any change in the channel I have to send a request with last request's delta link?If so,it's very tricky about how often should I send a new request.I don't think it's a good way to get real-time message. – Xia Jul 31 '20 at 11:57
-
Since you’re building a Windows Forms app, you have no way the get real time messages. This why you don’t have to build a check if it returns new messages. You could also setup a backend, subscribe to notifications, send SignalR message to all clients. – Stephan Aug 02 '20 at 20:16