After getting your Discord Bot up and running, you may have noticed that you're missing a step — your bot hasn't joined the server yet!

This is done by creating an "Invite Link" for your bot, which if you so choose, can be used by people to invite your bot to your server, and this guide will walk you through that exact process.

Please note, that due to security restrictions placed by Discord, you will need the Manage Server permission in order to add a bot to a server. If you're the owner of the server, you should automatically have that permission granted to you — if not, you may need to speak to the Admin(s) of your Discord server.

To start, ensure that you've created an "Application" on the Discord Developer Portal as you will need this in order to create an invite link (as well as for the bot in general).

After you've registered an application, select it on the front page of the developer portal, and click OAuth2 on the left sidebar, found here:

Click the OAuth2 link

From there, you'll need to grab your bot's Client ID and note it down somewhere, as it will be part of the invite link that you create.

Copy your bot's Client ID

If you'd like to restrict invite links for your bot to only work for yourself, head over to the Bot tab on the left sidebar, and uncheck the Public Bot setting.

Optional Step: If you want to request any users adding your bot to their server to grant the permissions your bot requires (such as the Manage Messages permission if your bot will be deleting messages) you can encode the permissions into your invite link, the easiest way to do this is using the Discord Permissions Calculator — check all of the permissions that your bot requires (note that this will be displayed to anyone who attempts to utilize the invite link) and insert your Client ID into the box at the bottom of the page, whilst leaving the other two boxes empty, like this:

Insert your bot's Client ID here

That will generate your invite link and encode the necessary permissions into the authorization prompt for when users go to invite your bot to their server.

Note that you should ensure your bot's code checks that it has the permission to perform an elevated task (such as deleting messages) as encoding the permissions into your invite link does not guarantee that the user inviting your bot will grant the permissions you request.

Otherwise, if you do not want to request any permissions, you can use the following template to create an invite link:
Replace 123456789 with your bot's actual Client ID, which will create an invite link.

Now that you have your bot's invite link, go ahead and give it a try! If you opted to encode your permissions into the URL, you'll see these included on the prompt. After you authorize the bot, it will then join the selected server! If you do not see the server you are wanting to invite your bot into, then you're most likely missing the Manage Server permission, which is covered at the beginning of this article.

Select which server you'd like to invite your bot to

If you opted to encode permissions into your invite link, this is where your users will be able to opt into or opt out of those permissions
Was this article helpful?
Thank you!