The Definitive Guide to Creative Botmaking

How to make a bot for Fediverse/Mastodon, Twitter, Tumblr, and other networks.

Bots galore!

📅 November 28, 2022

So you want to make a friendly/useful/artistic online bot and probably have a bunch of questions, like How often should my bot post? or Why am I getting this weird error message? and How do I even make a bot? And what IS a bot?

Hopefully this ambitiously titled guide will answer your questions — and you are always free to ask for more help in the Botmakers community.

General botmaking tips

What kind of a bot should I make?

The bottom line is this: don’t let your bot annoy people. Try to avoid interacting with people who don’t follow your bot or knowingly initiate the conversation either through a post with your bot’s handle, or a direct message.

There certainly are clever examples of bots who do interact with random folks who didn’t explicitly opt-in, but this is a bit of a gray area and you should use your best judgement here.

On Mastodon, people often add the #nobot hashtag in their profile bios to indicate that they do not wish to interact with automated accounts, so definitely look for that.

Also, just because some information is public, it doesn’t mean it deserves exposure.

And it hopefully doesn’t even need to be said that you shouldn’t make bots that harass people, post spam, or do any other malicious activity. Remember, bots should always punch up, never punch down. And people don’t seem to care too much about “ebooks” accounts.

As for what your bot should do, well, here are a few tips:

For even more inspiration, check out these essays and articles.

Making a good bot is not always a straightforward process, with steps to go through. Sometimes the decisions you make affect each other, for example, you can start with an idea and then decide what language and hosting platform you’ll use.

But you can also first look at the various platforms you can use to host your bot and play with their strengths and limitations. More on that in an upcoming section.

How do I make a bot?

With most of the non-technical questions out of the way, it’s time to actually build your bot.

Botwiki has plenty of tutorials and there are many open-source bots and Twitter bot project templates on Glitch that you can use.

Just find one that’s close to your own bot idea and take it from there.

Should I run the bot as an always-on app, or use a scheduler?

This depends on the type of a bot you’re making, so for bots that respond to messages or certain real-time events, it makes to run them as persistent apps. But unless needed, it seems that most people prefer to schedule their bots.

Do I need to set up a separate account for testing my bot?

This is up entirely up to you, but here’s how some people approach it.

Do I need to disclose if an account is a bot?

Yes!

On Mastodon, this changes how the network sees the account. According to this helpful StackOverflow answer:

If you’re making a bot on Twitter, refer to the Developer Policy that states that if you’re operating an API-based bot account you must clearly indicate what the account is and who is responsible for it.

How often should my bot post?

Alright, you might have a rough idea what your bot is going to be posting about now, great! How often should it post though?

Some networks, like Twitter, have limits on how often you can call their API, so you should keep those in mind.

Other than that, it’s all about striking the right balance. If your bot posts every time a certain event happens, it’s okay if your bot posts more frequently.

But also consider that some people don’t want their home timeline cluttered with just one account, so for bots that don’t work with real-time data, spacing the posts out makes a lot of sense. As I said above, one good rule to follow is to make sure your bot doesn’t annoy people.

There are bots that post every hour, once or twice a day, or even just once throughout the whole year.

Here are some thoughts from a member of Botmakers:

Hard question. I look at it as a logarithmic-scale line starting at once a minute and ending somewhere around once a week or month.

There is a hard upper bound of 25 tweets per 15 minutes per account.

There are multiple approaches you can take to figured this out, and they’re mostly situational:

The easiest approach is to have your bot post as often as it can, like if you’re running @congressedits, you want to catch all edits.

If you have too much information for this and need to attenuate the flow, or if your corpus is fixed or precomputed, then it comes down to questions like, do I want to follow this bot myself? How often would I like to hear from it if so? Is there prior art that I am mimicking? If it’s a fixed corpus, how long should it run before it ends? How often would others like to hear from it? should it be annoying/how much so?

If you’re unsure, post every 30 or 60 minutes, tweak it later if you don’t like it.

— @air_hadoken

Another thing to consider is, do you want your bot to post on the hour? Or is it better to offset the time a bit so that it doesn’t clutter its followers timeline when all the other bots they follow post.

Do your scheduled bots post exactly on the hour? For example, at 9am, 1pm, 5pm, etc.

Or do you schedule your bot for a less common time, eg: 9:15am, 1:30pm, or something completely random each time the bot posts?

— botwiki.org (@[email protected]) 2023-07-10T18:11:49.501Z

Or how do you deal with repeating content?

For bots that post random stuff from a list, do you post completely randomly, or do you tweak your bot to, for example, avoid posting the same thing twice in a row?

What strategies do you use?

— botwiki.org (@[email protected]) 2023-07-13T14:48:06.893Z

Do I need to attribute content posted by my bot?

Absolutely!

Am I responsible for everything that my bot does online?

You bet.

Where should I host my bot?

There is a number of platforms you can use depending on how much you’re willing to spend (no worries, free options exist) and how complex your bot is.

