The easiest way to explain how bots work is to compare them with physical robots. Unlike physical robots, they do not consist of physical machine parts, such as screws, screw threads, plastic, and wires. They are instead made up of code. The code contains the required commands and instructions for telling the bot how to communicate actively with or in response to human users, systems or other bots.
Designing bots can be very simple. However, modern bots also use complex code and artificial intelligence which can sometimes make them hard to distinguish from human users in a social network. Nowadays, even your average Joe can program a bot. There are numerous tools and interfaces available online that enable users to program both simple and complex bots. For example, Twitter allows you to create your own chatbots for tweets, retweets, and likes.
Below, you will find a snippet of code from a chatbot. In this example, the bot uses the XML-based description markup language AIML, which is frequently used for chatbots.