# Shelly button pressed notifications on your phone > Get a push notification when a button wired to a Shelly input is pressed — perfect for a doorbell or gate button. - Company: Shelly (https://www.justpush.io/recipes/shelly) - Event: `input.button_push` (Button push) - Tags: Smart home, Security - Install: https://studio.justpush.io/recipes/shelly/button-pressed - Web page: https://www.justpush.io/recipes/shelly/button-pressed ## Setup 1. Click Install in Studio and sign in. The recipe is added to your account and you get a personal webhook URL. 2. Open your Shelly device's web interface (browse to its IP address) or the Shelly Smart Control app and go to Actions. 3. Add a webhook action for the Button push event. 4. Use the URL from the setup notes below. Shelly fills in the ${…} parts itself when it calls it. 5. Save, then trigger the device once to send a real event. 6. Use this as the action URL: 7. ``` 8. your webhook URL (shown in Studio after install)?event=input.button_push&device=${config.sys.device.name}&label=Front%20gate 9. ``` 10. Change `label=Front%20gate` to whatever you want the notification to say (`%20` is a space). Leave it out to use the device name. 11. Want double or long presses too? Add actions for `input.button_doublepush` and `input.button_longpush` with the same URL, changing `event=` to match. ## Code Studio calls `handleRequest(request)` with the incoming webhook (`{ method, headers, body, query, raw }`) and sends the message object it returns. Returning `null` sends nothing. ```js // Shelly → button pressed // Fires when a button wired to a Shelly input (i4, Plus 1, Plus i4, …) is pushed. // Handy for a doorbell or gate button. // // Add a webhook action for the "input.button_push" event (and optionally // "input.button_doublepush" / "input.button_longpush"), calling: // ?event=input.button_push&device=${config.sys.device.name}&label=Front%20gate // Shelly webhooks are GET requests, so the data arrives as query parameters. // Fall back to a JSON body so the recipe also works when POSTed (and in the Test runner). function readParams(request) { const body = request.body && typeof request.body === "object" ? request.body : {} return { ...body, ...(request.query || {}) } } // Shelly fills an unset name in as "null"; treat that (and blanks) as missing. function text(value) { const s = value == null ? "" : String(value).trim() return s === "" || s === "null" || s === "undefined" ? null : s } // Button events, and how to describe them in the notification. const PRESSES = { "input.button_push": "pressed", "input.button_doublepush": "double-pressed", "input.button_longpush": "long-pressed", } function handleRequest(request) { const params = readParams(request) // Guard: only handle button presses, so other Shelly hooks on this integration stay quiet. if (!Object.prototype.hasOwnProperty.call(PRESSES, params.event)) { console.log(`Ignoring Shelly event "${params.event ?? "unknown"}" — not a button press`) return null } // "label" is free text you put in the URL (e.g. "Front gate"); fall back to the device name. const button = text(params.label) ?? text(params.device) ?? "A Shelly button" return { title: "🔔 Button pressed", message: `${button} was ${PRESSES[params.event]}`, topic: "Shelly", priority: 1, // High — usually means someone is waiting // sound: "incoming", // any of Studio's sounds, e.g. incoming, bugle, siren } } ``` ## Shelly input.button_push webhook payload (sample) ```json { "event": "input.button_push", "label": "Front gate", "device": "shelly-i4-gate" } ``` ## FAQ ### 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 Shelly 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.