Modmail hosting and installation guide.
Modmail is a self-hosted bot. This unfortunately means that there's no public bot invite. Furthermore, due to the inner workings of the bot and its highly customisable interfaces, you will need to host your own dedicated Modmail bot.
This section provides setup instructions for Modmail on many hosting methods, both free* and paid.
*Some free options require a credit card for verification.
Here are the basic requirements for hosting your Modmail bot. You will find instructions on obtaining and using them in later sections.
- A Discord account.You will need to create a Discord bot under your account.
- A MongoDB database instance.Modmail will store its internal data to this database.
- A hosting server.To keep Modmail running 24/7 in your server.
- A Desktop Notepad, Notes, TextEdit, etc.Anywhere you can copy and paste to temporary store some texts while we set up the bot.
Note: There are two components for Modmail: the bot component and the Logviewer component. You will need both to take full advantage of Modmail.
The first step in setting up Modmail is to create a Discord bot.
Click New Application from the homepage.
Choose a name for your bot, then click Create.
Once you created a new application, head over to the Bot tab and create a new bot.
Navigate to the Bot tab on the sidebar. On this page, you can also edit the About Me section of your bot.
Click Add bot to create the bot.
Click Yes, do it! to confirm your choice.
After adding a bot, reset the token, then copy and store the newly generated token in your Notepad for later.
Click on Reset Token then confirm with Yes, do it! Here you can also set your bot's profile picture.
Click Copy then store the copied token somewhere safe for later steps.
Make sure to keep this token private! Anyone who has this token can control (or "hack") your bot and potentially cause malicious damage. If you feel that your token has been leaked, click on Reset Token immediately to invalidate the old token and generate a new one. Don't forget to also update your Modmail configs with your new token.
Next, we need to change some bot settings. Toggle off public bot, then toggle on both server members intent and message content intent. Remember to click on Save Changes.
Toggle off public bot, toggle on server members intent, and toggle on message content intent. Afterwards, click Save Changes to apply the changes. Your on/off toggles should appear similar to this screenshot.
Disabling public bot prevents other users from inviting your bot. Your bot may not behave appropriately if it's present in other servers.
Enabling server members intent allows Modmail to view your server's members list and efficiently populate the bot's internal cache.
Enabling message content intent allows bot commands to function since Modmail doesn't use slash commands.
What about presence intent? It is not needed for Modmail, but it may be required for specialized plugins. We recommend keeping this toggled off to save computational resources.
Navigate back to the General Information tab and copy the application ID.
Click Copy to copy the application ID. This is also known as your "Bot ID".
Using the following URL as template, replace
YOUR-ID-HEREwith the ID you just copied. Do not change anything else! Open a new browser tab and go to that URL.
Discord should prompt you to choose a server to invite your bot, followed by a list of permissions. Scroll to the bottom and click Authorize.
Choose your server to invite, then click Continue.
Scroll to the bottom and click Authorize. Don't un-check any permissions. Only Administrator is optional.
You must leave on all permissions excepted for Administrator (optional). However, we recommend allowing Administrator for ease of setup and to avoid complications with Discord permissions.
If you manage a large server where you have a separate server for communication among your moderation team, Modmail supports directing threads into the staff server instead of your main (public) server.
You will need to invite your Modmail bot to both your main (public) server and your staff server using the same invite link above.
Modmail uses MongoDB to store its internal configurations and log histories. You must create a MongoDB database in order to use Modmail.
- No credit card required.
- An email account.
Fill in with your info, then click Create your Atlas account. Optionally, you can sign up with Google.
You will need to confirm your email. Open your confirmation email in the same browser.
Once you confirmed your email, you will be greeted by the MongoDB welcome introduction, asking you to "tell us a few things about yourself and your project". You can answer these questions honestly or however you like.
In the next step for "deploy a cloud database", choose the Shared option. Any recommended region (free regions) are fine. Make sure the Cluster Tier is set to M0 Sandbox and the price shows as FREE.
Choose the free Shared option and click Create.
Make sure Shared is selected, then choose any of the "recommended region".
Make sure Cluster Tier is set to M0 Sandbox. The Cluster Name doesn't matter. Click Create Cluster.
On the following Security Quickstart page, do the following:
- 1.Authentication method: Username and PasswordUsername:
modmailPassword: Click Autogenerate Secure Password - don't type your own password!
- 2.Copy and save the password in your Notepad, you will need this for later.From now on, we will be referring to these credentials as the database username and database password.
- 3.Click Create User.
- 4.Scroll down, we will be connecting from: My Local Environment
- 5.Set IP address as
0.0.0.0/0and anything for the description.You must set the IP address exactly to this, unless you know what you're doing. Do not set it to anything else or click add my current IP address. This allows Modmail to connect to your database.
- 6.Click Add Entry.
You can now click Finish and Close on the bottom. Your page should look similar to this:
Click Autogenerate Secure Password, copy and save the database password, then click Create User.
Set IP Address to 0.0.0.0/0, then click Add Entry.
Next, we will need to generate a MongoDB connection string. Simply click Connect on the main dashboard, choose Connect your application, then copy the connection string (the default driver is fine) and paste it into your Notepad.
Click Connect on the main dashboard.
Choose Connect your application.
Copy the connection string.
If you followed all the steps so far, your Notepad should contain three lines: the bot token, the database password, and the MongoDB connection string. For example:
My bot token: MTA3Djv3IAxNjk1NDgdKD231.G1AoUjD.5z629aKP34JKHn4v1EsdNUwdDO3MvBR9ifVES4
My database password: elAO7wF1r07pNG6u
My MongoDB connection string: mongodb+srv://modmail:<password>@cluster0.example.mongodb.net/?retryWrites=true&w=majority
Finally, you will need to combine the database password with the MongoDB connection string by replacing the
<>) with the database password.
You also need to remove everything after
.mongodb.netat the end of the MongoDB connection string.
This is what your Notepad should look like now:
You finished the MongoDB steps! At this point, your bot should still be offline. You can now proceed to the next step which is to choose your hosting method.
Once you have finished the previous steps, gather and save the variables listed below as they will be needed to run your bot in later steps:
TOKEN- The token to run your Modmail application under your Discord bot account
LOG_URL- [Optional] Logviewer URL that will be used to view threads in your web browser
GUILD_ID- The ID of the main Discord server that your bot will operate in.
MODMAIL_GUILD_ID- [Optional] The ID of the Discord server that your bot will create ticket channels in. This is only needed if you want your ticket channels to be created in a separate server, for an example, Staff Server.
OWNERS- The user ID of the Discord accounts you want to set as owner for the bot. Can consist of multiple users, separated by comma.
CONNECTION_URI- The URI the bot will use to connect to your MongoDB instance.
Your finished variables should look something like this:
Your next step is to choose one of our supported hosting method that's available and preferable to you.
Click on one of the links below to view further instructions for your preferred hosting method. Each method has their pros and cons, be sure to take them into consideration when choosing your hosting platform to run Modmail.
A platform as a service (PaaS) that offers a generous free plan, which allows you to host Modmail for free without any downtime. A credit card is required for verification purposes. Their UI is very simple and easy for beginners to quickly deploy and run your Modmail bot on. You can learn more about their Free Tier plan and pricing by clicking here.
A PaaS like Railway but with more advanced UI and more features. Does require credit card for verification but has a dedicated free tier that has no hourly limit. Learn more about their free tier and pricing by clicking here.
If you have an old PC, a Raspberry Pi, or a Linux box that you're able to keep online 24/7, you can also host Modmail with your own machine at home. Since Modmail doesn't require intensive resources to run, you can get by with a system having as low as 1GB of RAM. Setting it up can be quite advanced but you have complete control over your bot instance. Refer to our local hosting guide supporting a few popular OSes by clicking here.
We offer paid hosting solution for your Modmail bot. Hosting Modmail with us costs $4-5 USD per month.
Another popular PaaS that's used to be free. However, their recent pricing adjustments, it now costs $5-7 USD per month to host Modmail.
Apart from Patreon hosting, hosting on a cloud server / VPS is the most reliable hosting method. Rent a virtual server from any reputable hosting provider of your choice for roughly $4-10 USD per month (price varies), and you'll be able to install Modmail onto the server.
This method is a lot more "involved" than other solutions. If you're not comfortable with configuring remote Linux environments, we recommend you to choose a different option. For this method, you will need to refer to our Local hosting installation guide here and choose your desired OS.
The Modmail team does not recommend this hosting method due to their highly unstable and heavily abused environment. That said, we still decided to list this option here as a method for users with no access to valid payment cards since most hosting platforms require them for verification. Please note that our Support Team will not be offering any official help or support if you choose this method to host Modmail.
An online code execution environment. You can host Modmail there for free using certain exploits. The legitimate method costs $7 USD per month. However, regardless if you pay or host for free, hosting on Replit are often unstable and thus not recommended. However, a community guide is still available by clicking here.
Community guides are not verified by the Modmail team, so use them at your own risk.
If you're not satisfied with the options listed above, some of our community members have created their own installation guides for Modmail on various other hosting platforms. Keep in mind that Modmail support staff may not be able to assist you much with community-made guides. Feel free to check them out by clicking the link below.