# Use cases and prompts

Source: https://pushary.com/docs/agents/use-cases
Last updated: 2026-10-04

> Copy-paste prompts and code for common Pushary use cases. Approve risky steps from your phone, get notified when an agent finishes, and alert on sign-ups.

These are ready prompts and code for the jobs people use Pushary for most: approving a risky step from your phone, getting a push notification when an agent finishes, and sending alerts from your own backend. Paste a prompt into any agent connected to Pushary, such as Claude Code, Cursor, Claude Desktop, Windsurf or Lovable.

Not connected yet? Run this first:

```bash
npx pushary@latest setup
```

## Ask before a risky step [#ask-before-a-risky-step]

**Problem:** the agent is about to do something you cannot undo, and you are not at your desk.

```text
Before you run the database migration, ask me through Pushary with ask_user:
"Run the database migration on staging?" Only run it if I answer yes.
If I don't answer, ask me here in the chat instead of going ahead.
```

**What happens:** your phone shows a yes or no question. The agent continues only on a yes. A refusal stops it, and an unanswered question never counts as a yes.

The same prompt works for any one-off decision. Swap in your own question:

* "Should I delete the staging database?"
* "Proceed with the bulk data import? It will take about 30 minutes."
* "Should I enable the new feature flag for all users?"

For approvals the agent cannot skip, use an agent with hooks and set [permission policies](/docs/agents/policies). How the agent should handle a question nobody answered is in [Human in the loop](/docs/agents/human-in-the-loop).

## Get a notification when the agent finishes [#get-a-notification-when-the-agent-finishes]

**Problem:** you start a long task, walk away, and keep checking back to see if it is done.

```text
When you finish this task, send me a Pushary notification titled "Done" with
context type "task_complete" and a one-line summary of what changed. If the task
fails, send one with context type "error" and the error message instead.
```

**What happens:** your phone gets the notification when the work ends, as long as task updates are on in your settings. An `error` notification is sent with high urgency. Tap the notification to open a detail page with the summary.

## Send yourself a notification from a prompt [#send-yourself-a-notification-from-a-prompt]

**Problem:** you want a quick alert on your phone without writing code.

```text
Use the Pushary send_notification tool to send me a push notification with the
title "New contact form submission" and the body "A visitor just filled out the
contact form."
```

**What happens:** the notification reaches your Pushary phone app and any browser you subscribed.

Adding `tags` (for example `["admin"]`), `subscriberIds` or `externalIds` limits delivery to browser subscribers that match, and skips the phone app.

## Send alerts from your backend [#send-alerts-from-your-backend]

**Problem:** you want a push notification when something happens in your app: a contact form, a sign-up, a payment.

Copy this utility into your Next.js app or any Node.js backend. It calls Pushary's `send_notification` tool over plain HTTP with `fetch`, so you need no SDK. Set `PUSHARY_API_KEY=pk_xxx.xxx` in your environment.

```ts
type SendNotificationParams = {
  title: string
  body: string
  url?: string
  iconUrl?: string
  imageUrl?: string
  subscriberIds?: string[]
  externalIds?: string[]
  tags?: string[]
}

type PusharyResult = { ok: true } | { ok: false; error: string }

export async function sendPushNotification(params: SendNotificationParams): Promise<PusharyResult> {
  const apiKey = process.env.PUSHARY_API_KEY
  if (!apiKey) return { ok: false, error: 'PUSHARY_API_KEY is not set' }

  try {
    const res = await fetch('https://pushary.com/api/mcp/mcp', {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
        'Accept': 'application/json, text/event-stream',
        'Authorization': `Bearer ${apiKey}`,
      },
      body: JSON.stringify({
        jsonrpc: '2.0',
        id: 1,
        method: 'tools/call',
        params: { name: 'send_notification', arguments: params },
      }),
    })

    const text = await res.text()
    if (!res.ok) return { ok: false, error: `Pushary returned ${res.status}: ${text}` }

    const dataLine = text.split('\n').find((line) => line.startsWith('data:'))
    const payload = JSON.parse(dataLine ? dataLine.replace(/^data:\s*/, '') : text) as {
      error?: { message?: string }
      result?: { isError?: boolean; content?: Array<{ text?: string }> }
    }
    if (payload.error) return { ok: false, error: payload.error.message ?? 'Pushary error' }
    if (payload.result?.isError) return { ok: false, error: payload.result.content?.[0]?.text ?? 'Pushary error' }
    return { ok: true }
  } catch (error) {
    return { ok: false, error: error instanceof Error ? error.message : 'Request failed' }
  }
}
```

