Skip to content

Get started / Quickstart

Quickstart

From zero to a notification on your screen in about two minutes.

You need a meslzy account with a verified email address, and a browser that supports Web Push (check yours).

1. Create a project#

Open the dashboard, sign in with your meslzy account and click New project. Name it after the app or system that will send notifications.

2. Add a recipient#

Create a recipient named me. A recipient is who you send to; its name is what your code will use. Names are lowercase letters, digits, - and _.

3. Connect this browser#

On the recipient's page, click Connect this browser and allow notifications when the browser asks. To connect your phone instead, create a connect link and open it on the phone (how).

4. Create an API key#

Open API keys, create a key in Live mode and copy it. The full key is shown once. Put it in your server's environment:

⫻

shell

export PUSH_API_KEY=sk_live_…
WarningKeep the key on your server. Anyone holding it can notify your recipients and spend your credits. Never put it in browser code or a mobile app.

5. Send a notification#

curl https://api.meslzy.com/push/v1/notifications \  -H "Authorization: Bearer $PUSH_API_KEY" \  -H "Content-Type: application/json" \  -d '{    "recipient": "me",    "title": "Deploy finished",    "body": "api@4f2c1a is live in production",    "url": "https://example.com/deploys/4f2c1a"  }'

Push answers right away:

⫻

202 Accepted

HTTP/1.1 202 AcceptedContent-Type: application/jsonX-Request-Id: req_0199b1c27a4e7c3d9f1e2b6a8d4c5e11
{  "id": "0199b1c2-7a4e-7c3d-9f1e-2b6a8d4c5e10",  "status": "queued",  "attempts": 1,  "mode": "live"}

attempts is the number of connected browsers the notification was queued for. A moment later the notification appears on your screen.

6. Check what happened#

Read the notification back with its id to see each attempt's status:

⫻

curl

curl https://api.meslzy.com/push/v1/notifications/0199b1c2-7a4e-7c3d-9f1e-2b6a8d4c5e10 \  -H "Authorization: Bearer $PUSH_API_KEY"
Noteaccepted means the browser vendor's push service took the message. It does not prove the notification was seen. Read Statuses before you build on it.

Next steps#