> ## Documentation Index
> Fetch the complete documentation index at: https://docs.erlc.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Automated Discord Welcome Bot with erlc.dev Studio

> Create an automatic Discord welcome bot that greets new server members, assigns a role, and sends a DM using erlc.dev Studio — no code required.

Building a welcome bot is one of the fastest ways to make a great first impression on new members of your ERLC Discord server. With erlc.dev Studio's drag-and-drop editor, you can trigger a greeting message the moment someone joins, mention them by name, assign them a role, and even slide into their DMs — all without writing a single line of code.

## What you'll build

By the end of this guide your automation will:

* Detect when a new member joins your Discord server
* Send a personalized welcome message that mentions them in a channel
* *(Optional)* Automatically assign a **Member** role
* *(Optional)* Send a private DM to the new member

<Note>
  You need a connected Discord bot in your Studio workspace before building this automation. Head to **Settings → Bot** to link or invite your bot if you haven't already.
</Note>

## Part 1: Basic welcome message

This section builds the core automation — trigger on member join, read their user ID, and send a channel message that mentions them.

<Steps>
  <Step title="Create a new automation">
    Open erlc.dev Studio and click **New Automation** in the left sidebar. Give it a name like `Welcome New Members` and press **Create**.
  </Step>

  <Step title="Add the Discord member-join trigger">
    Drag an **`erlc_when_discord_event`** block onto the canvas. In the **EVENT** dropdown on the block, select **`discord_member_join`**. This block fires once every time a new user joins your Discord server.
  </Step>

  <Step title="Read the new member's Discord user ID">
    Attach an **`erlc_discord_event_value`** block below the trigger. Set its **FIELD** to **`DiscordUserId`**. This block outputs the raw snowflake ID of the member who just joined — you'll use it to mention them in the message.
  </Step>

  <Step title="Build a mention string">
    Attach an **`erlc_discord_mention_user`** block and connect the output of your `erlc_discord_event_value` block into its **USER\_ID** input slot. This converts the raw ID into a Discord mention (`<@123456789>`).
  </Step>

  <Step title="Send the welcome message">
    Attach an **`erlc_bot_send_message`** block. Set **CHANNEL\_ID** to your welcome channel's ID (replace `<resource-id>` with the real value) and wire the mention block into the **MESSAGE** input. You can combine additional text with an `erlc_join_values` block — for example: `"Welcome to the server, "` + mention + `"! 🎉"`.
  </Step>
</Steps>

### Basic welcome — block JSON

The JSON below represents the complete basic automation. Paste it into **File → Import Blocks** in Studio, then replace `<resource-id>` with your actual welcome channel ID.

```json theme={null}
{
  "format": "erlc-studio-blocks",
  "version": 1,
  "workspace": {
    "blocks": {
      "languageVersion": 0,
      "blocks": [
        {
          "type": "erlc_when_discord_event",
          "id": "event_1",
          "x": 48,
          "y": 48,
          "fields": {
            "EVENT": "discord_member_join"
          },
          "next": {
            "block": {
              "type": "erlc_bot_send_message",
              "id": "action_send_1",
              "inputs": {
                "CHANNEL_ID": {
                  "block": {
                    "type": "erlc_text_value",
                    "id": "val_channel_1",
                    "fields": {
                      "VALUE": "<resource-id>"
                    }
                  }
                },
                "MESSAGE": {
                  "block": {
                    "type": "erlc_join_values",
                    "id": "val_join_1",
                    "inputs": {
                      "A": {
                        "block": {
                          "type": "erlc_text_value",
                          "id": "val_prefix_1",
                          "fields": {
                            "VALUE": "Welcome to the server, "
                          }
                        }
                      },
                      "B": {
                        "block": {
                          "type": "erlc_join_values",
                          "id": "val_join_2",
                          "inputs": {
                            "A": {
                              "block": {
                                "type": "erlc_discord_mention_user",
                                "id": "val_mention_1",
                                "inputs": {
                                  "USER_ID": {
                                    "block": {
                                      "type": "erlc_discord_event_value",
                                      "id": "val_user_id_1",
                                      "fields": {
                                        "FIELD": "DiscordUserId"
                                      }
                                    }
                                  }
                                }
                              }
                            },
                            "B": {
                              "block": {
                                "type": "erlc_text_value",
                                "id": "val_suffix_1",
                                "fields": {
                                  "VALUE": "! 🎉 We're glad you're here."
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      ]
    }
  }
}
```

<Tip>
  To find your welcome channel's ID in Discord, enable **Developer Mode** under **Settings → Advanced**, then right-click the channel and choose **Copy Channel ID**.
</Tip>

***

## Part 2: Auto-assign a Member role (optional)

After the welcome message is sent, you can chain an **`erlc_bot_add_role`** block to automatically give the new member a role.

<Steps>
  <Step title="Add the role block">
    Attach an **`erlc_bot_add_role`** block directly after your `erlc_bot_send_message` block in the chain.
  </Step>

  <Step title="Set the user and role">
    * Wire a second **`erlc_discord_event_value`** block (FIELD: `DiscordUserId`) into the **USER\_ID** input.
    * Set **ROLE\_ID** to the ID of your "Member" role (replace `<resource-id>` with the real role ID).
  </Step>
</Steps>

<Warning>
  Your bot must have the **Manage Roles** permission in Discord, and its highest role must be ranked above the role it's trying to assign. Otherwise the block will fail silently.
</Warning>

***

## Part 3: Send a welcome DM (optional)

A private DM is a great place to share server rules, a getting-started guide, or a link to your ERLC community resources.

<Steps>
  <Step title="Add the DM block">
    Attach an **`erlc_bot_dm_user`** block after the role block (or after the send-message block if you skipped Part 2).
  </Step>

  <Step title="Configure the DM">
    * Wire an **`erlc_discord_event_value`** (FIELD: `DiscordUserId`) into the **USER\_ID** input.
    * Connect an **`erlc_text_value`** block into the **MESSAGE** input with your DM text, for example:
      `"Hey! 👋 Welcome to the server. Check out #rules and #getting-started to get oriented."`
  </Step>
</Steps>

<Note>
  DMs can fail if the new member has **Allow direct messages from server members** turned off in their Discord Privacy Settings. This will not crash your automation — the block simply skips silently.
</Note>

***

## Full automation overview

Once all three parts are wired together, your block chain looks like this:

```
erlc_when_discord_event  (EVENT: discord_member_join)
  └─ erlc_bot_send_message  (mention user in welcome channel)
       └─ erlc_bot_add_role  (assign Member role)
            └─ erlc_bot_dm_user  (send private welcome DM)
```

<CardGroup cols={2}>
  <Card title="Moderation Automation" icon="shield-halved" href="/guides/moderation-automation">
    Auto-timeout high-wanted players and log mod actions.
  </Card>

  <Card title="Slash Commands" icon="terminal" href="/guides/slash-command-bot">
    Build custom slash commands like /serverinfo and /kick.
  </Card>
</CardGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.