The limit is 10 notifications per 5 minutes per site. Use this for alerts to yourself, not for messages to every user.

Then paste one of these prompts into your agent.

**A contact form submission:**

```text
In my Next.js contact form server action, after the form saves, call
sendPushNotification with the title "New inquiry" and a body with the
submitter's name and email. Send it with Next.js after() so it does not delay
the response. Read PUSHARY_API_KEY from the environment.
```

**A new sign-up:**

```text
In my sign-up webhook handler, after the user record is created, call
sendPushNotification with the title "New sign-up" and the body
"<email> just signed up for the <plan> plan". A failed notification must not
fail the webhook.
```

**A new payment:**

```text
In my Stripe webhook handler, on a checkout.session.completed event, after
verifying the Stripe signature, call sendPushNotification with the title
"New payment" and the body "<customer email> paid <amount>".
```

**What happens:** your agent wires the call into your code. Each event then sends a push notification to your phone.

If your agent should write the call without the utility, give it these details: `POST https://pushary.com/api/mcp/mcp`, headers `Content-Type: application/json`, `Accept: application/json, text/event-stream` and `Authorization: Bearer $PUSHARY_API_KEY`, and a JSON-RPC 2.0 body with method `tools/call`, `params.name` set to `send_notification` and `params.arguments` holding the title and body.

## Message your website's subscribers [#message-your-websites-subscribers]

**Problem:** you run push notifications for a website and want your agent to handle announcements and audience checks.

These prompts use the push platform tools, which need a key you create in **Settings > API keys** at [pushary.com/dashboard/agent/settings](https://pushary.com/dashboard/agent/settings). A key from setup or phone pairing cannot use them, and neither can a Claude or ChatGPT connector. They reach your website's browser subscribers.

**Broadcast a product announcement:**

```text
Use Pushary create_campaign to draft a push notification to all subscribers with
the title "We just launched <feature>", the body "See what's new" and the action
URL https://yoursite.com/changelog. Show me the draft, then send it with
send_campaign once I confirm.
```

**Check your subscriber count:**

```text
Call the Pushary count_subscribers tool and tell me the total, active and
unsubscribed subscriber counts for my site.
```

**What happens:** the campaign goes to every active subscriber. Call `get_campaign_stats` afterwards for delivery numbers.

## Use Pushary with Lovable [#use-pushary-with-lovable]

[Lovable](https://lovable.dev) supports custom MCP servers as personal connectors on paid plans. Connect Pushary and the Lovable agent can notify you and ask you questions while it builds. The [Lovable guide](/docs/agents/guides/lovable) covers the full setup, including the skill that makes it notify you and ask on its own.

**Notify when a build finishes:**

```text
After you finish implementing this feature, send me a Pushary notification with
title "Lovable build done" and a one-line summary of what changed.
```

**Ask before a risky change:**

```text
Before you delete or rename any database table, use Pushary ask_user to confirm
with me, and wait for my answer before continuing.
```

## Next steps [#next-steps]

<Cards>
  <Card title="Connect any agent" description="Use Pushary from curl, n8n, Zapier, LangChain or your own code." href="/docs/agents/connect-any-agent" />

  <Card title="Read the tools reference" description="Every argument for send_notification, ask_user and the push platform tools." href="/docs/agents/reference/tools" />
</Cards>