Automating an invite to a discord channel

I’m working on a membership site where a private Discord channel is part of the required feature set. I wanted to be able to generate a one time invite code for each user. This was surprisingly challenging.

The first step is registering a Discord server…this can be done from within the Discord app.

The second is creating a discord bot, assigning permissions, and adding the bot to the server. DiscordPY had a great step by step guid for this on their docs page:

Finally, I used discord.js to create a single method call for this interaction:

const Discord = require('discord.js');

Enjoy! You can use this method to generate a single use Discord link. Consider incorporating this into your sign up flow to generate a single unique user signup link at account creation.

Software developer, investor, energy markets analyst.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store