Planning Center plan communication automation for Slack
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
James Coleman b6777746e4 Fix topic set after channel creation 8 months ago
.gitignore Added support for creating slack channels with reference to a weekday, added support for specifying users to always add to a channel, maybe more? 8 months ago
LICENSE First commit 8 months ago
README.md Fix readme 8 months ago
api.go Added support for creating slack channels with reference to a weekday, added support for specifying users to always add to a channel, maybe more? 8 months ago
config.go Added support for creating slack channels with reference to a weekday, added support for specifying users to always add to a channel, maybe more? 8 months ago
database.go First commit 8 months ago
flags.go First commit 8 months ago
go.mod First commit 8 months ago
go.sum First commit 8 months ago
http.go First commit 8 months ago
main.go Added support for creating slack channels with reference to a weekday, added support for specifying users to always add to a channel, maybe more? 8 months ago
planningcenter.go First commit 8 months ago
update.go Fix topic set after channel creation 8 months ago

README.md

service-notifications

A tool that creates slack channels for services in planning center and adds people who are assigned to the plan. This is to make it easy to communicate with people assigned to a plan, either automatically via the API included with tool, or manually in Slack. I wrote this tool to send notifications when a slide in ProPresenter is clicked, using the https://github.com/GRMrGecko/midi-request-trigger MIDI bridge.

Install

You can install by building.

Building

Building should be as simple as running:

go build

Running as a service

You are likely going to want to run the tool as a service to ensure it runs at boot and restarts in case of failures. Below is an example service config file you can place in /etc/systemd/system/service-notifications.service on a linux system to run as a service if you install the binary in /usr/local/bin/.

[Unit]
Description=Service Notifications
After=network.target
StartLimitIntervalSec=500
StartLimitBurst=5

[Service]
ExecStart=/usr/local/bin/service-notifications
ExecReload=/bin/kill -s HUP $MAINPID
Restart=on-failure
RestartSec=5s

[Install]
WantedBy=multi-user.target

Once the service file is installed, you can run the following to start it:

systemctl daemon-reload
systemctl start service-notifications.service

On MacOS, you can setup a Launch Agent in ~/Library/LaunchAgents/com.mrgeckosmedia.service-notifications.plist as follows:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>Label</key>
	<string>com.mrgeckosmedia.service-notifications</string>
	<key>ProgramArguments</key>
	<array>
		<string>/path/to/bin/service-notifications</string>
        <string>-c</string>
        <string>/path/to/config.yaml</string>
	</array>
	<key>KeepAlive</key>
	<dict>
		<key>Crashed</key>
		<true/>
		<key>SuccessfulExit</key>
		<false/>
	</dict>
	<key>RunAtLoad</key>
	<true/>
    <key>OnDemand</key>
    <false/>
</dict>
</plist>

Start with:

launchctl load ~/Library/LaunchAgents/com.mrgeckosmedia.service-notifications.plist

Check status with:

launchctl list com.mrgeckosmedia.service-notifications

Stop with:

launchctl unload ~/Library/LaunchAgents/com.mrgeckosmedia.service-notifications.plist

Cron job

The idea is to setup cron jobs to update data/create the slack channels on a particular day. The following is an example of what I would use.

0 6 * * 3 /path/to/bin/service-notifications --update

Config

The default configuration paths are:

  • ./config.yaml - A file in the current working directory.
  • ~/.config/service-notifications/config.yaml - A file in your home directory's config path.
  • /etc/service-notifications/config.yaml - A file in the etc config folder.

Basic config

Get Slack API token by creating an app at https://api.slack.com/apps then go to "Install App" to get the token.

Get Planning Center API secrets at https://api.planningcenteronline.com/oauth/applications by creating a personal access token.

You can get a slack user ID by viewing the profile and under the 3 dot menu choose Copy member ID.

---
database:
    debug: true

planning_center:
    app_id: PC_APP_ID
    secret: PC_SECRET

slack:
    api_token: SLACK_API_TOKEN
    create_from_weekday: 3
    default_conversation: SLACK_UID
    sticky_users:
        - SLACK_UID