Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set and unset reaction on chatMessage or use raw URL #920

Closed
nakasix opened this issue Oct 5, 2024 · 2 comments
Closed

Set and unset reaction on chatMessage or use raw URL #920

nakasix opened this issue Oct 5, 2024 · 2 comments
Assignees
Labels
type:feature New experience request

Comments

@nakasix
Copy link

nakasix commented Oct 5, 2024

Is your feature request related to a problem? Please describe the problem.

Hello,

I would like to set an unset reaction on chatMessage, but I don't think the SDK supports it.

Is it possible to add it?

Describe the solution you'd like.

For example:

  • Set: await graph_client.users.by_user_id('user-id').chats.by_chat_id('chat-id').messages.by_chat_message_id('chatMessage-id').set_reaction.post('reaction-type')
  • Unset: await graph_client.users.by_user_id('user-id').chats.by_chat_id('chat-id').messages.by_chat_message_id('chatMessage-id').unset_reaction.ost('reaction-type')

Additional context?

In the meantime is it possible to make a post with a raw URL and data with SDK ? A possible example :)
I tried that, but it didn't work :(

str_url = "https://graph.microsoft.com/1.0/chats/{}/messages/{}/unsetReaction".format(str_chat_id, str_message_id)
await self.obj_client.chats.with_url(str_url).post(body={"reactionType": str_reaction})

Or is it possible to retrieve the access_token from SDK to use the requests module?

@nakasix nakasix added status:waiting-for-triage An issue that is yet to be reviewed or assigned type:feature New experience request labels Oct 5, 2024
@shemogumbe
Copy link
Collaborator

Hello @nakasix thanks for using the SDK and for raising this.

While this is currently not supported due to metadata constraints, there are multiple ways you can do this via Raw URL calls through the SDK or using the python requests library:
Using python requests
Once you have the access token, you can always do requests using requests library or urllib.

credentials = ClientSecretCredential(tenant_id=tenant_id,
                                     client_id=client_id,
                                     client_secret=client_secret)
# Scope for Microsoft Graph API (default scope)
scopes = ["https://graph.microsoft.com/.default"]

# Create the GraphClient using the token from the credential
client = GraphServiceClient(credentials=credentials, scopes=scopes)

token = credentials.get_token(*scopes).token

# use the url you are interested in here
url = "https://graph.microsoft.com/v1.0/users"
headers = {
    "Authorization": f"Bearer {test_token}",
}

response = requests.get(url, headers=headers)

@shemogumbe shemogumbe added status:waiting-for-author-feedback Issue that we've responded but needs author feedback to close and removed status:waiting-for-triage An issue that is yet to be reviewed or assigned labels Oct 8, 2024
@nakasix
Copy link
Author

nakasix commented Oct 8, 2024

Hello @shemogumbe ,

Thanks, that's exactly what I wanted :)

@nakasix nakasix closed this as completed Oct 8, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot removed the status:waiting-for-author-feedback Issue that we've responded but needs author feedback to close label Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:feature New experience request
Projects
None yet
Development

No branches or pull requests

2 participants