microsoftgraph / msgraph-sdk-go

Microsoft Graph SDK for Go
https://docs.microsoft.com/en-us/graph/sdks/sdks-overview
MIT License
214 stars 32 forks source link

Add support for `me/chats/48:notes/messages` in order to send message to self #699

Closed AdrienFromToulouse closed 2 months ago

AdrienFromToulouse commented 2 months ago

Currently there is no way by using the SDK client.Me()... to post to the logged-in user's personal chat.

baywet commented 2 months ago

Salut @AdrienFromToulouse Thanks for using the Go SDK and for reaching out. I'm not sure which API you're referring to at this point. Can you please provide a link to the documentation page for the API you're referring to?

AdrienFromToulouse commented 2 months ago

@baywet Thanks for your quick reply,

Is is an undocumented endpoint from the MS Graph API. The endpoint is me/chats/48:notes so for instance to post a message it is /messages.

The deep link being https://teams.microsoft.com/l/chat/48:notes/conversations

It is the ID of the "self" chat.

baywet commented 2 months ago

Thanks for the additional context here. So this is simply a "magical constant" but effectively the features of the chats operations remain the same?

AdrienFromToulouse commented 2 months ago

Thanks for the additional context here. So this is simply a "magical constant" but effectively the features of the chats operations remain the same?

I would say yes but to be honest I am not aware of the entire interface about chat - may be they are some features that are implicitly excluded by the fact that it is the "self-chat".

Also for the record, this "special" chat is not listed when doing https://graph.microsoft.com/v1.0/me/chats not sure if it is a bug or a feature on Microsoft API side.

Would you need more information?

baywet commented 2 months ago

This repository is dedicated to the Go SDK. The service teams are not watching it. The best thing to do is to ask a question on Microsoft Q&A where service team members will be able to reply. Closing

AdrienFromToulouse commented 2 months ago

@baywet not sure to understand, I was hoping that implementing the endpoint in the SDK itself would be possible. Not quite sure to understand the link with MS Q&A. I am not trying to "understand" your API, I already understood it by creating this issue in the first place. My point was about the SDK since in the description I reference: client.Me()

Anyways thank you for your time.

baywet commented 2 months ago

Yes, the name can be confusing. Where Microsoft Q&A was originally a platform to ask questions and get answers, it's now also a place to provide feedback about the documentation, the products and more.

This "endpoint" is only a key in the chat collection as far as I understand, and wouldn't mandate its own SDK implementation since the operations can already be performed with the existing chat operations the SDK offers.

AdrienFromToulouse commented 2 months ago

Yes, the name can be confusing. Where Microsoft Q&A was originally a platform to ask questions and get answers, it's now also a place to provide feedback about the documentation, the products and more.

This "endpoint" is only a key in the chat collection as far as I understand, and wouldn't mandate its own SDK implementation since the operations can already be performed with the existing chat operations the SDK offers.

I understand your design choice. The thing is that I don't know the SDK much. My original point was that the client.Me() could offer a method to "directly" post a message without having to figure out that in fact the "me" channel has an undocumented ID that is "48:notes".

So instead of having to do (which works too)

messages, err := graphClient.Chats().ByChatId("48:notes").Messages().Post(context.Background(), requestBody, nil)
    if err != nil {
        return err
    }

it would be a better DX to have something like:

messages, err := graphClient.Me().Chat().Messages().Post(context.Background(), requestBody, nil)
    if err != nil {
        return err
    }

Cheers,

baywet commented 2 months ago

all valid points, something I forgot to mention in the previous reply: this SDK is generated from an API description the service teams provide. If they provided such a shorthand, we'd have it in the SDK. Hence my suggestion to reach out to them in Microsoft Q&A.