# Discourse

Discourse is an open-source discussion platform designed for online forums, communities, and team collaboration. It offers structured discussions, real-time notifications, trust-based moderation, and customizable integrations to enhance community engagement and knowledge sharing.

### **How to Integrate Discourse with ZBrain Flow** <a href="#how-to-integrate-discourse-with-zbrain-flow" id="how-to-integrate-discourse-with-zbrain-flow"></a>

1. Click the '+' button in ZBrain Flow.
2. Search for Discourse in the list of available integrations.
3. Select the desired action to configure it in the Flow.

### **How to Create a Discourse Connection in ZBrain Flow** <a href="#how-to-create-a-discourse-connection-in-zbrain-flow" id="how-to-create-a-discourse-connection-in-zbrain-flow"></a>

1. **Enter Connection Name** – Assign a name to identify your Discourse connection.
2. **Enter API Key** – Required to authenticate requests.
3. **Enter API Username** – The username associated with the API key.
4. Obtain API Key and API Username by following these steps:
   * Log in to your Discourse Admin account.
   * Navigate to the Admin Panel:
     * Click on your profile picture (top-right).
     * Select ‘Admin’ from the dropdown.
   * Go to the API Section:
     * Click ‘Settings’ → ‘API’.
   * Generate a New API Key:
     * Click ‘New API Key’.
     * Fill in the details:
       * Description – Name your API key.
       * User Level – Choose All Users or Single User.
       * Scope – Set permissions (Granular, Read-only, or Global).
     * Click ‘Save’ to generate the API key.
   * **Copy the API Key** – You will only see it once, so store it securely.
   * If ‘Single User’ was selected, enter the username of the associated user.
5. **Enter Website URL** – Provide your Discourse instance URL (e.g., `https://discourse.yourinstance.com`).
6. Click ‘**Save’** – Your Discourse connection is now set up in ZBrain Flow.

### **Actions Available in ZBrain Flow** <a href="#actions-available-in-zbrain-flow" id="actions-available-in-zbrain-flow"></a>

#### **1. Create Post** <a href="#id-1.-create-post" id="id-1.-create-post"></a>

Create a new post on an existing Discourse topic.

**How to Configure:**

* Select an existing connection or create one.
* Enter the Post content.
* Enter the Topic ID where the post should be created.

#### **2. Create Topic** <a href="#id-2.-create-topic" id="id-2.-create-topic"></a>

Start a new discussion topic in Discourse.

**How to Configure:**

* Select an existing connection or create one.
* Enter the post title.
* Enter the topic content.
* Enter the category ID to assign the topic.

#### **3. Change User Trust Level** <a href="#id-3.-change-user-trust-level" id="id-3.-change-user-trust-level"></a>

Modify a user's trust level in Discourse.

**How to Configure:**

* Select an existing connection or create one.
* Enter the user ID.
* Enter the new trust level.

#### **4. Add Users to a Group** <a href="#id-4.-add-users-to-a-group" id="id-4.-add-users-to-a-group"></a>

Assign users to a specific group in Discourse.

**How to Configure:**

* Select an existing connection or create one.
* Enter the Group ID.
* Add users by clicking ‘+ Add Item.’

#### **5. Send Private Messages** <a href="#id-5.-send-private-messages" id="id-5.-send-private-messages"></a>

Send a private message to specific users on Discourse.

**How to Configure:**

1. Select an existing connection or create one.
2. Enter the message title.
3. Enter the message content.
4. Add users by clicking ‘+ Add Item.’

#### **6. Custom API Call** <a href="#id-6.-custom-api-call" id="id-6.-custom-api-call"></a>

Perform a custom API request to a specific Discourse endpoint.

**How to Configure:**

1. Select an existing connection or create one.
2. **Enter the HTTP Method** – Choose from:
   * GET (Retrieve data)
   * POST (Send data)
   * PATCH (Modify data)
   * PUT (Update or replace data)
   * DELETE (Remove data)
   * HEAD (Fetch headers only)
3. **Add Headers** – Define request headers using the provided input fields. Authorization headers are automatically injected from your connection.
4. **Add Query Parameters** – Enter query parameters using the designated input fields to customize API requests.
5. **Enter JSON Body** – Provide request data in JSON format.
6. **Set Timeout (in seconds)** – Define the request timeout duration.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.zbrain.ai/zbrain-documentation/zbrain-builder/flows/flow-components/discourse.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
