from Woozle

Update: was able to get a Mastodon bot working sometime in 2018.

I could use assistance from anyone familiar with the process of getting bots working with Mastodon. I got as far as being able to connect to an instance and get public information, but anything beyond that seems to require creating or accessing some kind of key (a "shared secret", I think?) and I don't know how to do that.

I'll be writing in PHP, but you don't have to know PHP to be helpful; I think I mainly need to know what the process is in an algorithmic kind of way. Tell me what needs to happen, and I can figure out how to make PHP do it.

The same applies for Discord bot authorship, although my needs for that are less immediate.

Thanks! —woozle

I made a couple of simple Mastodon bots by forking this one on That's written in JavaScript, but I expect you can make sense of it. The key and access token you can get from the Mastodon web interface. Register and log in as your bot, then click Settings, then Development on the left-hand side. Click the button to create a new app; give it a name and web address (your site or whatever), and the permissions it needs. Leave the "Redirect URI" as it is. When you OK that, you should be able to click on the name of the app and get its access codes.
There must be a more automated way to get the codes through the API, but the manual method is fine if you're setting up a bot or two.
(Some instances don't allow bots, or have special rules for them, so make sure you check the terms and conditions. If in doubt, use

Once you have the access tokens for your application, you need to add the following header in the HTTP requests when using an API call needing authorization:
"Authorization: Bearer <access_token>"
Replace <access_token> with the one displayed on your application page.
The client ID and secret are only needed when making a "login with Mastodon" feature on an application.

The only bots I've done were ones that post from RSS feeds, but if taking a lot at the code for those would help it's:
It's a little Python thing. IIRC it automated getting the token, but you still had to sign-in to give the bot posting access?
— rjt (talk)