Automate post creation on Discourse with multiple users

Summary
This Python script automates the process of creating topics on Discourse by rotating through multiple user accounts. Once all users have posted, it loops back to the first user, making it ideal for distributed post creation on large forums. The script is useful for testing forum functionalities, such as post creation, API handling, or load testing, without requiring manual input for each post.

:hammer_and_wrench: Repository Link
GitHub Repository

:open_book: Install Guide
Clone the repository, configure your environment variables, create a topics.json file with the topics, and run the script.

Why Use This Script?

This script is designed for testing purposes, primarily to simulate the creation of multiple posts on your forum. It automates the task of posting topics from multiple user accounts, which can be helpful in scenarios like:

  • Testing API Integration: Ensure your Discourse forum API can handle multiple post requests and user interactions.
  • Load Testing: Test how your forum responds to a large volume of posts and user interactions in a short period.
  • Automation: If you need to create several posts quickly for setup or testing purposes, this script automates that process, saving time.

When to Use:

  • Testing Forum Features: If you’re developing or customizing a Discourse forum and need to ensure the post creation flow works smoothly with multiple users, this script can help test that.
  • Simulating User Interaction: Use this script to simulate posts from various users for testing purposes like moderation, content display, or user notification features.

When Not to Use:

It is not recommended to use this script for creating real content on your forum. Creating dummy posts just for the sake of filling up the forum could lead to an overcrowded and irrelevant forum. It is always advisable to encourage genuine user participation and create real posts to engage your community meaningfully. This script is purely for testing and development purposes, so avoid using it for routine content creation or as a way to artificially populate your forum.

Features:

  • Revolving User Accounts: Posts are distributed evenly across all users, ensuring fair load distribution.
  • Customizable Topics: Adjust titles, bodies, categories, images, and Markdown formatting for each topic.
  • Asynchronous Posting: Create topics quickly and efficiently with concurrent requests.

This script can be seamlessly teamed with the Discourse Users repository to automate the creation of multiple users on your Discourse forum. Once the users are created using the Discourse Users script, you can then use this posts script to automatically generate posts from each user account. This combination allows you to quickly set up both user accounts and test post creation functionality, making it ideal for testing, load simulations, and automated content generation on your forum.

Just a note, @MihirR , the automation tag is for topics relating to Discourse Automation.

1 Like

Oh sure, my bad! Will keep in mind :slight_smile:

1 Like