For simpler bots, check out Cheap Bots, Toot Sweet! and Cheap Bots, Done Quick!, a pair of sites that let you make Mastodon and Twitter bots, respectively, with Tracery, and completely for free.

Want to make something more advanced? Check out the Creative Bots project.

For a comprehensive list of available hosting platforms, see the Hosting platforms page on Botwiki.

Why is my bot not working?

The API you use to automate your bot will usually return an error message that should help you understand why your bot stopped working.

For example, if you’re using the Twit library, here’s how you can see the error message:

T.post('statuses/update', { status: 'hello world!' }, function(err, data, response) {
  if (err){
    console.log(err);
  }
});

It’s possible that your bot posts or reads data too often, then you just need to adjust the frequency. It’s also possible that your bot was suspended, in which case you might also get an email notification and instructions on what to do next.

If you’re not getting any error messages, and the bot doesn’t seem to be suspended, the problem might be with your code. It’s perfectly fine to ask for help, in fact, that’s why the Botmakers community exists.

How do I make my bot accessible to everyone?

Check out this handy guide on this topic!

How do you typically handle image description for your image bots?

Feel free to share any useful tips!

— botwiki.org (@[email protected]) 2023-04-25T15:14:13.690Z

My bot doesn’t have enough followers

Share your bot with @botwikidotorg and the Botmakers community! Try adding relevant hashtags to your bot’s posts every now and then. Hashtags are particularly important on Mastodon, so bots posting there should always include some so that others can find them.

But at the end of the day, learn to enjoy the process and do it for the fun. Getting a ton of followers shouldn’t be the goal and it’s often about luck!

Use the same email (sort of) for multiple accounts

One neat trick you can use when registering for a new account is adding +SOMETHING to your email address, for example, [email protected]. This will let you use the same email address for multiple accounts.

Mastodon bots

Yes, but the type of content you can search for can be limited. For example, on mastodon.social instance you can only search local accounts and hashtags, but you can’t search the individual toots.

How do I get the RSS feed of my bot?

To get the RSS feed of your bot’s output, add .rss to your bot’s URL, so for example:

https://botsin.space/@southpoleviews

will become

https://botsin.space/@southpoleviews.rss

Should I automatically delete my bot’s old posts?

Doing this will help ease the load on the instance, especially if the bot generates images or other media.

Do you automatically delete your bots' old posts?

— botwiki.org (@[email protected]) 2023-05-14T14:45:22.783Z

But most importantly, consider donating money to the instance admin!

Twitter bots

Note on needing a phone number

One tricky part of making a bot for Twitter is that if you want your bot to be able to actually post on Twitter, rather than just read from it, you will need to add a phone number to your account.

There is a few ways to solve this:

How can I use the same developer account for all my bots?

Check out the Tools section on the Resources for Twitterbots page. There’s also a few helpful tutorials:

Can I make a bot that tracks keywords or hashtags?

From Twitter’s Automation rules:

Automated Retweets: Provided you comply with all other rules, you may Retweet or Quote Tweet in an automated manner for entertainment, informational, or novelty purposes. Automated Retweets often lead to negative user experiences, and bulk, aggressive, or spammy Retweeting is a violation of the Twitter Rules.

As explained above, there are some gray areas when it comes to automating certain actions on Twitter, including automated retweets.

One way around getting your retweet bot suspended is to make your bot private. This way you can follow the topics you’re interested in without bothering anyone since notifications from private accounts don’t show up to people your bot is not following.

The biggest drawback here is that it will be harder for others to discover your bot, and as of February 2017, there is no way to approve follower requests for a protected account via the Twitter API, so you will have to handle follower requests manually.

Stop the Twitter email spam

Twitter doesn’t really differentiate between “regular” user accounts and bots. Bots are really just automated user accounts — in fact, you could easily add some automation to your own account while you’re still using it as a human.

One of the problems with this setup is that Twitter will happily send emails and other notifications to your bot as if it was a real person, unless you specifically opt-out.

How can I apply for the #GoodBots label?

You can’t quite yet, but hopefully soon! (Learn more here.)

Wrap up

I hope this guide will help you deal with some of the biggest questions and challenges of making friendly online bots. Be sure to join us in the Botmakers community. We are artists, journalists, educators, tinkerers, bot enthusiasts, seasoned developers, and always happy to help a fellow botmaker out 🙂

If you’d like to leave me feedback and suggestions for this guide, feel free to send me an email!

And you can see more of my tutorials here.

Special thanks

Stefan

Creator of Botwiki and Botmakers, Botwiki editor, and Botmakers community manager.

Enjoyed the tutorial?

Consider supporting Botwiki!

Latest from the blog

Eight years of Botwiki, and 2,000 bots

Happy birthday, Botwiki!

Cheap Bots, Done Quick suspended, this time for good

So long, and thanks for all the bots.

Twitter shutting down free access to their API on February 9

I keep saying it's an end of an era quite often these days.

Visit the blog

.