|
| 1 | +# aprsd_slack_plugin |
| 2 | + |
| 3 | +[](https://github.com/hemna/aprsd-slack-plugin/actions) |
| 4 | +[](https://black.readthedocs.io/en/stable/) |
| 5 | +[](https://timothycrosley.github.io/isort/) |
| 6 | + |
| 7 | +This project is a Python plugin for the [APRSD server daemon](https://github.com/craigerl/aprsd) written by Craig Lamparter. The plugin provides integration with Slack, allowing APRS messages and location data to be forwarded to Slack channels. |
| 8 | + |
| 9 | +## Features |
| 10 | + |
| 11 | +The plugin includes three main components: |
| 12 | + |
| 13 | +1. **Location Plugin** - Reports APRS location data to Slack channels with weather information |
| 14 | +2. **Message Plugin** - Forwards APRS messages to Slack channels |
| 15 | +3. **Notify Plugin** - Sends notifications when watched callsigns appear on APRS |
| 16 | + |
| 17 | +## Requirements |
| 18 | + |
| 19 | +- Python 3.11+ |
| 20 | +- [APRSD](https://github.com/craigerl/aprsd) - APRS daemon server |
| 21 | +- Slack Bot Token and Signing Secret (see setup instructions below) |
| 22 | + |
| 23 | +## Installation |
| 24 | + |
| 25 | +Install the plugin using pip: |
| 26 | + |
| 27 | +```bash |
| 28 | +pip install aprsd-slack-plugin |
| 29 | +``` |
| 30 | + |
| 31 | +Or install from source: |
| 32 | + |
| 33 | +```bash |
| 34 | +git clone https://github.com/hemna/aprsd-slack-plugin.git |
| 35 | +cd aprsd-slack-plugin |
| 36 | +pip install -e . |
| 37 | +``` |
| 38 | + |
| 39 | +## Slack Bot Setup |
| 40 | + |
| 41 | +Before configuring the plugin, you need to create a Slack bot application: |
| 42 | + |
| 43 | +1. Go to [api.slack.com](https://api.slack.com/apps) and create a new app |
| 44 | +2. A good guide for creating the app, tokens, and permissions can be found at: |
| 45 | + [https://api.slack.com/start/building/bolt-python](https://api.slack.com/start/building/bolt-python) |
| 46 | + |
| 47 | +3. You will need: |
| 48 | + - **Signing Secret**: Found in "Basic Information" → "App Credentials" |
| 49 | + - **Bot User OAuth Token**: Found in "OAuth & Permissions" → "OAuth Tokens for Your Team" → "Bot User OAuth Access Token" |
| 50 | + |
| 51 | +4. Required Bot Token Scopes: |
| 52 | + - `chat:write` - To post messages to channels |
| 53 | + - `channels:read` (optional) - To read channel information |
| 54 | + |
| 55 | +5. Install the app/bot into your workspace |
| 56 | + |
| 57 | +## Configuration |
| 58 | + |
| 59 | +Add the following section to your APRSD configuration file (typically `~/.config/aprsd/aprsd.conf` or `~/.config/aprsd/aprsd.yml`): |
| 60 | + |
| 61 | +### YAML Configuration Format |
| 62 | + |
| 63 | +```yaml |
| 64 | +aprsd_slack_plugin: |
| 65 | + signing_secret: "your_slack_signing_secret_here" |
| 66 | + bot_token: "xoxb-your-bot-token-here" |
| 67 | + channels: |
| 68 | + - "#general" |
| 69 | + - "#aprs" |
| 70 | + - "#hamradio" |
| 71 | +``` |
| 72 | +
|
| 73 | +### INI Configuration Format |
| 74 | +
|
| 75 | +```ini |
| 76 | +[aprsd_slack_plugin] |
| 77 | +signing_secret = your_slack_signing_secret_here |
| 78 | +bot_token = xoxb-your-bot-token-here |
| 79 | +channels = #general,#aprs,#hamradio |
| 80 | +``` |
| 81 | + |
| 82 | +### Configuration Options |
| 83 | + |
| 84 | +- **`signing_secret`** (required): Your Slack app's signing secret from the App Credentials page |
| 85 | +- **`bot_token`** (required): Your Slack bot's OAuth token (starts with `xoxb-`) |
| 86 | +- **`channels`** (required): List of Slack channel names (with or without `#` prefix) where messages will be posted |
| 87 | + |
| 88 | +## Usage |
| 89 | + |
| 90 | +Once configured, the plugin will automatically integrate with APRSD. The plugins respond to specific APRS message commands: |
| 91 | + |
| 92 | +### Location Plugin |
| 93 | + |
| 94 | +The Location Plugin responds to messages starting with `L` or `l` and reports the location of a callsign to Slack. |
| 95 | + |
| 96 | +**Command Format:** |
| 97 | +``` |
| 98 | +L [callsign] |
| 99 | +``` |
| 100 | + |
| 101 | +**Examples:** |
| 102 | + |
| 103 | +1. Get your own location: |
| 104 | + ``` |
| 105 | + L |
| 106 | + ``` |
| 107 | + |
| 108 | +2. Get location for a specific callsign: |
| 109 | + ``` |
| 110 | + L N0CALL |
| 111 | + ``` |
| 112 | + |
| 113 | +**Slack Output:** |
| 114 | +The plugin will post a formatted message to your configured Slack channels with: |
| 115 | +- Callsign with link to aprs.fi |
| 116 | +- Location description (from weather.gov if in US) |
| 117 | +- Map link to aprs.fi |
| 118 | +- Altitude in feet |
| 119 | +- Time since last update |
| 120 | + |
| 121 | +**Example Slack Message:** |
| 122 | +``` |
| 123 | +APRSD - Slack Location Plugin |
| 124 | +📍 N0CALL - Location |
| 125 | +
|
| 126 | +Location: Downtown Denver, CO |
| 127 | +Map Location: http://aprs.fi/... |
| 128 | +Altitude: 5280 ft |
| 129 | +Time: 2.3 h ago |
| 130 | +``` |
| 131 | + |
| 132 | +### Message Plugin |
| 133 | + |
| 134 | +The Message Plugin forwards APRS messages to Slack channels. |
| 135 | + |
| 136 | +**Command Format:** |
| 137 | +``` |
| 138 | +s <message> |
| 139 | +slack <message> |
| 140 | +``` |
| 141 | + |
| 142 | +**Examples:** |
| 143 | + |
| 144 | +1. Send a simple message: |
| 145 | + ``` |
| 146 | + s Hello from APRS! |
| 147 | + ``` |
| 148 | + |
| 149 | +2. Send a longer message: |
| 150 | + ``` |
| 151 | + slack Testing the Slack integration |
| 152 | + ``` |
| 153 | + |
| 154 | +**Slack Output:** |
| 155 | +The plugin will post a message showing the callsign and message content: |
| 156 | + |
| 157 | +``` |
| 158 | +APRSD - Slack Message Plugin |
| 159 | +📡 N0CALL says s Hello from APRS! |
| 160 | +``` |
| 161 | + |
| 162 | +### Notify Plugin |
| 163 | + |
| 164 | +The Notify Plugin automatically sends notifications when callsigns on your watchlist appear on APRS. |
| 165 | + |
| 166 | +**Setup:** |
| 167 | +Add callsigns to your APRSD watchlist configuration. When those callsigns appear on APRS, the plugin will automatically notify your Slack channels. |
| 168 | + |
| 169 | +**Slack Output:** |
| 170 | +``` |
| 171 | +APRSD - Slack Notification Plugin |
| 172 | +📡 N0CALL - Is now on APRS |
| 173 | +``` |
| 174 | + |
| 175 | +## Example Interactions |
| 176 | + |
| 177 | +### Example 1: Checking Your Location |
| 178 | + |
| 179 | +**APRS Message:** |
| 180 | +``` |
| 181 | +L |
| 182 | +``` |
| 183 | + |
| 184 | +**Slack Output:** |
| 185 | +``` |
| 186 | +APRSD - Slack Location Plugin |
| 187 | +📍 N0CALL - Location |
| 188 | +
|
| 189 | +Location: Mountain View, CA |
| 190 | +Map Location: http://aprs.fi/#!mt=roadmap&z=15&lat=37.4056&lng=-122.0775 |
| 191 | +Altitude: 150 ft |
| 192 | +Time: 0.5 h ago |
| 193 | +``` |
| 194 | + |
| 195 | +### Example 2: Checking Another Station's Location |
| 196 | + |
| 197 | +**APRS Message:** |
| 198 | +``` |
| 199 | +L W1AW |
| 200 | +``` |
| 201 | + |
| 202 | +**Slack Output:** |
| 203 | +``` |
| 204 | +APRSD - Slack Location Plugin |
| 205 | +📍 W1AW - Location |
| 206 | +
|
| 207 | +Location: Newington, CT |
| 208 | +Map Location: http://aprs.fi/#!mt=roadmap&z=15&lat=41.6875&lng=-72.7278 |
| 209 | +Altitude: 200 ft |
| 210 | +Time: 1.2 h ago |
| 211 | +``` |
| 212 | + |
| 213 | +### Example 3: Sending a Message to Slack |
| 214 | + |
| 215 | +**APRS Message:** |
| 216 | +``` |
| 217 | +s Just finished a QSO on 2m! |
| 218 | +``` |
| 219 | + |
| 220 | +**Slack Output:** |
| 221 | +``` |
| 222 | +APRSD - Slack Message Plugin |
| 223 | +📡 N0CALL says s Just finished a QSO on 2m! |
| 224 | +``` |
| 225 | + |
| 226 | +### Example 4: Watchlist Notification |
| 227 | + |
| 228 | +When a callsign on your watchlist appears on APRS, you'll automatically receive: |
| 229 | + |
| 230 | +**Slack Output:** |
| 231 | +``` |
| 232 | +APRSD - Slack Notification Plugin |
| 233 | +📡 W1AW - Is now on APRS |
| 234 | +``` |
| 235 | + |
| 236 | +## Troubleshooting |
| 237 | + |
| 238 | +### Plugin Not Responding |
| 239 | + |
| 240 | +1. Check that the plugin is enabled in your APRSD configuration |
| 241 | +2. Verify your Slack credentials are correct: |
| 242 | + - `signing_secret` matches your app's signing secret |
| 243 | + - `bot_token` is valid and starts with `xoxb-` |
| 244 | +3. Ensure the bot is installed in your Slack workspace |
| 245 | +4. Check APRSD logs for error messages |
| 246 | + |
| 247 | +### Messages Not Appearing in Slack |
| 248 | + |
| 249 | +1. Verify the channel names are correct (case-sensitive) |
| 250 | +2. Ensure the bot has been invited to the channels (if they're private) |
| 251 | +3. Check that the bot has `chat:write` scope |
| 252 | +4. Verify the bot token hasn't expired |
| 253 | + |
| 254 | +### Location Plugin Not Working |
| 255 | + |
| 256 | +1. Ensure you have an `aprs_fi.apiKey` configured in APRSD |
| 257 | +2. Check that the callsign exists on aprs.fi |
| 258 | +3. Verify network connectivity to aprs.fi and weather.gov |
| 259 | + |
| 260 | +## Development |
| 261 | + |
| 262 | +### Running Tests |
| 263 | + |
| 264 | +```bash |
| 265 | +tox |
| 266 | +``` |
| 267 | + |
| 268 | +Or run specific test environments: |
| 269 | + |
| 270 | +```bash |
| 271 | +tox -e py311 # Run Python 3.11 tests |
| 272 | +tox -e lint # Run linting with ruff |
| 273 | +tox -e type-check # Run type checking with mypy |
| 274 | +``` |
| 275 | + |
| 276 | +### Code Style |
| 277 | + |
| 278 | +This project uses: |
| 279 | +- [black](https://black.readthedocs.io/) for code formatting |
| 280 | +- [ruff](https://docs.astral.sh/ruff/) for linting |
| 281 | +- [isort](https://pycqa.github.io/isort/) for import sorting |
| 282 | + |
| 283 | +## License |
| 284 | + |
| 285 | +Licensed under the Apache License, Version 2.0. See LICENSE.txt for details. |
| 286 | + |
| 287 | +## Contributing |
| 288 | + |
| 289 | +Contributions are welcome! Please feel free to submit a Pull Request. |
| 290 | + |
| 291 | +## Support |
| 292 | + |
| 293 | +For issues and questions: |
| 294 | +- GitHub Issues: [https://github.com/hemna/aprsd-slack-plugin/issues](https://github.com/hemna/aprsd-slack-plugin/issues) |
| 295 | + |
| 296 | +## Related Projects |
| 297 | + |
| 298 | +- [APRSD](https://github.com/craigerl/aprsd) - The APRS daemon this plugin extends |
0 commit comments