This might help you get started perhaps:
I know it’s Twitter so it’s not entirely relevant.
And then there’s also this:
https://community.home-assistant.io/t/mastodon-follower-count-and-other-profile-sensors/561095
Apologies if it’s not exactly what you’re looking for but IMO, Home Assistant might be the easiest way to get this kind of API interaction with actual motors and microcontrollers.