Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How would I use this Twitter API module to post a tweet?

Hello! I am attempting to make it so pressing a button will post a tweet to a bot account. I am using this API module script: https://www.roblox.com/library/458958433/Twitter-API

I understand that I need to use something along the lines of module.api_call("post", "somepath/here", {--[[data here]]) , I just don't know how because I'm still kind of new to scripting. The part that is most confusing for me is what path I need for tweeting, and what I need to put for data. All help would be greatly appreciated, thank you!

also, if anyone knows a better way of doing this, please tell me!

1 comment

0

did you register your bot on twitter?

1 answer

✓ Accepted answer

The api_call function sends a post request to twitter with a link we specified in the parameters. If we were to call the link ourselves, this is what the link would look like: https://api.twitter.com/1.1/statuses/update.json?status=hello

Anyway, since we want to update the status, we'd make the second parameter "statuses/update" like in the link above. The third parameter are the possible parameters.

You can see here for a list of possible parameters, but right now, we just want to send a tweet that says hello world, so we'll only specify the text we want in the tweet for the third parameter.

The code should end up looking like this

api_call("post", "statuses/update", {"hello, this is my first tweet!"})

if that doesn't work, try:

api_call("post", "statuses/update", {status = "hello, this is my first tweet!"})

11 comments

0

Hello! Thank you so much for your answer! Funny thing is that I found the API docs with this information right before you answered lol. This is still helpful though, thanks!

0

no problem. i'm glad you found the information yourself. I'm too lazy to make a twitter but, but if you mind me asking which of the following code did you have to use? A or B? I think B might be the right way to do it but im not sure since i didn't get to test it

0

After some more testing, apparently neither work??

0

i'll look into it tomorrow

0

okay, thank you!! i'll talk to you tomorrow in that case

0

alright, twitter is making me verify with my phone and i have no clue where my phone is. hopefully i find it by then lol

0

what error are you getting btw?

0

A doesn't give an error but no tweet is seen on my page, B returns this error: Unable to cast value to std::string

0

so A doesn't give you an error or is that some other way that doesnt give you an error?

0

do you have Discord? it'd probably be easier for us to talk there

0

yeah,Lucy#4854 in school right now thouhg

This discussion is preserved as it was. New answers, comments, and votes are closed.