Call EngageLab Web Push REST APIs to send push notifications and in-app messages to web browsers (Chrome, Firefox, Safari, Edge, etc.); manage tags and alias...
This skill enables interaction with the EngageLab Web Push REST API (MTPush Web). The service supports push notifications and in-app messages to web platforms only, with support for EngageLab channel and system channels (Chrome, Firefox, Safari, Edge, Opera).
It covers these areas:
webpush_client.py — Python client class (EngageLabWebPush) wrapping create push, batch push (regid/alias), device get/set/delete, tag count, scheduled tasks CRUD, and message details. Handles Basic auth and typed error handling.error-codes.md — Web Push API error codes and descriptionshttp-status-code.md — HTTP status code specificationcallback-api.md — Callback address, validation, security (X-CALLBACK-ID, HMAC-SHA256)Source API docs: doc/webpush/REST API/ (REST API Overview, Create Push API, Batch Single Push API, Group Push API, Scheduled Tasks API, Tag Alias API, Delete User API, Statistics API, Callback API, HTTP Status Code).
All EngageLab Web Push API calls use HTTP Basic Authentication.
https://webpushapi-sgp.engagelab.comhttps://webpushapi-hk.engagelab.comAuthorization: Basic base64(appKey:masterSecret)application/jsonObtain AppKey and Master Secret from Console → Application Settings → Application Info.
Group Push uses different auth: username = group- + GroupKey, password = Group Master Secret (from Group management).
Example (curl):
curl -X POST https://webpushapi-sgp.engagelab.com/v4/push \
-H "Content-Type: application/json" \
-u "YOUR_APP_KEY:YOUR_MASTER_SECRET" \
-d '{ "from": "push", "to": "all", "body": { "platform": "web", "notification": { "web": { "alert": "Hello!", "title": "Web Push", "url": "https://example.com" } } } }'
If the user hasn't provided credentials, ask for AppKey and Master Secret before generating API calls.
| Operation | Method | Path |
|---|---|---|
| Create push | POST | /v4/push |
| Batch push by registration_id | POST | /v4/batch/push/regid |
| Batch push by alias | POST | /v4/batch/push/alias |
| Group push | POST | /v4/grouppush |
| Create scheduled task | POST | /v4/schedules |
| Get scheduled task | GET | /v4/schedules/{schedule_id} |
| Update scheduled task | PUT | /v4/schedules/{schedule_id} |
| Delete scheduled task | DELETE | /v4/schedules/{schedule_id} |
| Tag count | GET | /v4/tags_count |
| Get device (tags/alias) | GET | /v4/devices/{registration_id} |
| Set device tags/alias | POST | /v4/devices/{registration_id} |
| Delete device (user) | DELETE | /v4/devices/{registration_id} |
| Message statistics | GET | /v4/messages/details (message_ids) |
POST /v4/push)Push a notification or message to web devices. Platform is web only.
| Field | Type | Required | Description |
|---|---|---|---|
from | string | No | Sender, e.g. "push" |
to | string or object | Yes | Target: "all" (broadcast, devices active within 30 days), or object with tag, tag_and, tag_not, alias, registration_id |
body | object | Yes | See below |
request_id | string | No | Client-defined request ID returned in response |
custom_args | object | No | Returned on callback |
| Field | Type | Required | Description |
|---|---|---|---|
platform | string | Yes | Must be "web" |
notification | object | Optional* | Notification content (web: alert, title, url, icon, image, extras) |
message | object | Optional* | In-app/custom message (msg_content, title, content_type, extras) |
options | object | No | time_to_live, override_msg_id, big_push_duration, web_buttons, multi_language, third_party_channel (w3push.distribution), plan_id, cid |
*One of notification or message must exist; they cannot coexist.
| Field | Type | Required | Description |
|---|---|---|---|
alert | string | Yes | Message content |
url | string | Yes | Click jump URL |
title | string | No | Message title |
icon | string | No | Notification icon (recommended 192×192px; ≤1MB; JPG/PNG/GIF; Chrome, Firefox) |
image | string | No | Big image (recommended 360×180px; ≤1MB; Chrome, Edge) |
extras | object | No | Custom key-value for business |
first_ospush | mtpush | secondary_push | ospush for system channel priority.to examples"to": "all""to": { "tag": ["tag1","tag2"] }"to": { "tag_and": ["tag3","tag4"] }"to": { "tag_not": ["tag5"] }"to": { "alias": ["user1","user2"] } (up to 1000)"to": { "registration_id": ["id1","id2"] } (up to 1000){ "request_id": "12345678", "msg_id": "1828256757" }
Notification body length limit: 2048 bytes (doc); total message limit 4000 bytes. See doc/webpush/REST API/Create Push API.md. Error codes: references/error-codes.md.
POST /v4/batch/push/regidPOST /v4/batch/push/aliasRequest body: { "requests": [ { "target": "reg_id_or_alias", "platform": "web", "notification": { "web": { "alert", "title", "url", ... } }, "message": {...}, "options": {...}, "custom_args": {...} } ] }. Max 500 items per request; target must be unique. See doc/webpush/REST API/Batch Single Push API.md.
POST /v4/grouppush — Same body structure as Create Push (platform web, notification.web). Auth: Basic with group-{GroupKey} and Group Master Secret. override_msg_id and Schedule API not supported for group push.
POST /v4/schedules — Body: name, enabled, trigger (single / periodical / intelligent), push (same as Create Push body with platform web).GET /v4/schedules/{schedule_id}.PUT /v4/schedules/{schedule_id}.DELETE /v4/schedules/{schedule_id}.Trigger types: single (time, zone_type), periodical (start, end, time, time_unit, point, zone_type), intelligent (backup_time: "now" or "yyyy-MM-dd HH:mm:ss"). Max 1000 valid scheduled tasks. See doc/webpush/REST API/Scheduled Tasks API.md.
GET /v4/tags_count?tags=tag1&tags=tag2&platform=web (up to 1000 tags; platform for Web Push is typically web — confirm in doc).GET /v4/devices/{registration_id} — Returns tags, alias.POST /v4/devices/{registration_id} — Body: { "tags": { "add": ["t1"], "remove": ["t2"] }, "alias": "alias1" }.Limits: 100,000 tags per app; 40 bytes per tag; 100 tags per device; 100,000 devices per tag; one alias per device (40 bytes); 100,000 aliases per app. See doc/webpush/REST API/Tag Alias API.md.
DELETE /v4/devices/{registration_id} — Asynchronously deletes user and all related data. Cannot be restored. Batch deletion not supported.
GET /v4/messages/details?message_ids=id1,id2 (up to 100 message_ids). Returns targets, sent, delivered, impressions, clicks, and sub-stats by channel (sub_web: engageLab_web, chrome, safari, firefox, edge, opera). Data retained up to one month. See doc/webpush/REST API/Statistics API.md.Configure callback URL (via Engagelab support). Validation: server sends POST with echostr in body; respond with body = echostr value. Security: use X-CALLBACK-ID header; signature = HMAC-SHA256(secret, timestamp+nonce+username). Respond with 200/204 within 3 seconds for success. See references/callback-api.md and doc/webpush/REST API/Callback API.md.
When the user asks to send web push or use other Web Push APIs, generate working code. Default to curl unless the user specifies a language. Supported: curl, Python (requests), Node.js (fetch/axios), Java (HttpClient), Go (net/http). Always include the Authorization header and error handling. Use placeholders YOUR_APP_KEY and YOUR_MASTER_SECRET if credentials are not provided.
import requests
APP_KEY = "YOUR_APP_KEY"
MASTER_SECRET = "YOUR_MASTER_SECRET"
BASE_URL = "https://webpushapi-sgp.engagelab.com"
resp = requests.post(
f"{BASE_URL}/v4/push",
auth=(APP_KEY, MASTER_SECRET),
headers={"Content-Type": "application/json"},
json={
"from": "push",
"to": "all",
"body": {
"platform": "web",
"notification": {
"web": {
"alert": "Hello, Web Push!",
"title": "Web Push Title",
"url": "https://example.com",
"extras": {"key": "value"},
}
},
"options": {"time_to_live": 86400},
},
"request_id": "req_001",
},
)
result = resp.json()
if resp.status_code == 200:
print("msg_id:", result.get("msg_id"))
else:
print("Error:", result.get("error"))
ZIP package — ready to use