microsoftgraph / microsoft-graph-toolkit

Authentication Providers and UI components for Microsoft Graph 🦒
https://docs.microsoft.com/graph/toolkit/overview
Other
924 stars 287 forks source link

Teams messaging component #269

Open nmetulev opened 4 years ago

nmetulev commented 4 years ago

Create a Microsoft Teams messaging component to allow:

  1. Read messages in a channel or a chat
  2. Send messages

The component should allow for polling to receive messages, as well as hooks for receiving notifications for a service using webhooks.

sohilbhalla commented 3 years ago

Hi @nmetulev , I have build a local Teams Messaging using the standard graph api connectors like <Get> with Polling Enabled , <Person>and doing the POST using standard Graph API calls. Here is the Link of the screenshot of how it has come out.

<Get cacheEnabled={Constants.IsGraphApiToolkitLastMessageItemCacheEnabled} cacheInvalidationPeriod={Constants.LastMessageCacheInvalidationPeriod} pollingRate={Constants.LastMessagePollingRate} scopes={Constants.GraphToolkitGetScopes} maxPages={1} version="beta" resource={"teams/" + this.props.TeamId + "/channels/" + this.props.ChannelId + "/messages/" + this.props.MessageId + "/replies?$top=1"}>
                            <LastMessageItem template="value" />
                            <LoadingTemplate template="loading" />
                        </Get>

<Person line1Property={"givenName"} fetchImage={true} userId={props.dataContext.from.user.id} showPresence={true} personCardInteraction={1} view={PersonViewType.oneline}></Person>

I believe we can develop the teams apps with the existing Graph API toolkit components itself, as far as we are clear how to place them. Let me know your thoughts.

nmetulev commented 3 years ago

Hey @sohilbhalla , this looks interesting. What do you think about contributing this as a story in mgt.dev?

sohilbhalla commented 3 years ago

I would love to @nmetulev . Please redirect me to the correct location to share the story . Are you referring to this - https://storybook.js.org/docs/react/get-started/introduction Thanks

sohilbhalla commented 3 years ago

Hello @nmetulev

I released the teams chat to few users and I am having hard time with the Polling of MGT-GET as it is hitting the throttling limits when released to few audiences. As per the recommendations from MS is that we should not keep polling for the data to check the latest changes . Polling Recommendation

On the other hand we have the capability of polling in milliseconds out of the Box in Graph API toolkit. I cannot understand the significance behind it. If we need to have a chatty behavior we need to keep polling near real time, that is where the issue arises with throttling.

On the other hand we are planning to implement change notifications for new messages as well, using webhooks and SignalR to update the front end, instead of polling. As we see polling will become a bottleneck anytime in future as in when users will increase. Please share your thoughts.

nmetulev commented 3 years ago

Hey @sohilbhalla, I agree that change notifications (#626) would be ideal in this use case - as you mentioned, polling itself is not recommended for all scenarios. Ideally, mgt-get and other components would support integration with change notifications via a developer created service - I'd imagine we'd need to create and document an interface for developers to hook into through their service.

Happy to discuss how that could work and fully open to any suggestions and/or contributions if you are up to it.

gavinbarron commented 11 months ago

This work is being undertaken using notifications to mitigate the need for polling.

The work is described in this board: https://github.com/orgs/microsoftgraph/projects/20/views/48