LangshenAgent Download Changelog GitHub 中文

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.

ParameterWhat it is
titleOne of twoThe title, up to 200 characters.
bodyOne of twoThe text, up to 1000 characters. At least one of title and body is needed.
urlOptionalWhat a tap opens: a web page (https://…) or another app's link (shortcuts://…, spotify:…). Up to 2000 characters.
groupOptionalA group name: notifications in one stack together in Notification Center. Up to 64 characters.
replaceOptionalA 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"

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

StatusMeaning
200{"ok":true}: Apple took it; it usually arrives in seconds.
400A parameter is wrong; error says which.
404No such key: it may have been reset. Use the command the app shows now.
410LangshenAgent was deleted from the phone, or reinstalled. Open it again and the key comes back.
429Too many: up to 30 a minute per key.
502Apple refused it; error has Apple's reason.

Security and privacy