Codemagic build finished notifications on your phone.
Get a High-priority push notification when a Codemagic build fails, and optionally a quiet one when it succeeds, using a short publishing script in codemagic.yaml.
Three steps to your first push
Install the recipe
One click in Studio gives you a personal webhook URL.
Paste your URL into Codemagic
Add it as a webhook for Build finished.
Get a push on your phone
With the text, sound and buttons from the recipe.
How to set up the Codemagic build finished webhook
- Click Install in Studio and sign in. The recipe is added to your account and you get a personal webhook URL.
- Codemagic has no outgoing webhooks, so copy the codemagic.yaml snippet from the setup notes below. It already contains your endpoint URL.
- Add its two parts to each workflow you want to hear about: a last script step, and a publishing script.
- Commit codemagic.yaml and run a build to test.
- Codemagic can email you or post to Slack, but it can't call a webhook when a build ends. Its [publishing scripts](https://docs.codemagic.io/yaml-distributing/post-publish/) run after every build, pass or fail, so this recipe uses one to send the result to JustPush.
- Add both parts below to each workflow in `codemagic.yaml` you want to hear about. The **last** script step marks the build as successful; the publishing script checks for that mark and posts the result. Replace `Acme Shop` with your app's name.
- ```yaml
- workflows:
- ios-release:
- name: iOS release
- environment:
- vars:
- JUSTPUSH_APP_NAME: "Acme Shop"
- scripts:
- # ... your existing build steps ...
- name: Mark build successful
- script: touch ~/SUCCESS
- publishing:
- scripts:
- name: Notify JustPush
- script: |
- if [ -f "$HOME/SUCCESS" ]; then STATUS=success; else STATUS=failure; fi
- jq -n \
- --arg status "$STATUS" \
- --arg app "${JUSTPUSH_APP_NAME:-$CM_REPO_SLUG}" \
- --arg workflow "$CM_WORKFLOW_NAME" \
- --arg build_number "$BUILD_NUMBER" \
- --arg branch "$CM_BRANCH" \
- --arg tag "$CM_TAG" \
- --arg commit "$CM_COMMIT" \
- --arg commit_message "$(git -C "$CM_BUILD_DIR" log -1 --pretty=%s 2>/dev/null)" \
- --arg url "https://codemagic.io/app/$CM_PROJECT_ID/build/$CM_BUILD_ID" \
- '{event: "build.finished", status: $status, app: $app, workflow: $workflow,
- build_number: $build_number, branch: $branch, tag: $tag, commit: $commit,
- commit_message: $commit_message, url: $url}' \
- | curl -s -m 10 -X POST -H "Content-Type: application/json" --data @- "your webhook URL" || truehttps://••••••••/•••••••• your personal URL, shown after install
- ```
- Only failed builds push by default (High priority). To also get a quiet push when a build succeeds, add `?all=1` to the URL in the snippet:
- ```
- your webhook URL?all=1
- ```
- Notes:
- Codemagic doesn't run publishing scripts for builds that are **canceled or time out**, so those don't push.
- The success mark only covers your script steps. If a built-in publisher such as App Store Connect or Google Play fails, this push can't tell; Codemagic's own email or Slack notifications cover that.
- The snippet uses `jq` and `git`, as Codemagic's own publishing examples do. The `|| true` keeps a JustPush hiccup from failing your build.
- The request is unsigned (`verify: none`), so keep your endpoint URL private.
What runs when the webhook arrives
Studio calls handleRequest(request) with the incoming webhook and sends the message it returns. It's yours after install; change anything.
The Codemagic build.finished webhook
This is what Codemagic sends to your URL for build finished. It is a sample, trimmed to the fields recipes use.
Codemagic build finished notifications: questions
Does this work on iPhone and Android?
Yes. Install the JustPush app from the App Store or Google Play and sign in. Every phone signed in to your account gets the notification.
Do I need to write code?
No. Install the recipe in Studio, paste your webhook URL into Codemagic and you are done. The code is there if you want to change the text, the sound or the buttons.
Can I change what the notification says?
Yes. After install the recipe's code is yours. Edit it in Studio and test it against the sample payload before you save.
What does it cost?
JustPush is free for 30 days. After that it's $19.99 a year, or $39.99 once. There is no extra charge for recipes.
Codemagic on your phone in two minutes.
Install the recipe, paste one URL, done. Free for 30 days, no credit card required.