Push your phone with curl
A script done, CI failing, a cron job due: send a notification to your iPhone. A tap on it can open a link, or run a shortcut.
Get your push address
In LangshenAgent on your iPhone, open Settings → Notifications → Push from scripts and tap Turn on. A curl command shows below it, copied with a tap; the address in it is yours:
https://push.langshenagent.dev/v1/notify/<your key>
Tap Send a test: if it arrives, you're set. No computer needs to be paired, and there's no account. iPhone only for now: the Android app has no push channel.
Send a notification
The simplest is curl's form fields; --data-urlencode encodes spaces, & and any language for you:
curl https://push.langshenagent.dev/v1/notify/<your key> \
--data-urlencode "title=Build finished" \
--data-urlencode "body=Tests passed on main"Or JSON:
curl https://push.langshenagent.dev/v1/notify/<your key> \
-H 'content-type: application/json' \
-d '{"title": "Deploy failed", "body": "Tap for the logs", "url": "https://github.com/me/app/actions"}'Or just open an address (GET), for places that can only fetch a link. Encode the parameters yourself:
https://push.langshenagent.dev/v1/notify/<your key>?title=Time%27s%20up
Parameters
They go after the address's ?, or in a JSON or form body; where both have one, the body's wins.
| Parameter | What it is | |
|---|---|---|
title | One of two | The title, up to 200 characters. |
body | One of two | The text, up to 1000 characters. At least one of title and body is needed. |
url | Optional | What a tap opens: a web page (https://…) or another app's link (shortcuts://…, spotify:…). Up to 2000 characters. |
group | Optional | A group name: notifications in one stack together in Notification Center. Up to 64 characters. |
replace | Optional | A tag: a new notification replaces the unread one before it with the same tag. Good for progress. Up to 64 characters. |
Run a shortcut from a notification
Set url to a shortcut's link and a tap runs it. Make a shortcut called "Text Mom" in the Shortcuts app, then:
curl https://push.langshenagent.dev/v1/notify/<your key> \
--data-urlencode "title=Time to text Mom" \
--data-urlencode "url=shortcuts://run-shortcut?name=Text Mom"- A tap opens LangshenAgent, which goes straight on to the other app. iOS doesn't let a notification run anything by itself: it takes your tap.
- The first time a kind of link comes (
shortcuts://, say), LangshenAgent asks you to allow it; once allowed, links of that kind open directly. Web links aren't asked about. - Some shortcut actions, such as sending a message, have iOS ask you once more.
Push from a shortcut
Use the Get Contents of URL action: your push address as the URL, POST as the method, a JSON request body with title, body and the rest. With Automation, it reminds you as you get home, plug in, or open an app.
What comes back
| Status | Meaning | |
|---|---|---|
200 | {"ok":true}: Apple took it; it usually arrives in seconds. | |
400 | A parameter is wrong; error says which. | |
404 | No such key: it may have been reset. Use the command the app shows now. | |
410 | LangshenAgent was deleted from the phone, or reinstalled. Open it again and the key comes back. | |
429 | Too many: up to 30 a minute per key. | |
502 | Apple refused it; error has Apple's reason. |
Security and privacy
- Whoever has the key can notify your phone, and have you tap a link of their choosing. Don't paste the command anywhere public. If it leaks, tap Reset key in the app: the old key stops at once.
- Pushes go through push.langshenagent.dev on to Apple's push service (APNs). It keeps only the key, the phone's push address and a hash to check them by, never what is pushed.
- A key whose app hasn't been opened for 180 days is deleted; opening LangshenAgent again brings it back, unchanged.