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

send_direct_message returning 404 page not exist #535

Open
sherluck08 opened this issue Jun 17, 2020 · 3 comments
Open

send_direct_message returning 404 page not exist #535

sherluck08 opened this issue Jun 17, 2020 · 3 comments

Comments

@sherluck08
Copy link

I'm trying to send DM with this it's returning 404 sorry page not exist.

here's what I tried
api.send_direct_message(type='message_create', recipient_id="id", message_data="test message"))

@alexacallmebaka
Copy link

This may help.

@tadeoos
Copy link

tadeoos commented May 13, 2021

The 404 response is due to the erroneous endpoint definition. In the EndpointsMixin.send_direct_message the URL is defined as direct_messages/new it should be direct_messages/events/new. Unfortunately, this is not enough. The example given in the SO answer linked above is not working because of the _transparent_params helper function. We can't pass the whole event dict to the post method:

twitter.send_direct_message(event = {"type": "message_create",
    "message_create":{"target": {"recipient_id": ID goes here},
    "message_data":
    {"text": "Hello World!"}}})

because _transparent_params can't handle dictionaties with embedded dictionaries and our params getting truncated to {}

@tadeoos
Copy link

tadeoos commented May 13, 2021

The above comment is valid for 3.7.0 version. I see that in the newest version this should work correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants