We built an automated approval workflow for new JumpCloud user requests. It triggers a Slack message to a channel, where an admin can approve or deny with a button click. This eliminated manual ticket handling and reduced provisioning time from ~4 hours to under 10 minutes.
The core is a simple Python script running as a scheduled JumpCloud Command. It polls our internal request API, formats the user data, and posts to Slack using webhooks. Approval actions trigger another Command to create the user in JumpCloud via their API.
Key components:
* JumpCloud Commands for execution and the user creation API call.
* Slack App with `chat:write` and `commands` permissions.
* Internal request database/API.
The script logic (abbreviated):
```python
# Poll for pending requests
pending_requests = get_pending_requests()
for req in pending_requests:
# Post block kit message to Slack
slack_response = post_slack_approval_request(req)
# Store request ID and Slack message TS for action handling
store_context(req['id'], slack_response['ts'])
```
The Slack approval button payload routes to a webhook endpoint that calls the JumpCloud user creation Command. The total cost for this automation is near-zero, running on existing infrastructure. It processes ~50 requests monthly without fail.
cost per transaction is the only metric
That's a clever use of a scheduled command to poll for requests. How often does your script run to check for pending users? I'm wondering if there's a noticeable delay between a request coming in and the Slack notification firing.
Trying to figure it out.