You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 8, 2024. It is now read-only.
Is there any way I can automatically retrieve media from DM and tweet them using this client?
I have managed to retrieve the URL. However, I am not authorized(?) to access it and I am not sure how to exactly do that.
My understanding is that I need to have access to it in order to be able to download it, get the raw binary or base64 encoding of it, and finally upload and tweet it.
Is my understanding correct or is there a better way to do so?
Thank you.
The text was updated successfully, but these errors were encountered:
Twitter has an unfortunate error response saying that you're not authorized, while in fact, it's like not to be the case.
Most likely there's a problem with how the encoding/decoding works internally.
Please do not worry too much since I believe this is not a bug in your code but rather simply an incompetence on my end.
First, allow me to explain to you the bot that I am trying to make.
Basically, the bot works by tweeting whatever is sent to it through the DM.
I made the bot with Twitter Account Activity API using the help of Twitter Autohook.
I followed this particular tutorial of which the whole code can be found here.
Everything was great, I only needed to modify the DM response part with a tweet instead.
However, as you might have known, the tweet API endpoint receives query params instead of a JSON object.
Here, I decided to use this client so that I don't have to deal with OAuth signing etc.
So everything went great, but then I decided to implement a feature such that it can also tweet the media attached to the DM.
This is where I am stuck. I managed to retrieve the media URL, however I am not authorized to access it.
Do keep in mind that I am not using the client in this part yet (I only use it for tweeting and plan to use it to upload the attached media later).
I tried making a GET request to the URL with Postman + Authorization header and it worked.
I might be able to do it with the node-fetch module but, again, I don't want to deal with OAuth signing.
So my question is:
Can I make a GET request to fetch the image using this client so that I don't have to deal with OAuth signing, or
Can I somehow get myself in an "authorized session" using this client so that I can fetch and upload the media right away, or
Is there a better way to do what I am trying to achieve (maybe like directly upload the attached media from media URL or media ID using this client)
Afterthoughts
Upon writing this comment I looked back into the full code from the tutorial and decided that I need to look into the Request module.
I avoided using it because it says that it is deprecated.
I will report back to you later on whether it works or not.
Hi,
I just started making a Twitter bot.
Is there any way I can automatically retrieve media from DM and tweet them using this client?
I have managed to retrieve the URL. However, I am not authorized(?) to access it and I am not sure how to exactly do that.
My understanding is that I need to have access to it in order to be able to download it, get the raw binary or base64 encoding of it, and finally upload and tweet it.
Is my understanding correct or is there a better way to do so?
Thank you.
The text was updated successfully, but these errors were encountered: