GithubHelp home page GithubHelp logo

alejzeis / groupme-discord-bridge Goto Github PK

View Code? Open in Web Editor NEW
8.0 1.0 10.0 85 KB

A bridge bot which connects a GroupMe chat and a Discord Guild

License: BSD 2-Clause "Simplified" License

JavaScript 100.00%
discord groupme nodejs proxy

groupme-discord-bridge's Introduction

groupme-discord-bridge

A bridge bot which connects a GroupMe chat and a Discord Channel. It's designed to be ran on a server so it is completely command-line only. You can run it on your home computer but it is not recommended, as you need to open your firewall up so GroupMe can send messages to the bridge.

SECURITY NOTICE: Theoretically someone COULD intercept messages from GroupMe to the bridge if you do not run behind a reverse proxy, which isn't covered here. That is because the bridge uses a plain HTTP server to recieve data from GroupMe. If you want messages to be secure, it is recommended to run the bridge behind a reverse proxy such as nginx, as your forward web server would have HTTPS enabled, and all requests would go to it, which it would then send over the local network to the bridge.

Requirements

  • NodeJS installed.
  • Your firewall opened for a port so GroupMe can send the bridge messages OR a forward facing web server like Nginx or Apache that you can configure a reverse proxy for.

Limitations

The program can only bridge a single GroupMe Group and a single Discord Channel together. Because of how GroupMe Bots work (only a single bot can be in a single group), this is unlikely to change soon.

Setting up

First you can clone this repository (or download it) and then run npm install to fetch dependencies.

Now you can run node app.js. It should error out saying you don't have a config file, and it will create a skeleton one for you, which should look something like this:

listenPort: 8088
callbackURL: "/callback"
discord:
    username: my-bot
    token: ""
    guild: '0'
    channel: '0'
groupme:
    name: ""
    botId: ""
    accessToken: ""

You can change "listenPort" to the port you want the bridge to listen on. That's the port GroupMe will be sending messages to, and the one that needs to be open in your Firewall OR configured your reverse proxy to, which is out of scope of this guide. There are many guides online on how to configure a reverse proxy.

Next you will need to create a Discord bot account on the Discord developers page. You can use this handy guide. The Discord web interface has changed a bit, (you'll need to select "Bot" on the far left to create the bot account and see the access token). Once you've added the Discord bot to your Guild you'll need to copy the "Token" and put them in the bridgeBot.yml config file. It goes to the "token" field under the "discord" in the YAML file. Also fill in the "username" field with the Discord bot's username that you gave.

listenPort: 8088
callbackURL: "/callback"
discord:
    username: "YOUR DISCORD BOT's USERNAME HERE"
    token: "YOUR DISCORD TOKEN HERE"
    guild: '0'
    channel: '0'
groupme:
    name: ""
    botId: ""
    accessToken: ""

Now you will need the Guild and Channel IDs for the Discord side. In Discord you'll need to enable Developer mode (you can find this option under "Settings->Appearance->Advanced". Now you can right click on the Discord Guild (or server as it is called in the client) and click "copy-ID". You can paste that in the "guild" field in bridgeBot.yml. Do the same for the channel by right clicking on the channel and clicking "copy-ID". Paste that in the "channel" field.

listenPort: 8088
callbackURL: "/callback"
discord:
    username: "YOUR DISCORD BOT's USERNAME HERE"
    token: "YOUR DISCORD TOKEN HERE"
    guild: 'THE GUILD ID YOU COPIED'
    channel: 'THE CHANNEL ID YOU COPIED'
groupme:
    name: ""
    botId: ""
    accessToken: ""

Finally we need to set up the GroupMe bot. Head over to https://dev.groupme.com/ and sign in with your GroupMe account. Once you've logged in you'll need to head over to https://dev.groupme.com/bots and click on the "Create a Bot" button. Select which GroupMe group you want the bot to be in, and give it a Name and an Avatar URL (a URL to a picture) if you chose to do so. For the callback URL you need to put in the address that the bridge will recieve GroupMe messages from.

For example, if I am running the bridge on my server, myserver.com, and I set "listenPort" to be 8088 and "callbackURL" set to "/callback", then the callback URL will be "http://myserver.com:8088/callback".

The callback URL is very important, as if it is not correct then the bridge will not recieve messages from GroupMe and nothing will show up in Discord. This is probably the number 1 cause of the bridge not working.

Once you've created the GroupMe bot, copy it's "bot ID" and paste it in bridgeBot.yml in the "botId" field. You'll also need to copy your GroupMe access token, which can be found by clicking on "Access Token" in the top right of the GroupMe developers site.

Also enter the bot's name under the "name" field in the config file. The Bot's name should match the name you gave it on the GroupMe site, case sensitive and must match perfectly, as if it doesn't the bridge will echo and relay the GroupMe bot's messages on Discord!

listenPort: 8088
callbackURL: "/callback"
discord:
    username: "YOUR DISCORD BOT's USERNAME HERE"
    token: "YOUR DISCORD TOKEN HERE"
    guild: 'THE GUILD ID YOU COPIED'
    channel: 'THE CHANNEL ID YOU COPIED'
groupme:
    name: "YOUR GROUPME BOT's NAME"
    botId: "THE GROUPME BOT's ID"
    accessToken: "YOUR GROUPME ACCESS TOKEN"

Now you should be all set! Save the config file and give the bridge a run by running node app.js.

groupme-discord-bridge's People

Contributors

alejzeis avatar jython234 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

groupme-discord-bridge's Issues

Help Im Noob

I will literally pay you via Venmo to help me set this up, step by step via Zoom call or whatever is best for you. Also Im on a Mac (2013) if that matters. Let me know

Server

Forgive me for being an ignoramus, but what would count as the server that I would write when creating my bot on GroupMe?

Not working.

Hey, so i tried to make this work, but its just not happening. could you make it easy to deploy to heroku so I can just use it? also, perhaps you could make it easy to use the same discord bot to link 2 different groupme chats to channels on different discord servers? i need this soon to unify my classes with the discord server for them.

Issue with startup

Hello sorry for the issue, but i am questioning if i have set this up correctly. attached i have my config and the output when i run the app. I am using ngrok to connect to my instance of the app and both appear to be working but there is no communication between ngrok and this app.
Config:
discord-groupme
When ran:
on-run

General Setup Errors

upon launching the app, the following is output:
image
the line in question contains the following:
const Discord = require("discord.js");
commenting this line out causes the same error to appear in the next line, and the next, and so on until all the dependency checkers are commented out and the system begins outputting errors in the middle of elements at anywhere a colon (:) is
Attempting to run via a node.js administrator cmd prompt version 8.11.0
All dependencies are installed

Bot repeats the message from discord side

When sending a message from the Discord side, the bot picks up the message repeated to GroupMe and echoes it back to Discord. This doesn't seem to happen in reverse.

Cloudflare worker support

Hi. I'm new to all of this, but was wondering if you knew if this could be imported into a Cloudflare worker so that it runs from there instead of a personal server. TIA!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.