Skip to content

I keep on getting this error on XboxLiveClient.send_message() #107

@mas6y6

Description

@mas6y6

I don't know how to format the messages and I keep getting this error

Here is my code for the sending script:

async def send_message(auth_mgr, recipient_xuid, message_text, client_session):
    xbl_client = XboxLiveClient(auth_mgr=auth_mgr)
    try:
        formatted_xuid = recipient_xuid
        print(formatted_xuid)
        await xbl_client.message.send_message(
            xuid=recipient_xuid,
            message_text=message_text
        )
        print(f"Message sent to XUID {recipient_xuid}: {message_text}")
    except Exception as e:
        traceback.print_exc()
        print(f"Failed to send message: {e}")

But keep on getting this annoying error

Traceback (most recent call last):
  File "/Users/*****/Desktop/Python projects/*****/xbox_messaging_debug.py", line 50, in send_message
    await xbl_client.message.send_message(
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/xbox/webapi/api/provider/message/__init__.py", line 133, in send_message
    resp.raise_for_status()
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/httpx/_models.py", line 761, in raise_for_status
    raise HTTPStatusError(message, request=request, response=self)
httpx.HTTPStatusError: Client error '400 Bad Request' for url 'https://xblmessaging.xboxlive.com/network/Xbox/users/me/conversations/users/xuid(*****)'
For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/400
Failed to send message: Client error '400 Bad Request' for url 'https://xblmessaging.xboxlive.com/network/Xbox/users/me/conversations/users/xuid(*****)'
For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/400

I dont know if there is a format for the xuid that I need or something else...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions