/groupme-notify-action

github action to send groupme messages

Primary LanguageShellMIT LicenseMIT

groupme-notify-action

Examples

This action supports two styles of messaging.

  1. You can create a bot associated with that group and just invoke the bot apis with your token and botId.

  2. Directly with the GroupMe groupId and your access token, you can message a group with your identity.

We recommend you go with option (1) since you’ll typically receive notifications on your GroupMe client from a bot but not from yourself.

Message with a bot

Message with bot

name: groupme-notify
on: [push]

jobs:
  groupme:
    runs-on: ubuntu-latest
    name: notify
    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - name: do notification as bot
        uses: nhomble/groupme-notify-action@v1
        id: bot
        with:
          bot: ${{ secrets.YOUR_BOT_ID }}
          message: "It's a bot!"
          token: ${{ secrets.YOUR_API_KEY }}

Message as yourself

Message yourself

name: groupme-notify
on: [push]

jobs:
  groupme:
    runs-on: ubuntu-latest
    name: notify
    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - name: do notification
        uses: nhomble/groupme-notify-action@v1
        id: notification
        with:
          group: ${{ secrets.YOUR_GROUP_ID }}
          message: 'Test notification!'
          token: ${{ secrets.YOUR_API_KEY }}

Note: you can define both the group and bot parameter in your yml. This action will give precedence to the bot mode so that group parameter will be ignored.

GroupMe Specifics

You will want to visit GroupMe API for exhaustive documentation.

How do I create a bot?

Through the GroupMe Dev portal, you can click the Create Bot button. From the UI, the Bot ID parameter is what you need to pass to this action.

What is the groupId?

You’ll need to perform a GET against the GroupMe APIs to find the groupId for the group you want. After you login, you can retrieve your access token from the UI.

Given your access token, you can get a list of all the groups you are a part of by doing:

$ TOKEN=<from above>
$ curl \
    -H "Content-Type: application/json" \
    https://api.groupme.com/v3/groups?token=$TOKEN

What you care about is:

{
  "response": [
    {"id":  "<this id>", "name": "GitHub", "...":  "..."},
    {"id":  "123456", "name": "Family", "...":  "..."},
    {"id":  "789023", "name": "Friends", "...":  "..."}
  ]
}

Based off of the name, figure out the groupId you want to use and then put that into your action.yml.