Some Python scripts to interface between Discord and GroupMe.
These scripts require Python 3.6+.
Before starting, make sure that you install the requirements with:
cd ~/path/to/GroupMe/
python3 -m pip install -r requirements.txt
If you have issues with the discord.py installation, use the following command:
python3 -m pip install -U https://github.com/Rapptz/discord.py/archive/rewrite.zip#egg=discord.py
You also need to be able to expose the flask webserver.
If you already know how to do this, change the run_locally
variable in config.ini
to false
.
If not, The easiest method to do this is by using the ngrok tool. View the documentation here.
Once ngrok is setup and authorized, execute the following command to recieve your ngrok URL (you'll need this later):
ngrok http 5000
Keep this process running as you start the application.
In order to send messages from Discord to GroupMe, you will need to create a Bot Application.
To do this, first go to https://discordapp.com/developers/applications/me and login with your Discord account.
Click "New App", fill in your App name, then click "Create App".
You should be redirected to the application page of your bot.
Scroll down to the following prompt and select "Create a Bot User":
You will now be able to view the token of your bot application.
Copy this token and paste it into your config.ini
file:
The webserver will be sending GroupMe messages to a dedicated channel by using a Discord Webhook.
To create a webhook, navigate to a channel's edit page and select "Webhooks".
After creating a webhook, copy the webhook URL shown:
And paste it into your config file:
There's just one more thing to do on the Discord side: enable User Settings -> Appearance -> Developer Mode and right click the channel that the webhook is using. Paste this number into your config file too:
Now that you've set up the Discord constants, you'll also need to setup your GroupMe Bot.
Navigate to https://dev.groupme.com/bots, login with your GroupMe account, and click "Create Bot".
Fill in the appropriate fields, and in the Callback URL field, enter the URL that you got from ngrok.
Once you've created the Bot, click on the bot's field to see the Bot ID. Copy this string and paste it in your config file:
One more to go! On the same page, click the "Access Token" button to retrieve your access token.
Copy this string and paste it into your config file:
Now run the application:
python3 main.py
You should see any messages appear in the chosen Discord channel, and you will also be able to send messages and images to the GroupMe chat.