Ask and wait for an answer
Push a question to your phone, answer it from the notification or the app, and hand the answer back to the agent.
When an agent or script needs a decision, it can ask you on your phone and wait. You answer with a button or a short text. The answer goes back to whoever asked.
Deploy v0.2 to production?
3 commits since v0.1
[ Deploy ] [ Wait ] [ Reply ]Questions are time-sensitive pushes. They also stay in your inbox with your answer.
From an MCP client
Connect Opush as an MCP server. The agent gets two tools:
| Tool | Arguments |
|---|---|
ask_user | question (required), details, options (up to 4), allow_text, placeholder, timeout (seconds), wait (seconds), and device with an account connection |
get_answer | question_id (required), wait |
ask_user pushes the question and waits up to 45 seconds by default (wait goes from 0 to 50). If you answer in time, the result starts with The user answered: and includes the answer as JSON. If not, the result says the question is still pending and gives a question_id. The agent then calls get_answer to keep waiting, as many times as it needs.
You don't have to write any code. Ask the agent something like "Ask me on Opush before you run the migration."
Over HTTP
Send a POST to https://opu.sh/ask:
curl https://opu.sh/ask \
-H "Content-Type: application/json" \
-d '{
"device_key": "YOUR_KEY",
"title": "Deploy v0.2 to production?",
"body": "3 commits since v0.1",
"options": ["Deploy", "Wait"],
"allow_text": true,
"placeholder": "Anything to add?",
"timeout": 1800
}'| Field | Description |
|---|---|
device_key | Required. The device to ask. |
title | Required. The question, shown as the notification title. Up to 200 characters. |
body | More context under the question. Up to 2,000 characters. |
options | Up to 4 short choices, each up to 30 characters. They must be different. |
allow_text | true to let you type an answer. Give options, allow_text, or both. |
placeholder | Hint in the text field. Up to 60 characters. |
timeout | Seconds until the question expires: 60 to 604,800 (7 days). Default 3,600 (1 hour). |
callback_url | Opush POSTs the answer here. See Get a callback. |
group | Inbox group for the question. |
Form data and query parameters work too, for example https://opu.sh/ask?device_key=YOUR_KEY&title=Ship%20it%3F&options=Yes,No. A question counts as one push.
The response is 201 Created:
{
"question_id": "q_aLvBJaVvMvbingXOp9eapf",
"answer_url": "https://opu.sh/ask/q_aLvBJaVvMvbingXOp9eapf",
"expires_at": "2026-11-04T10:30:00Z"
}The question_id is also the secret for reading the answer. Keep it to yourself.
Wait for the answer
Long polling
GET the answer_url with wait (0 to 50 seconds). Opush replies as soon as the status is no longer pending, or when the time runs out. Call it again in a loop until you have a result.
Q=$(curl -s https://opu.sh/ask -H 'Content-Type: application/json' \
-d '{"device_key":"YOUR_KEY","title":"Run the migration?","options":["Run","Skip"],"allow_text":true}' \
| jq -r .question_id)
while :; do
R=$(curl -s "https://opu.sh/ask/$Q?wait=50")
S=$(echo "$R" | jq -r .status)
[ "$S" != pending ] && break
done
echo "$R" | jq '.answer'The result looks like this:
{
"question_id": "q_aLvBJaVvMvbingXOp9eapf",
"status": "answered",
"title": "Run the migration?",
"body": null,
"options": ["Run", "Skip"],
"allow_text": true,
"created_at": "2026-11-04T09:30:00Z",
"expires_at": "2026-11-04T10:30:00Z",
"answer": { "option": "Run", "option_index": 0, "text": "Back up first", "answered_at": "2026-11-04T09:31:12Z" }
}status is pending, answered, expired, or cancelled. answer is null until you answer.
Get a callback
Pass callback_url when you create the question. The response then includes a callback_secret (it starts with ocs_). After you answer, Opush sends one POST to your URL with the same JSON as above.
The X-Opush-Signature header is sha256= followed by the hex HMAC-SHA256 of the raw request body, using callback_secret as the key. Check it before you trust the request:
import { createHmac, timingSafeEqual } from "node:crypto";
function verify(rawBody, header, secret) {
const expected = "sha256=" + createHmac("sha256", secret).update(rawBody).digest("hex");
return header?.length === expected.length && timingSafeEqual(Buffer.from(header), Buffer.from(expected));
}The callback is sent once, with a 10-second timeout. It isn't retried, so if your server misses it, poll the answer_url. No callback is sent when a question expires or is cancelled.
Cancel a question
Changed your mind? DELETE the answer_url. The notification is removed from the phone, and the question is marked cancelled.
curl -X DELETE "https://opu.sh/ask/$Q"Answer a question
On the notification, tap one of the option buttons, or Reply to type an answer. You have to unlock your phone first, so nobody can answer for you from the Lock Screen.
You can also open the question in the Opush inbox. In the app you can pick an option and add text in the same answer.
- Only the first answer counts. If you have several devices, the first one wins. The others show that it was answered on another device.
- Once a question is answered, cancelled, or expired, the notification is removed from your devices. The inbox keeps the question and your answer.
- Closed questions are deleted 30 days after they were asked.
Errors
Errors from /ask use this format:
{ "error": { "code": "invalid_request", "message": "give options, allow_text, or both" } }| Status | Code | When |
|---|---|---|
400 | invalid_request | Missing device_key or title, more than 4 options, duplicate options, no options and no allow_text, or a bad timeout or callback_url |
404 | not_found | The device key or question doesn't exist |
429 | rate_limited | Too many pushes. Wait for Retry-After |
503 | device_unreachable | The device can't be reached (open Opush on it) |
503 | upstream_error | The push failed, or the server is busy |
See the ask API reference for every field.