Use Cases & Prompts
Copy-paste prompts and code examples for common Pushary notification use cases with AI agents
Using Pushary with AI agents
Once you have connected the Pushary MCP to your AI agent, you can use natural language prompts or drop in the utility below to trigger push notifications from your code.
Server-Side Utility
For use in Next.js Server Actions, API routes, or any Node.js backend, copy this utility. It calls the MCP endpoint directly using fetch - no extra SDK required.
# Add your API key to your environment
PUSHARY_API_KEY=pk_xxx.secret_xxxtype SendNotificationParams = {
title: string
body: string
url?: string
iconUrl?: string
imageUrl?: string
subscriberIds?: string[]
externalIds?: string[]
tags?: string[]
}
type PusharyResult = {
ok: boolean
error?: string
}
export async function sendPushNotification(params: SendNotificationParams): Promise<PusharyResult> {
const apiKey = process.env.PUSHARY_API_KEY
if (!apiKey) {
console.warn('PUSHARY_API_KEY is not set - skipping push notification')
return { ok: false, error: 'PUSHARY_API_KEY not configured' }
}
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,
},
}),
})
if (!res.ok) {
const text = await res.text()
console.error('Pushary notification failed:', res.status, text)
return { ok: false, error: `Pushary API error: ${res.status}` }
}
const text = await res.text()
const jsonLine = text.split('\n').find(line => line.startsWith('data:'))
if (jsonLine) {
const parsed = JSON.parse(jsonLine.replace(/^data:\s*/, '')) as {
result?: { content?: Array<{ text?: string }> }
error?: { message?: string }
}
if (parsed.error) {
console.error('Pushary MCP error:', parsed.error.message)
return { ok: false, error: parsed.error.message }
}
}
return { ok: true }
} catch (error) {
console.error('Pushary notification request error:', error)
return { ok: false, error: 'Failed to send push notification' }
}
}Prompts for AI Agents
Use these prompts with Cursor, Claude, Windsurf, Lovable, or any MCP-connected agent to send notifications or integrate Pushary into your codebase.
Send a Notification via Prompt
Use the Pushary MCP to send a push notification to all subscribers tagged "admin"
with title "New Contact Form Submission" and body "A visitor just filled out the contact form."Using the pushary tool, send a push notification with:
- title: "New Contact Form Submission"
- body: "A visitor just filled out the contact form."
- tags: ["admin"]Call the Pushary send_notification tool with title "New Contact Form Submission",
body "A visitor just filled out the contact form.", targeting tags: ["admin"]Use the Pushary MCP connector to send a push notification to subscribers tagged "admin"
with title "New Contact Form Submission" and body "A visitor just filled out the contact form."Integrate into a Contact Form (Next.js)
In my Next.js app, after a successful contact form submission in the server action,
use the sendPushNotification utility (calling https://pushary.com/api/mcp/mcp with
JSON-RPC and Accept: application/json, text/event-stream) to send a fire-and-forget
push notification with title "New Inquiry" and body showing the submitter's name and email,
targeting tags: ["admin"]. Use PUSHARY_API_KEY from env.Add a push notification to my contact form server action. After the form saves successfully,
call the Pushary MCP endpoint POST https://pushary.com/api/mcp/mcp with headers
Content-Type: application/json and Accept: application/json, text/event-stream,
Authorization: Bearer $PUSHARY_API_KEY. Use JSON-RPC method tools/call, tool name
send_notification, with title "New Inquiry", body including the user's name and email,
tags: ["admin"]. Make it fire-and-forget so it doesn't block the response.After my form submission saves to the database, send a Pushary push notification via
POST https://pushary.com/api/mcp/mcp. The request body should be JSON-RPC 2.0 with
method "tools/call", params.name "send_notification", params.arguments containing
title, body with the user's details, and tags: ["admin"]. Auth header:
Bearer $PUSHARY_API_KEY. Use Accept: application/json, text/event-stream.Alert on New User Sign-Up
Whenever a new user signs up (in my auth webhook or onboarding server action),
use the Pushary MCP send_notification tool to notify subscribers tagged "team"
with title "New Sign-Up" and body showing the user's email and plan.
Use the sendPushNotification utility with PUSHARY_API_KEY from env.In my sign-up webhook handler, after creating the user record, call the Pushary
send_notification tool via the MCP. Title: "New Sign-Up 🎉", body: "{email} just
signed up for the {plan} plan.", tags: ["team"]. Make it non-blocking.Add a Pushary notification to my user registration flow. After successful user
creation, fire-and-forget a push to tags: ["team"] via the Pushary MCP endpoint
with title "New Sign-Up" and body including the new user's email.Alert on New Payment / Purchase
In my Stripe webhook handler, on a checkout.session.completed event, use the
Pushary MCP to send a push notification to tags: ["admin"] with title
"New Payment" and body showing the customer email and amount paid.After a successful Stripe payment webhook, call Pushary send_notification with
title "New Payment Received", body "{customerEmail} paid ${amount}", tags: ["admin"].
Use PUSHARY_API_KEY and POST to https://pushary.com/api/mcp/mcp with JSON-RPC.In my payment webhook route handler, after verifying the Stripe signature and
extracting the session, send a Pushary push notification via MCP to tags: ["admin"]
with payment confirmation details. Use fire-and-forget pattern.Broadcast a Product Announcement to All Subscribers
Use the Pushary MCP send_notification tool to broadcast a notification to all
subscribers (no tags filter) with title "We just launched [Feature Name]" and
body "Check it out - link in the notification." and url "https://yoursite.com/changelog".Send a product announcement to all active subscribers via Pushary. Title:
"We just launched [Feature]", body: "Check out what's new →", url: "https://yoursite.com/changelog".
No tags - send to everyone.Call Pushary send_notification with title "New Feature Released", body describing
the feature, url pointing to the changelog. Omit subscriberIds, externalIds, and tags
to target all active subscribers.Use the Pushary MCP connector to send a push notification to all subscribers
with title "We just launched [Feature]", body "Check out what's new →",
and url pointing to my changelog page. No tags - broadcast to everyone.Ask User for Confirmation (Human-in-the-Loop)
Before deploying this database migration, ask me for confirmation via Pushary.
Use ask_user to send me a push notification asking "Should I proceed with
the database migration?" targeting tags: ["admin"]. Then wait for my answer using
wait_for_answer. Only proceed with the migration if I respond "yes".I need to confirm a destructive action. Use the Pushary ask_user tool to
send a question "Should I delete the staging database?" to subscribers tagged "admin".
Then call wait_for_answer with the correlationId and proceed based on my response.Before running this expensive API call, confirm with me first. Call Pushary
ask_user with question "Proceed with bulk data import? This will take ~30 min."
targeting tags: ["admin"]. Poll with wait_for_answer until I respond.Use the Pushary MCP connector to ask me a yes/no question via push notification:
"Should I enable the new feature flag for all users?" Target tags: ["admin"].
Wait for my response before making the change.Check Subscriber Count
Use the Pushary MCP count_subscribers tool to get the current total, active,
and unsubscribed subscriber counts for this site.Call the Pushary count_subscribers tool and tell me how many active subscribers
we have, how many have unsubscribed, and the total.Use the Pushary MCP to get subscriber counts. Call count_subscribers and
summarize the results.Use the Pushary MCP connector to call count_subscribers and show me the total,
active, and unsubscribed counts for my site.Using Pushary with Lovable
Lovable supports custom MCP servers as personal connectors on paid plans. Connect Pushary so the Lovable agent notifies you and asks you questions while it builds. See the dedicated Lovable guide for the full setup, including the skill that makes it notify you and ask on its own.
Quick prompts
Notify when a build finishes:
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:
Before you delete or rename any database table, use Pushary ask_user to confirm
with me, and wait for my answer before continuing.