Need help with my tweet button on my random quote generator

I’m currently working on my random quote machine project, and I can’t figure out how to make a twitter button that opens to a pre-populated tweet with the quote imputed in it. I’ve tried searching twitter’s documentation, but I can’t seem to figure it out. (To be entirely frank here, I don’t really understand the whole API’s thing to begin with.)
Can anyone help me out please?

Yes, APIs are confusing enough to begin with and every one is different and they are often poorly documented.

So I ignored Twitter’s API and did it an easier way:

window.open("https://twitter.com/intent/tweet?text=" + text);

Thank you! That works great!

I also used this one-line technique and it works great. Having said that, if tweeting a quote did not involve putting the text in the URL, the solution would be more complicated.