emberpost 0.1.0__tar.gz → 0.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- emberpost-0.3.0/LICENSE +21 -0
- emberpost-0.3.0/PKG-INFO +270 -0
- emberpost-0.3.0/README.md +243 -0
- emberpost-0.3.0/pyproject.toml +116 -0
- emberpost-0.3.0/pyproject.toml.orig +101 -0
- emberpost-0.3.0/src/emberpost/cli.py +71 -0
- emberpost-0.3.0/src/emberpost/msteams.py +49 -0
- {emberpost-0.1.0 → emberpost-0.3.0}/src/emberpost/pagerduty.py +6 -0
- emberpost-0.3.0/src/emberpost/post.py +353 -0
- emberpost-0.3.0/src/emberpost/schedule_config.py +203 -0
- emberpost-0.3.0/src/emberpost/schemas/schedule.schema.json +283 -0
- {emberpost-0.1.0 → emberpost-0.3.0}/src/emberpost/slack.py +12 -6
- emberpost-0.1.0/PKG-INFO +0 -185
- emberpost-0.1.0/README.md +0 -174
- emberpost-0.1.0/pyproject.toml +0 -92
- emberpost-0.1.0/src/emberpost/post.py +0 -233
- emberpost-0.1.0/src/emberpost/schedule_config.py +0 -110
- {emberpost-0.1.0 → emberpost-0.3.0}/src/emberpost/__init__.py +0 -0
emberpost-0.3.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 JSChronicles
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
emberpost-0.3.0/PKG-INFO
ADDED
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: emberpost
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Summary: Dispatch PagerDuty on-call schedules to notification providers.
|
|
5
|
+
Author: JSChronicles
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
License-File: LICENSE
|
|
8
|
+
Classifier: Development Status :: 4 - Beta
|
|
9
|
+
Classifier: Environment :: Console
|
|
10
|
+
Classifier: Intended Audience :: System Administrators
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
15
|
+
Classifier: Topic :: Communications :: Chat
|
|
16
|
+
Classifier: Topic :: System :: Monitoring
|
|
17
|
+
Requires-Dist: jsonschema>=4.26.0,<4.30.0
|
|
18
|
+
Requires-Dist: pagerduty>=7.0.1
|
|
19
|
+
Requires-Dist: pyyaml>=6.0.3
|
|
20
|
+
Requires-Dist: slack-sdk>=3.44.1
|
|
21
|
+
Requires-Python: >=3.14, <3.15
|
|
22
|
+
Project-URL: Homepage, https://github.com/JSChronicles/emberpost
|
|
23
|
+
Project-URL: Repository, https://github.com/JSChronicles/emberpost
|
|
24
|
+
Project-URL: Issues, https://github.com/JSChronicles/emberpost/issues
|
|
25
|
+
Project-URL: Documentation, https://opsfoundry.dev/emberpost/
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
|
|
28
|
+
# emberpost
|
|
29
|
+
|
|
30
|
+
<a name="readme-top"></a>
|
|
31
|
+
|
|
32
|
+
<!-- PROJECT SHIELDS -->
|
|
33
|
+
[![pytest][pytest-badge]][pytest-url]
|
|
34
|
+
[![ruff][ruff-badge]][ruff-url]
|
|
35
|
+
[![release][release-badge]][release-url]
|
|
36
|
+
[![PyPI][pypi-badge]][pypi-url]
|
|
37
|
+
[![prek][prek-badge]][prek-url]
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
<!-- PROJECT LOGO -->
|
|
41
|
+
<br />
|
|
42
|
+
<div align="center">
|
|
43
|
+
<img src="images/logo.png" alt="Logo" width="350" height="325">
|
|
44
|
+
</a>
|
|
45
|
+
|
|
46
|
+
<h3 align="center">README</h3>
|
|
47
|
+
|
|
48
|
+
<p align="center">
|
|
49
|
+
<a href="https://github.com/JSChronicles/emberpost"><strong>Explore the docs »</strong></a>
|
|
50
|
+
<br />
|
|
51
|
+
<a href="https://github.com/JSChronicles/emberpost/issues/new?labels=Bug%2CNeeds+Triage&projects=&template=bug.yaml&title=%5BBUG%5D+%3Ctitle%3E">Report Bug</a>
|
|
52
|
+
·
|
|
53
|
+
<a href="https://github.com/JSChronicles/emberpost/issues/new?labels=enhancement%2Cfeature+request&projects=&template=feature.yaml&title=%5BFEATURE%5D%3A+">Request Feature</a>
|
|
54
|
+
</p>
|
|
55
|
+
</div>
|
|
56
|
+
|
|
57
|
+
## Introduction
|
|
58
|
+
|
|
59
|
+
`emberpost` keeps Slack and Microsoft Teams aligned with the current PagerDuty on-call rotation. It reads a YAML schedule definition, resolves the active on-call users from PagerDuty, and publishes each schedule group to its effective provider destination.
|
|
60
|
+
|
|
61
|
+
Use it to post an on-call summary to Slack or Microsoft Teams, update a Slack channel topic, or keep a Slack user group in sync with the people currently carrying the pager. Schedule files can be marked as `daily`, `weekly`, or `manual`, which makes the same command safe to run from automation while only processing the rotations due for that run.
|
|
62
|
+
|
|
63
|
+
Start with [examples/01-minimal.yaml](examples/01-minimal.yaml) for the smallest working schedule shape, then add channel topics, user groups, headers, or footers as needed.
|
|
64
|
+
|
|
65
|
+
## Usage
|
|
66
|
+
|
|
67
|
+
Install the project and its dependencies with [uv](https://docs.astral.sh/uv/):
|
|
68
|
+
|
|
69
|
+
```console
|
|
70
|
+
uv sync
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Commands can then be run through `uv run`, which uses the project environment automatically. The `--frequency` flag is an automation guardrail: a `weekly` schedule is skipped during a `daily` run. For a Slack provider, set `destination.provider.options.set_channel_topic: true` to update a channel topic instead of posting a message.
|
|
74
|
+
|
|
75
|
+
Run a dry run before writing to a destination provider:
|
|
76
|
+
|
|
77
|
+
```console
|
|
78
|
+
uv run emberpost --schedule-file schedules/oncall.yaml --frequency weekly --dry-run
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Run the weekly schedule and update its configured destinations:
|
|
82
|
+
|
|
83
|
+
```console
|
|
84
|
+
uv run emberpost --schedule-file schedules/oncall.yaml --frequency weekly
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Process more than one schedule file in a single run:
|
|
88
|
+
|
|
89
|
+
```console
|
|
90
|
+
uv run emberpost --schedule-file schedules/oncall.yaml examples/03-full.yaml --frequency weekly
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Run a manual schedule file:
|
|
94
|
+
|
|
95
|
+
```console
|
|
96
|
+
uv run emberpost --schedule-file examples/01-minimal.yaml --frequency manual --dry-run
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Run with more logging while troubleshooting:
|
|
100
|
+
|
|
101
|
+
```console
|
|
102
|
+
uv run emberpost --schedule-file schedules/oncall.yaml --frequency weekly --dry-run --log-level DEBUG
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
The top-level `destination` is used by every schedule group that does not define a complete override. Provider-specific settings live under `provider.options`:
|
|
106
|
+
|
|
107
|
+
```yaml
|
|
108
|
+
pagerduty_tenant: example.pagerduty.com
|
|
109
|
+
|
|
110
|
+
destination:
|
|
111
|
+
provider:
|
|
112
|
+
name: slack
|
|
113
|
+
options:
|
|
114
|
+
space: example.slack.com
|
|
115
|
+
channel_id: C0123456789
|
|
116
|
+
set_channel_topic: false
|
|
117
|
+
|
|
118
|
+
schedule_groups:
|
|
119
|
+
Platform Coverage:
|
|
120
|
+
entries:
|
|
121
|
+
- schedule_id: PEXAMPLE1
|
|
122
|
+
label: "Primary Responder"
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Add `slack_group_id` to a group using an effective Slack destination to synchronize that group's resolved users to a Slack user group. A group may replace the default with another complete Slack or Microsoft Teams destination:
|
|
126
|
+
|
|
127
|
+
```yaml
|
|
128
|
+
pagerduty_tenant: example.pagerduty.com
|
|
129
|
+
|
|
130
|
+
destination:
|
|
131
|
+
provider:
|
|
132
|
+
name: slack
|
|
133
|
+
options:
|
|
134
|
+
space: example.slack.com
|
|
135
|
+
channel_id: C0123456789
|
|
136
|
+
set_channel_topic: false
|
|
137
|
+
|
|
138
|
+
schedule_groups:
|
|
139
|
+
Platform Coverage:
|
|
140
|
+
slack_group_id: S0123456789
|
|
141
|
+
entries:
|
|
142
|
+
- schedule_id: PEXAMPLE1
|
|
143
|
+
label: "Primary Responder"
|
|
144
|
+
Database Coverage:
|
|
145
|
+
destination:
|
|
146
|
+
provider:
|
|
147
|
+
name: slack
|
|
148
|
+
options:
|
|
149
|
+
space: database-team.slack.com
|
|
150
|
+
channel_id: C0987654321
|
|
151
|
+
set_channel_topic: true
|
|
152
|
+
entries:
|
|
153
|
+
- schedule_id: PEXAMPLE2
|
|
154
|
+
label: "Database Responder"
|
|
155
|
+
Incident Coverage:
|
|
156
|
+
destination:
|
|
157
|
+
provider:
|
|
158
|
+
name: msteams
|
|
159
|
+
options:
|
|
160
|
+
webhook_env: MSTEAMS_WEBHOOK_INCIDENT
|
|
161
|
+
entries:
|
|
162
|
+
- schedule_id: PEXAMPLE3
|
|
163
|
+
label: "Incident Commander"
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
Here, `Platform Coverage` uses the default Slack destination, `Database Coverage` replaces it with another Slack channel topic, and `Incident Coverage` posts through a Microsoft Teams Workflows webhook.
|
|
167
|
+
|
|
168
|
+
## Setting up your Slack Bot
|
|
169
|
+
|
|
170
|
+
### Bot Information
|
|
171
|
+
This section is just an example manifest, to show what is needed to get the bot working for the posting use.
|
|
172
|
+
|
|
173
|
+
```yaml
|
|
174
|
+
display_information:
|
|
175
|
+
name: Notification
|
|
176
|
+
description: Notification webhook/app
|
|
177
|
+
background_color: "#2c2d30"
|
|
178
|
+
features:
|
|
179
|
+
bot_user:
|
|
180
|
+
display_name: Notification
|
|
181
|
+
always_online: false
|
|
182
|
+
oauth_config:
|
|
183
|
+
scopes:
|
|
184
|
+
bot:
|
|
185
|
+
- channels:write.topic
|
|
186
|
+
- chat:write
|
|
187
|
+
- chat:write.customize
|
|
188
|
+
- chat:write.public
|
|
189
|
+
- files:read
|
|
190
|
+
- files:write
|
|
191
|
+
- users:read
|
|
192
|
+
- users:read.email
|
|
193
|
+
- groups:write.topic
|
|
194
|
+
- mpim:history
|
|
195
|
+
- im:write.topic
|
|
196
|
+
- mpim:write.topic
|
|
197
|
+
- usergroups:write
|
|
198
|
+
pkce_enabled: false
|
|
199
|
+
settings:
|
|
200
|
+
interactivity:
|
|
201
|
+
is_enabled: true
|
|
202
|
+
request_url: https://example.com/ignore
|
|
203
|
+
org_deploy_enabled: false
|
|
204
|
+
socket_mode_enabled: false
|
|
205
|
+
token_rotation_enabled: false
|
|
206
|
+
is_mcp_enabled: false
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
### Create a slack app
|
|
210
|
+
|
|
211
|
+
1. Set Up Your App
|
|
212
|
+
1. Go to the [Slack API portal](https://api.slack.com/apps).
|
|
213
|
+
1. Click [Create New App](https://api.slack.com/apps?new_app=1).
|
|
214
|
+
1. Choose From scratch and give your app a name and select the workspace where it will be installed.
|
|
215
|
+
1. Or if you are choosing to copy one of the above templates/manifests then you can choose From a manifest and speed up the process.
|
|
216
|
+
1. Configure App Features
|
|
217
|
+
1. Depending on what your app needs to do, you can enable features like:
|
|
218
|
+
1. Bot Token: For sending messages and interacting with users.
|
|
219
|
+
1. Event Subscriptions: To listen for events like messages or reactions.
|
|
220
|
+
1. Set Permissions (Scopes)
|
|
221
|
+
1. Go to OAuth & Permissions.
|
|
222
|
+
1. Add the necessary OAuth scopes (e.g., chat:write, commands, users:read).
|
|
223
|
+
1. These define what your app is allowed to do in the workspace.
|
|
224
|
+
1. Install the App
|
|
225
|
+
1. Still in the OAuth & Permissions section, click "Install to Workspace".
|
|
226
|
+
1. Authorize the app to access your workspace.
|
|
227
|
+
1. A Slack Admin for your organization will need to review the request
|
|
228
|
+
1. You’ll receive a Bot User OAuth Token once approved
|
|
229
|
+
1. save this securely.
|
|
230
|
+
|
|
231
|
+
### Configure Slack credentials
|
|
232
|
+
|
|
233
|
+
For each configured Slack workspace, uppercase the hostname and replace non-alphanumeric characters with underscores. Store its bot token in the resulting environment variable:
|
|
234
|
+
|
|
235
|
+
```text
|
|
236
|
+
example.slack.com -> SLACK_API_KEY_EXAMPLE_SLACK_COM
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
To find a channel ID, copy the Slack channel link. The final path segment beginning with `C` is the channel ID.
|
|
240
|
+
|
|
241
|
+
## Setting up Microsoft Teams
|
|
242
|
+
|
|
243
|
+
In Teams, open **Workflows**, search for an incoming-webhook template, and choose the template that posts to your intended channel or chat. Microsoft provides separate templates for channels, chats, and different authentication modes; these Teams webhook templates do not require a premium license. Select **Anyone** as the trigger authentication mode because Emberpost authenticates with the secret webhook URL and does not send an OAuth token. Choose the destination, save the workflow, add co-owners for operational continuity, and copy the generated webhook URL.
|
|
244
|
+
|
|
245
|
+
Store the URL in the environment variable named by `webhook_env`:
|
|
246
|
+
|
|
247
|
+
```yaml
|
|
248
|
+
destination:
|
|
249
|
+
provider:
|
|
250
|
+
name: msteams
|
|
251
|
+
options:
|
|
252
|
+
webhook_env: MSTEAMS_WEBHOOK_INCIDENT
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
Do not store a Teams webhook URL directly in schedule YAML. Each Teams Workflows webhook is bound to the chat or channel selected in its workflow, so no separate Team or channel ID is required. See Microsoft's [incoming webhook setup guide](https://support.microsoft.com/en-us/workflows/send-messages-in-teams-using-incoming-webhooks) for the current template flow.
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
<!-- MARKDOWN LINKS & IMAGES -->
|
|
260
|
+
[pytest-badge]:https://github.com/JSChronicles/emberpost/actions/workflows/pytest.yaml/badge.svg?branch=main
|
|
261
|
+
[pytest-url]:https://github.com/JSChronicles/emberpost/actions/workflows/pytest.yaml
|
|
262
|
+
[ruff-badge]:https://github.com/JSChronicles/emberpost/actions/workflows/ruff.yaml/badge.svg?branch=main
|
|
263
|
+
[ruff-url]:https://github.com/JSChronicles/emberpost/actions/workflows/ruff.yaml
|
|
264
|
+
[release-badge]:https://github.com/JSChronicles/emberpost/actions/workflows/release.yaml/badge.svg?branch=main
|
|
265
|
+
[release-url]:https://github.com/JSChronicles/emberpost/actions/workflows/release.yaml
|
|
266
|
+
[pypi-badge]:https://img.shields.io/pypi/v/emberpost
|
|
267
|
+
[pypi-url]:https://pypi.org/project/emberpost/
|
|
268
|
+
|
|
269
|
+
[prek-badge]:https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/j178/prek/master/docs/assets/badge-v0.json
|
|
270
|
+
[prek-url]:https://github.com/j178/prek
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
# emberpost
|
|
2
|
+
|
|
3
|
+
<a name="readme-top"></a>
|
|
4
|
+
|
|
5
|
+
<!-- PROJECT SHIELDS -->
|
|
6
|
+
[![pytest][pytest-badge]][pytest-url]
|
|
7
|
+
[![ruff][ruff-badge]][ruff-url]
|
|
8
|
+
[![release][release-badge]][release-url]
|
|
9
|
+
[![PyPI][pypi-badge]][pypi-url]
|
|
10
|
+
[![prek][prek-badge]][prek-url]
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
<!-- PROJECT LOGO -->
|
|
14
|
+
<br />
|
|
15
|
+
<div align="center">
|
|
16
|
+
<img src="images/logo.png" alt="Logo" width="350" height="325">
|
|
17
|
+
</a>
|
|
18
|
+
|
|
19
|
+
<h3 align="center">README</h3>
|
|
20
|
+
|
|
21
|
+
<p align="center">
|
|
22
|
+
<a href="https://github.com/JSChronicles/emberpost"><strong>Explore the docs »</strong></a>
|
|
23
|
+
<br />
|
|
24
|
+
<a href="https://github.com/JSChronicles/emberpost/issues/new?labels=Bug%2CNeeds+Triage&projects=&template=bug.yaml&title=%5BBUG%5D+%3Ctitle%3E">Report Bug</a>
|
|
25
|
+
·
|
|
26
|
+
<a href="https://github.com/JSChronicles/emberpost/issues/new?labels=enhancement%2Cfeature+request&projects=&template=feature.yaml&title=%5BFEATURE%5D%3A+">Request Feature</a>
|
|
27
|
+
</p>
|
|
28
|
+
</div>
|
|
29
|
+
|
|
30
|
+
## Introduction
|
|
31
|
+
|
|
32
|
+
`emberpost` keeps Slack and Microsoft Teams aligned with the current PagerDuty on-call rotation. It reads a YAML schedule definition, resolves the active on-call users from PagerDuty, and publishes each schedule group to its effective provider destination.
|
|
33
|
+
|
|
34
|
+
Use it to post an on-call summary to Slack or Microsoft Teams, update a Slack channel topic, or keep a Slack user group in sync with the people currently carrying the pager. Schedule files can be marked as `daily`, `weekly`, or `manual`, which makes the same command safe to run from automation while only processing the rotations due for that run.
|
|
35
|
+
|
|
36
|
+
Start with [examples/01-minimal.yaml](examples/01-minimal.yaml) for the smallest working schedule shape, then add channel topics, user groups, headers, or footers as needed.
|
|
37
|
+
|
|
38
|
+
## Usage
|
|
39
|
+
|
|
40
|
+
Install the project and its dependencies with [uv](https://docs.astral.sh/uv/):
|
|
41
|
+
|
|
42
|
+
```console
|
|
43
|
+
uv sync
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Commands can then be run through `uv run`, which uses the project environment automatically. The `--frequency` flag is an automation guardrail: a `weekly` schedule is skipped during a `daily` run. For a Slack provider, set `destination.provider.options.set_channel_topic: true` to update a channel topic instead of posting a message.
|
|
47
|
+
|
|
48
|
+
Run a dry run before writing to a destination provider:
|
|
49
|
+
|
|
50
|
+
```console
|
|
51
|
+
uv run emberpost --schedule-file schedules/oncall.yaml --frequency weekly --dry-run
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Run the weekly schedule and update its configured destinations:
|
|
55
|
+
|
|
56
|
+
```console
|
|
57
|
+
uv run emberpost --schedule-file schedules/oncall.yaml --frequency weekly
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Process more than one schedule file in a single run:
|
|
61
|
+
|
|
62
|
+
```console
|
|
63
|
+
uv run emberpost --schedule-file schedules/oncall.yaml examples/03-full.yaml --frequency weekly
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Run a manual schedule file:
|
|
67
|
+
|
|
68
|
+
```console
|
|
69
|
+
uv run emberpost --schedule-file examples/01-minimal.yaml --frequency manual --dry-run
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Run with more logging while troubleshooting:
|
|
73
|
+
|
|
74
|
+
```console
|
|
75
|
+
uv run emberpost --schedule-file schedules/oncall.yaml --frequency weekly --dry-run --log-level DEBUG
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
The top-level `destination` is used by every schedule group that does not define a complete override. Provider-specific settings live under `provider.options`:
|
|
79
|
+
|
|
80
|
+
```yaml
|
|
81
|
+
pagerduty_tenant: example.pagerduty.com
|
|
82
|
+
|
|
83
|
+
destination:
|
|
84
|
+
provider:
|
|
85
|
+
name: slack
|
|
86
|
+
options:
|
|
87
|
+
space: example.slack.com
|
|
88
|
+
channel_id: C0123456789
|
|
89
|
+
set_channel_topic: false
|
|
90
|
+
|
|
91
|
+
schedule_groups:
|
|
92
|
+
Platform Coverage:
|
|
93
|
+
entries:
|
|
94
|
+
- schedule_id: PEXAMPLE1
|
|
95
|
+
label: "Primary Responder"
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Add `slack_group_id` to a group using an effective Slack destination to synchronize that group's resolved users to a Slack user group. A group may replace the default with another complete Slack or Microsoft Teams destination:
|
|
99
|
+
|
|
100
|
+
```yaml
|
|
101
|
+
pagerduty_tenant: example.pagerduty.com
|
|
102
|
+
|
|
103
|
+
destination:
|
|
104
|
+
provider:
|
|
105
|
+
name: slack
|
|
106
|
+
options:
|
|
107
|
+
space: example.slack.com
|
|
108
|
+
channel_id: C0123456789
|
|
109
|
+
set_channel_topic: false
|
|
110
|
+
|
|
111
|
+
schedule_groups:
|
|
112
|
+
Platform Coverage:
|
|
113
|
+
slack_group_id: S0123456789
|
|
114
|
+
entries:
|
|
115
|
+
- schedule_id: PEXAMPLE1
|
|
116
|
+
label: "Primary Responder"
|
|
117
|
+
Database Coverage:
|
|
118
|
+
destination:
|
|
119
|
+
provider:
|
|
120
|
+
name: slack
|
|
121
|
+
options:
|
|
122
|
+
space: database-team.slack.com
|
|
123
|
+
channel_id: C0987654321
|
|
124
|
+
set_channel_topic: true
|
|
125
|
+
entries:
|
|
126
|
+
- schedule_id: PEXAMPLE2
|
|
127
|
+
label: "Database Responder"
|
|
128
|
+
Incident Coverage:
|
|
129
|
+
destination:
|
|
130
|
+
provider:
|
|
131
|
+
name: msteams
|
|
132
|
+
options:
|
|
133
|
+
webhook_env: MSTEAMS_WEBHOOK_INCIDENT
|
|
134
|
+
entries:
|
|
135
|
+
- schedule_id: PEXAMPLE3
|
|
136
|
+
label: "Incident Commander"
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
Here, `Platform Coverage` uses the default Slack destination, `Database Coverage` replaces it with another Slack channel topic, and `Incident Coverage` posts through a Microsoft Teams Workflows webhook.
|
|
140
|
+
|
|
141
|
+
## Setting up your Slack Bot
|
|
142
|
+
|
|
143
|
+
### Bot Information
|
|
144
|
+
This section is just an example manifest, to show what is needed to get the bot working for the posting use.
|
|
145
|
+
|
|
146
|
+
```yaml
|
|
147
|
+
display_information:
|
|
148
|
+
name: Notification
|
|
149
|
+
description: Notification webhook/app
|
|
150
|
+
background_color: "#2c2d30"
|
|
151
|
+
features:
|
|
152
|
+
bot_user:
|
|
153
|
+
display_name: Notification
|
|
154
|
+
always_online: false
|
|
155
|
+
oauth_config:
|
|
156
|
+
scopes:
|
|
157
|
+
bot:
|
|
158
|
+
- channels:write.topic
|
|
159
|
+
- chat:write
|
|
160
|
+
- chat:write.customize
|
|
161
|
+
- chat:write.public
|
|
162
|
+
- files:read
|
|
163
|
+
- files:write
|
|
164
|
+
- users:read
|
|
165
|
+
- users:read.email
|
|
166
|
+
- groups:write.topic
|
|
167
|
+
- mpim:history
|
|
168
|
+
- im:write.topic
|
|
169
|
+
- mpim:write.topic
|
|
170
|
+
- usergroups:write
|
|
171
|
+
pkce_enabled: false
|
|
172
|
+
settings:
|
|
173
|
+
interactivity:
|
|
174
|
+
is_enabled: true
|
|
175
|
+
request_url: https://example.com/ignore
|
|
176
|
+
org_deploy_enabled: false
|
|
177
|
+
socket_mode_enabled: false
|
|
178
|
+
token_rotation_enabled: false
|
|
179
|
+
is_mcp_enabled: false
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### Create a slack app
|
|
183
|
+
|
|
184
|
+
1. Set Up Your App
|
|
185
|
+
1. Go to the [Slack API portal](https://api.slack.com/apps).
|
|
186
|
+
1. Click [Create New App](https://api.slack.com/apps?new_app=1).
|
|
187
|
+
1. Choose From scratch and give your app a name and select the workspace where it will be installed.
|
|
188
|
+
1. Or if you are choosing to copy one of the above templates/manifests then you can choose From a manifest and speed up the process.
|
|
189
|
+
1. Configure App Features
|
|
190
|
+
1. Depending on what your app needs to do, you can enable features like:
|
|
191
|
+
1. Bot Token: For sending messages and interacting with users.
|
|
192
|
+
1. Event Subscriptions: To listen for events like messages or reactions.
|
|
193
|
+
1. Set Permissions (Scopes)
|
|
194
|
+
1. Go to OAuth & Permissions.
|
|
195
|
+
1. Add the necessary OAuth scopes (e.g., chat:write, commands, users:read).
|
|
196
|
+
1. These define what your app is allowed to do in the workspace.
|
|
197
|
+
1. Install the App
|
|
198
|
+
1. Still in the OAuth & Permissions section, click "Install to Workspace".
|
|
199
|
+
1. Authorize the app to access your workspace.
|
|
200
|
+
1. A Slack Admin for your organization will need to review the request
|
|
201
|
+
1. You’ll receive a Bot User OAuth Token once approved
|
|
202
|
+
1. save this securely.
|
|
203
|
+
|
|
204
|
+
### Configure Slack credentials
|
|
205
|
+
|
|
206
|
+
For each configured Slack workspace, uppercase the hostname and replace non-alphanumeric characters with underscores. Store its bot token in the resulting environment variable:
|
|
207
|
+
|
|
208
|
+
```text
|
|
209
|
+
example.slack.com -> SLACK_API_KEY_EXAMPLE_SLACK_COM
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
To find a channel ID, copy the Slack channel link. The final path segment beginning with `C` is the channel ID.
|
|
213
|
+
|
|
214
|
+
## Setting up Microsoft Teams
|
|
215
|
+
|
|
216
|
+
In Teams, open **Workflows**, search for an incoming-webhook template, and choose the template that posts to your intended channel or chat. Microsoft provides separate templates for channels, chats, and different authentication modes; these Teams webhook templates do not require a premium license. Select **Anyone** as the trigger authentication mode because Emberpost authenticates with the secret webhook URL and does not send an OAuth token. Choose the destination, save the workflow, add co-owners for operational continuity, and copy the generated webhook URL.
|
|
217
|
+
|
|
218
|
+
Store the URL in the environment variable named by `webhook_env`:
|
|
219
|
+
|
|
220
|
+
```yaml
|
|
221
|
+
destination:
|
|
222
|
+
provider:
|
|
223
|
+
name: msteams
|
|
224
|
+
options:
|
|
225
|
+
webhook_env: MSTEAMS_WEBHOOK_INCIDENT
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
Do not store a Teams webhook URL directly in schedule YAML. Each Teams Workflows webhook is bound to the chat or channel selected in its workflow, so no separate Team or channel ID is required. See Microsoft's [incoming webhook setup guide](https://support.microsoft.com/en-us/workflows/send-messages-in-teams-using-incoming-webhooks) for the current template flow.
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
<!-- MARKDOWN LINKS & IMAGES -->
|
|
233
|
+
[pytest-badge]:https://github.com/JSChronicles/emberpost/actions/workflows/pytest.yaml/badge.svg?branch=main
|
|
234
|
+
[pytest-url]:https://github.com/JSChronicles/emberpost/actions/workflows/pytest.yaml
|
|
235
|
+
[ruff-badge]:https://github.com/JSChronicles/emberpost/actions/workflows/ruff.yaml/badge.svg?branch=main
|
|
236
|
+
[ruff-url]:https://github.com/JSChronicles/emberpost/actions/workflows/ruff.yaml
|
|
237
|
+
[release-badge]:https://github.com/JSChronicles/emberpost/actions/workflows/release.yaml/badge.svg?branch=main
|
|
238
|
+
[release-url]:https://github.com/JSChronicles/emberpost/actions/workflows/release.yaml
|
|
239
|
+
[pypi-badge]:https://img.shields.io/pypi/v/emberpost
|
|
240
|
+
[pypi-url]:https://pypi.org/project/emberpost/
|
|
241
|
+
|
|
242
|
+
[prek-badge]:https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/j178/prek/master/docs/assets/badge-v0.json
|
|
243
|
+
[prek-url]:https://github.com/j178/prek
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["uv_build>=0.12.15,<0.14"]
|
|
3
|
+
build-backend = "uv_build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "emberpost"
|
|
7
|
+
version = "0.3.0"
|
|
8
|
+
description = "Dispatch PagerDuty on-call schedules to notification providers."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.14,<3.15"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
license-files = ["LICENSE"]
|
|
13
|
+
classifiers = [
|
|
14
|
+
"Development Status :: 4 - Beta",
|
|
15
|
+
"Environment :: Console",
|
|
16
|
+
"Intended Audience :: System Administrators",
|
|
17
|
+
"License :: OSI Approved :: MIT License",
|
|
18
|
+
"Operating System :: OS Independent",
|
|
19
|
+
"Programming Language :: Python :: 3",
|
|
20
|
+
"Programming Language :: Python :: 3.14",
|
|
21
|
+
"Topic :: Communications :: Chat",
|
|
22
|
+
"Topic :: System :: Monitoring",
|
|
23
|
+
]
|
|
24
|
+
dependencies = [
|
|
25
|
+
"jsonschema>=4.26.0,<4.30.0",
|
|
26
|
+
"pagerduty>=7.0.1",
|
|
27
|
+
"pyyaml>=6.0.3",
|
|
28
|
+
"slack-sdk>=3.44.1",
|
|
29
|
+
]
|
|
30
|
+
|
|
31
|
+
[[project.authors]]
|
|
32
|
+
name = "JSChronicles"
|
|
33
|
+
|
|
34
|
+
[project.urls]
|
|
35
|
+
Homepage = "https://github.com/JSChronicles/emberpost"
|
|
36
|
+
Repository = "https://github.com/JSChronicles/emberpost"
|
|
37
|
+
Issues = "https://github.com/JSChronicles/emberpost/issues"
|
|
38
|
+
Documentation = "https://opsfoundry.dev/emberpost/"
|
|
39
|
+
|
|
40
|
+
[project.scripts]
|
|
41
|
+
emberpost = "emberpost.cli:main"
|
|
42
|
+
|
|
43
|
+
[dependency-groups]
|
|
44
|
+
dev = [
|
|
45
|
+
"pytest-cov>=7.1.0,<8.0.0",
|
|
46
|
+
"pytest>=9.1.1,<10.0.0",
|
|
47
|
+
"prek>=0.4.12,<0.6.0",
|
|
48
|
+
"ruff>=0.16.0,<0.20.0",
|
|
49
|
+
"ty>=0.0.60,<0.20.0",
|
|
50
|
+
]
|
|
51
|
+
|
|
52
|
+
[tool.pytest.ini_options]
|
|
53
|
+
pythonpath = "src"
|
|
54
|
+
addopts = "-s -v --cov=emberpost --cov-report=term-missing --cov-fail-under=50"
|
|
55
|
+
norecursedirs = [
|
|
56
|
+
".git",
|
|
57
|
+
"__pycache__",
|
|
58
|
+
".venv",
|
|
59
|
+
]
|
|
60
|
+
testpaths = ["tests"]
|
|
61
|
+
|
|
62
|
+
[tool.coverage.run]
|
|
63
|
+
omit = ["tests/*"]
|
|
64
|
+
|
|
65
|
+
[tool.semantic_release]
|
|
66
|
+
allow_zero_version = true
|
|
67
|
+
build_command = """
|
|
68
|
+
uv lock --upgrade-package emberpost
|
|
69
|
+
git add uv.lock
|
|
70
|
+
"""
|
|
71
|
+
commit_message = """
|
|
72
|
+
chore(release): v{version}
|
|
73
|
+
|
|
74
|
+
Automatically generated by python-semantic-release"""
|
|
75
|
+
commit_parser = "conventional"
|
|
76
|
+
major_on_zero = false
|
|
77
|
+
tag_format = "v{version}"
|
|
78
|
+
version_toml = ["pyproject.toml:project.version"]
|
|
79
|
+
|
|
80
|
+
[tool.semantic_release.branches.main]
|
|
81
|
+
match = "main"
|
|
82
|
+
prerelease = false
|
|
83
|
+
|
|
84
|
+
[tool.semantic_release.changelog]
|
|
85
|
+
mode = "update"
|
|
86
|
+
template_dir = ".semantic_release/changelog_templates"
|
|
87
|
+
|
|
88
|
+
[tool.semantic_release.changelog.default_templates]
|
|
89
|
+
changelog_file = "CHANGELOG.md"
|
|
90
|
+
output_format = "md"
|
|
91
|
+
|
|
92
|
+
[tool.ruff]
|
|
93
|
+
target-version = "py314"
|
|
94
|
+
|
|
95
|
+
[tool.ruff.lint]
|
|
96
|
+
select = [
|
|
97
|
+
"N",
|
|
98
|
+
"E4",
|
|
99
|
+
"E7",
|
|
100
|
+
"E9",
|
|
101
|
+
"F",
|
|
102
|
+
]
|
|
103
|
+
task-tags = [
|
|
104
|
+
"TODO",
|
|
105
|
+
"FIXME",
|
|
106
|
+
"HACK",
|
|
107
|
+
]
|
|
108
|
+
|
|
109
|
+
[tool.ruff.format]
|
|
110
|
+
skip-magic-trailing-comma = true
|
|
111
|
+
|
|
112
|
+
[tool.uv]
|
|
113
|
+
exclude-newer = "1 week"
|
|
114
|
+
|
|
115
|
+
[tool.uv.exclude-newer-package]
|
|
116
|
+
uv-build = false
|