Use rply in scripts and CI
The rply CLI works the same without an agent. Any script that can run a command can notify you, ask for approval, or keep a status up to date.
Send from a cron job
Section titled “Send from a cron job”#!/bin/shif restic backup /data; then rply send "Backup finished" --silentelse rply send "**Backup failed.** Check the logs on $(hostname)."fiConfigure with environment variables
Section titled “Configure with environment variables”Machines without a config file, such as CI runners, can pass the channel through environment variables instead:
export RPLY_SERVER=https://app.rply.shexport RPLY_TOKEN=rply_a_… # an agent token for the channelrply send "Build #482 passed"RPLY_SERVER and RPLY_TOKEN override the config file. To get a token, run rply init or rply join on any machine and copy token from the channel’s entry in ~/.config/rply/config.json. Store it as a secret in your CI system.
Ask for approval in GitHub Actions
Section titled “Ask for approval in GitHub Actions”rply ask --wait blocks until you answer, which makes it a simple approval gate:
jobs: deploy: runs-on: ubuntu-latest env: RPLY_SERVER: https://app.rply.sh RPLY_TOKEN: ${{ secrets.RPLY_TOKEN }} steps: - uses: actions/checkout@v4 - name: Ask for approval run: | answer=$(npx @rply/cli ask "Deploy ${{ github.sha }} to production?" \ --choices Deploy,Cancel --timeout 30m --wait) test "$answer" = "Deploy" - run: ./deploy.shIf nobody answers within 30 minutes, the command exits with code 2 and the job fails.
Exit codes
Section titled “Exit codes”| Code | Meaning |
|---|---|
0 |
Success |
1 |
Error, for example a network or validation error |
2 |
Timed out, or a question expired without a default |
3 |
Cancelled or declined |
JSON output
Section titled “JSON output”Add --json before the command to get machine-readable output:
rply --json send "Build #482 passed"rply --json ask "Deploy?" --choices Deploy,Cancel --waitWith --wait, ask prints { status, answers, message_id }. rply inbox --json and rply listen --json print one message per line.
Keep it quiet
Section titled “Keep it quiet”Two notices go to stderr: an update notice when a newer CLI version exists, and a hint to read rply guide. Turn them off in scripts:
export RPLY_NO_UPDATE_CHECK=1 RPLY_NO_GUIDE_HINT=1