Installation
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.
Create a Discord bot
The first step in setting up Modmail is to create a Discord bot.
Head over to the Discord Developer Portal and create a new application.
Once you created a new application, head over to the Bot tab and create a new bot.
After adding a bot, reset the token, then copy and store the newly generated token in your Notepad for later.
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.
Inviting the bot
Navigate back to the General Information tab and copy the application ID.
Using the following URL as template, replace YOUR-ID-HERE
with 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.
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.
Your bot should now be offline in your server. Congratulations, that's as expected! You have successfully created a Discord bot. The next step is to create a MongoDB database.
Create a MongoDB database
Modmail uses MongoDB to store its internal configurations and log histories. You must create a MongoDB database in order to use Modmail.
We will be using MongoDB Atlas, which provides us with a free 512MB storage share—more than enough for Modmail.
Requirements
No credit card required.
An email account.
Head over to MongoDB Atlas and register for a free account:
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.
On the following Security Quickstart page, do the following:
Authentication method: Username and Password
Username:
modmail
Password: Click Autogenerate Secure Password - don't type your own password!
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.
Click Create User.
Scroll down, we will be connecting from: My Local Environment
Set IP address as
0.0.0.0/0
and 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.
Click Add Entry.
You can now click Finish and Close on the bottom. Your page should look similar to this:
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.
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:
Finally, you will need to combine the database password with the MongoDB connection string by replacing the <password>
(including the <>
) with the database password.
You also need to remove everything after .mongodb.net
at 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.
Preparing your Environmental Variables
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 accountLOG_URL
- [Optional] Logviewer URL that will be used to view threads in your web browserGUILD_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:
Hosting Modmail
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.
Railway (paid)
A platform as a service (PaaS) that offers relatively low cost plans, which allows you to host Modmail for little without any downtime. A credit card is required for payment. Their UI is very simple and easy for beginners to quickly deploy and run your Modmail bot on. You can learn more about their plans and pricing by clicking here.
Northflank (free/paid)
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.
Local Hosting (free)
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.
Modmail Patreon (paid)
We offer paid hosting solution for your Modmail bot. Hosting Modmail with us costs $4-5 USD per month.
We will also fully manage your bot hosting for you, so you don't need to worry about upgrading or setting up your own host server. Refer to our Patreon Hosting here.
Heroku (paid)
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.
If you are currently a higher-education student, you may be eligible for the first year free with their student offer. Refer to our Heroku installation guide by clicking here.
Cloud Server / VPS (paid)
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.
Replit (free/paid)
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 that costs $7 USD per month. However, hosting on Replit is often unstable, and thus not recommended. However, a community guide is still available by clicking here.
Community Guides
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.
Last updated