Help:Wanted

This page is for project participants to ask for help with significant tasks within the ForkTogether project. They don't have to be technical.

from Woozle

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 Glitch.com. 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 botsin.space.)

y6nh

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.

Feufochmar