تاپیکهای اعلان
اعلان به گوشی و دسکتاپ کاربران خودتان، با عضویت در تاپیک.
/v1/notifications/configWhether notifications are served, and for which app#
available: whether topics can be published to here; phone_channel: whether each person can get the notification centre's events on their phone; server and app (the notifications app a receiver installs, and its stores); the plan's limits; key_secret, the secret in every project's secrets that signs its devices' tokens.
- دسترسی
- کلید API یا نشست داشبورد
- نقشها
- همهٔ نقشها
پاسخ
200object
availablebooleanphone_channelbooleanserverstringappobjectnamestringstoresobject[]storestringurlstring
limitsNotificationLimitstopicsintegermessage_bytesintegertitle_charsintegertagsintegertag_charsintegeractionsintegerlabel_charsintegerurl_charsintegermin_delay_sintegermax_delay_sintegerkeep_hoursintegertoken_default_sintegertoken_max_sintegerrecentintegertopics_usedinteger
key_secretstring
خطاها
| وضعیت | توضیح |
|---|---|
| 401 | unauthorized: missing, invalid, expired or revoked credential |
| 500 | internal: an unexpected failure |
نمونه
curl "https://api.ibel.ai/v1/notifications/config" \
-H "Authorization: Bearer $KEY"/v1/notifications/topicsThe team's topics#
Every project's topics by name, or one project's with project, each with its numbers; the plan's limits with topics_used.
- دسترسی
- کلید API یا نشست داشبورد
- نقشها
- همهٔ نقشها
پارامترها
anyanyany
پاسخ
200object
topicsNotificationTopic[]idstringالزامیnt_and 16 hexnamestringالزامیdescriptionstringprojectobjectالزامیidstringnamestring
environmentstringthe environment the numbers are for (one topic's answer)
created_atstring (date-time)الزامیsubscribersintegerdevices subscribed, the edges' last count (null before the first)
published_24hintegerdelivered_24hinteger
next_cursorstringlimitsNotificationLimitstopicsintegermessage_bytesintegertitle_charsintegertagsintegertag_charsintegeractionsintegerlabel_charsintegerurl_charsintegermin_delay_sintegermax_delay_sintegerkeep_hoursintegertoken_default_sintegertoken_max_sintegerrecentintegertopics_usedinteger
availableboolean
خطاها
| وضعیت | توضیح |
|---|---|
| 400 | Bad request: bad_param, bad_cursor |
| 401 | unauthorized: missing, invalid, expired or revoked credential |
| 404 | Not found: not_found |
| 500 | internal: an unexpected failure |
نمونه
curl "https://api.ibel.ai/v1/notifications/topics" \
-H "Authorization: Bearer $KEY"/v1/notifications/usageThe team's notifications usage#
Messages published and deliveries to devices per day (Tehran's), every project's or one project's with project, and their cost at list price once the meters have a price (priced).
- دسترسی
- کلید API یا نشست داشبورد
- نقشها
- همهٔ نقشها
پارامترها
anydaysintegerکوئریhow many days back: 1 to 90 (default 30)
پاسخ
200NotificationUsage
daysintegerfromstring (date-time)tostring (date-time)publishedintegerdeliveredintegerper_dayobject[]daystringpublishedintegerdeliveredinteger
metersobject[]list_rialsintegerpricedbooleanfalse until the owner sets the meters' prices
خطاها
| وضعیت | توضیح |
|---|---|
| 400 | Bad request: bad_param |
| 401 | unauthorized: missing, invalid, expired or revoked credential |
| 404 | Not found: not_found |
| 500 | internal: an unexpected failure |
نمونه
curl "https://api.ibel.ai/v1/notifications/usage" \
-H "Authorization: Bearer $KEY"/v1/projects/{project}/notifications/topicsA project's topics#
The project's topics by name, each with its numbers in production.
- دسترسی
- کلید API یا نشست داشبورد
- نقشها
- همهٔ نقشها
پارامترها
anyanyany
پاسخ
200object
topicsNotificationTopic[]idstringالزامیnt_and 16 hexnamestringالزامیdescriptionstringprojectobjectالزامیidstringnamestring
environmentstringthe environment the numbers are for (one topic's answer)
created_atstring (date-time)الزامیsubscribersintegerdevices subscribed, the edges' last count (null before the first)
published_24hintegerdelivered_24hinteger
next_cursorstring
خطاها
| وضعیت | توضیح |
|---|---|
| 400 | Bad request: bad_param, bad_cursor |
| 401 | unauthorized: missing, invalid, expired or revoked credential |
| 404 | Not found: not_found |
| 500 | internal: an unexpected failure |
نمونه
curl "https://api.ibel.ai/v1/projects/my-api/notifications/topics" \
-H "Authorization: Bearer $KEY"/v1/projects/{project}/notifications/topicsCreate a topic#
A topic: a name in the project; a message published to it reaches every device subscribed to it. A preview and development get their own when they first use it.
- دسترسی
- کلید API یا نشست داشبورد
- نقشها
- مالک، ادمین، توسعهدهنده
پارامترها
any
بدنهٔ درخواستapplication/json
namestringالزامیletters, digits, - and _, 1 to 64 characters; unique in the project whatever its case
descriptionstringat most 300 characters
پاسخ
201NotificationTopic
idstringالزامیnt_and 16 hexnamestringالزامیdescriptionstringprojectobjectالزامیidstringnamestring
environmentstringthe environment the numbers are for (one topic's answer)
created_atstring (date-time)الزامیsubscribersintegerdevices subscribed, the edges' last count (null before the first)
published_24hintegerdelivered_24hinteger
خطاها
| وضعیت | توضیح |
|---|---|
| 400 | Bad request: bad_name, bad_setting, bad_json |
| 401 | unauthorized: missing, invalid, expired or revoked credential |
| 403 | Not allowed: forbidden, limit |
| 404 | Not found: not_found |
| 409 | Conflict: name_taken |
| 500 | internal: an unexpected failure |
نمونه
curl -X POST "https://api.ibel.ai/v1/projects/my-api/notifications/topics" \
-H "Authorization: Bearer $KEY" \
-d '{"name":"my-api"}'/v1/projects/{project}/notifications/topics/{topic}A topic#
The topic with its numbers in the environment asked for: subscribers (devices subscribed, the edges' last count; null before the first), messages published and delivered in the last 24 hours.
- دسترسی
- کلید API یا نشست داشبورد
- نقشها
- همهٔ نقشها
پارامترها
anytopicstringمسیرالزامیthe topic's name (any case) or id (
nt_…)anyالزامی
پاسخ
200NotificationTopic
idstringالزامیnt_and 16 hexnamestringالزامیdescriptionstringprojectobjectالزامیidstringnamestring
environmentstringthe environment the numbers are for (one topic's answer)
created_atstring (date-time)الزامیsubscribersintegerdevices subscribed, the edges' last count (null before the first)
published_24hintegerdelivered_24hinteger
خطاها
| وضعیت | توضیح |
|---|---|
| 400 | Bad request: bad_environment |
| 401 | unauthorized: missing, invalid, expired or revoked credential |
| 404 | Not found: not_found |
| 500 | internal: an unexpected failure |
نمونه
curl "https://api.ibel.ai/v1/projects/my-api/notifications/topics/topic" \
-H "Authorization: Bearer $KEY"/v1/projects/{project}/notifications/topics/{topic}Delete a topic#
Deletes the topic with its environments' own: nothing more is published to it; devices keep what they received. A session needs a step-up.
- دسترسی
- کلید API یا نشست داشبورد
- نقشها
- مالک، ادمین، توسعهدهنده
- تایید دوم
- با نشست داشبورد، عامل دوم در ۱۰ دقیقهٔ اخیر لازم است؛ کلید API نیازی ندارد.
پارامترها
anytopicstringمسیرالزامیthe topic's name (any case) or id (
nt_…)
پاسخ
200object
idstringnamestringdeletedboolean
خطاها
| وضعیت | توضیح |
|---|---|
| 401 | unauthorized: missing, invalid, expired or revoked credential |
| 403 | Not allowed: forbidden, step_up_required |
| 404 | Not found: not_found |
| 500 | internal: an unexpected failure |
نمونه
curl -X DELETE "https://api.ibel.ai/v1/projects/my-api/notifications/topics/topic" \
-H "Authorization: Bearer $KEY"- دسترسی
- کلید API یا نشست داشبورد
- نقشها
- مالک، ادمین، توسعهدهنده
پارامترها
anytopicstringمسیرالزامیthe topic's name (any case) or id (
nt_…)
بدنهٔ درخواستapplication/json
descriptionstringat most 300 characters
پاسخ
200NotificationTopic
idstringالزامیnt_and 16 hexnamestringالزامیdescriptionstringprojectobjectالزامیidstringnamestring
environmentstringthe environment the numbers are for (one topic's answer)
created_atstring (date-time)الزامیsubscribersintegerdevices subscribed, the edges' last count (null before the first)
published_24hintegerdelivered_24hinteger
خطاها
| وضعیت | توضیح |
|---|---|
| 400 | Bad request: bad_setting, nothing, bad_json |
| 401 | unauthorized: missing, invalid, expired or revoked credential |
| 403 | Not allowed: forbidden |
| 404 | Not found: not_found |
| 500 | internal: an unexpected failure |
نمونه
curl -X PATCH "https://api.ibel.ai/v1/projects/my-api/notifications/topics/topic" \
-H "Authorization: Bearer $KEY" \
-d '{"description":"…"}'/v1/projects/{project}/notifications/topics/{topic}/messagesThe kept messages#
What the topic keeps now for devices that were offline, newest first (50 a page, at most the plan's recent).
- دسترسی
- کلید API یا نشست داشبورد
- نقشها
- همهٔ نقشها
پارامترها
anytopicstringمسیرالزامیthe topic's name (any case) or id (
nt_…)anyالزامیanyany
پاسخ
200object
topicstringenvironmentstringmessagesNotificationMessage[]idstringالزامیtimestring (date-time)الزامیexpires_atstring (date-time)titlestringtextstringالزامیpriorityintegerالزامیtagsstring[]clickstringactionsNotificationAction[]typestringالزامیone of
open,calllabelstringالزامیurlstringالزامیmethodstringone of
POST,PUT,GETbodystring
next_cursorstringkeep_hoursinteger
خطاها
| وضعیت | توضیح |
|---|---|
| 400 | Bad request: bad_param, bad_cursor, bad_environment |
| 401 | unauthorized: missing, invalid, expired or revoked credential |
| 404 | Not found: not_found |
| 500 | internal: an unexpected failure |
| 503 | Unavailable: notifications_unavailable |
نمونه
curl "https://api.ibel.ai/v1/projects/my-api/notifications/topics/topic/messages" \
-H "Authorization: Bearer $KEY"/v1/projects/{project}/notifications/topics/{topic}/messagesPublish a message#
Sends a message to every device subscribed to the topic in the environment asked for, now or at at. A device that is offline gets it when it reconnects, within the plan's keep_hours.
- دسترسی
- کلید API یا نشست داشبورد
- نقشها
- مالک، ادمین، توسعهدهنده
پارامترها
anytopicstringمسیرالزامیthe topic's name (any case) or id (
nt_…)anyالزامی
بدنهٔ درخواستapplication/json
textstringالزامیthe message, at most the plan's
message_bytes(4096 at the start)titlestringone line, at most
title_charspriorityinteger1 (lowest) to 5 (urgent); 3 is the default
1–5
tagsstring[]at most
tagswords of letters, digits, _, + and -clickstringan https address the notification opens when tapped
actionsNotificationAction[]0–3 items
typestringالزامیone of
open,calllabelstringالزامیurlstringالزامیmethodstringone of
POST,PUT,GETbodystring
atstring (date-time)deliver at this time instead of now (10 seconds to 72 hours ahead)
delay_sintegeror deliver this many seconds from now
پاسخ
202object
idstringtopicstringenvironmentstringatstring (date-time)scheduledbooleanacceptedbooleanthe edge that holds the topic took it; not a promise that a device received it
خطاها
| وضعیت | توضیح |
|---|---|
| 400 | Bad request: bad_message, bad_delay, bad_environment, bad_json |
| 401 | unauthorized: missing, invalid, expired or revoked credential |
| 403 | Not allowed: forbidden |
| 404 | Not found: not_found |
| 413 | Too large: message_too_large, too_large |
| 429 | Too many: rate_limited |
| 500 | internal: an unexpected failure |
| 503 | Unavailable: notifications_unavailable |
نمونه
curl -X POST "https://api.ibel.ai/v1/projects/my-api/notifications/topics/topic/messages" \
-H "Authorization: Bearer $KEY" \
-d '{"text":"…"}'/v1/projects/{project}/notifications/topics/{topic}/tokensThe topic's subscribe tokens#
The tokens made for the topic (by this API, the dashboard, the CLI or the tools) and not expired, newest first, revoked ones marked. Tokens a function signs itself with NOTIFICATIONS_KEY are not here; rotating that secret ends them.
- دسترسی
- کلید API یا نشست داشبورد
- نقشها
- همهٔ نقشها
پارامترها
anytopicstringمسیرالزامیthe topic's name (any case) or id (
nt_…)environmentstringکوئریone environment's tokens only: production, development or
preview-<branch>; left out, every environment'sanyany
پاسخ
200object
topicstringtokensNotificationToken[]jtistringالزامیthe token's id, 16 hex digits
environmentstringالزامیexpires_atstring (date-time)الزامیcreated_atstring (date-time)الزامیcreated_bystringrevokedbooleanالزامیrevoked_atstring (date-time)
next_cursorstring
خطاها
| وضعیت | توضیح |
|---|---|
| 400 | Bad request: bad_param, bad_cursor, bad_environment |
| 401 | unauthorized: missing, invalid, expired or revoked credential |
| 404 | Not found: not_found |
| 500 | internal: an unexpected failure |
نمونه
curl "https://api.ibel.ai/v1/projects/my-api/notifications/topics/topic/tokens" \
-H "Authorization: Bearer $KEY"/v1/projects/{project}/notifications/topics/{topic}/tokensA subscribe token#
A device's right to subscribe to the topic in the environment asked for, until expires_at: the token, the server and the device's topic to enter in the notifications app, and link, which a QR code carries. Signed with the project's NOTIFICATIONS_KEY (in its secrets, one value per environment), so a function can make the same tokens itself; rotating that secret ends every token signed before. jti names this token to revoke it (DELETE …/tokens/{jti}).
- دسترسی
- کلید API یا نشست داشبورد
- نقشها
- مالک، ادمین، توسعهدهنده
پارامترها
anytopicstringمسیرالزامیthe topic's name (any case) or id (
nt_…)anyالزامی
بدنهٔ درخواستapplication/json
ttl_sintegerhow long the token works, 60 seconds to the plan's
token_max_s(defaulttoken_default_s, an hour)
پاسخ
201NotificationSubscribe
serverstringالزامیdevice_topicstringالزامیthe topic's name for devices (never its name in the project)
tokenstringالزامی<payload>.<signature>, base64url: the payload is the JSON{topics, exp, kid, jti}(the device topics, when it ends in Unix seconds, the key it is signed with, its own id); the signature is HMAC-SHA256 with the key over the payload's bytesexpires_atstring (date-time)الزامیlinkstringالزامیwhat the QR code carries; the app adds the topic from it
jtistringthe token's id, to revoke it
topicstringenvironmentstringkey_secretstring
خطاها
| وضعیت | توضیح |
|---|---|
| 400 | Bad request: bad_ttl, bad_environment, bad_json |
| 401 | unauthorized: missing, invalid, expired or revoked credential |
| 403 | Not allowed: forbidden |
| 404 | Not found: not_found |
| 500 | internal: an unexpected failure |
| 503 | Unavailable: unavailable |
نمونه
curl -X POST "https://api.ibel.ai/v1/projects/my-api/notifications/topics/topic/tokens" \
-H "Authorization: Bearer $KEY" \
-d '{"ttl_s":1}'/v1/projects/{project}/notifications/topics/{topic}/tokensRevoke every token of the topic#
Revokes every token of the topic that is not expired (every environment's, or one environment's with environment): devices on them are refused from the next minute and their open connections end; a device subscribes again with a new token. A session needs a step-up.
- دسترسی
- کلید API یا نشست داشبورد
- نقشها
- مالک، ادمین، توسعهدهنده
- تایید دوم
- با نشست داشبورد، عامل دوم در ۱۰ دقیقهٔ اخیر لازم است؛ کلید API نیازی ندارد.
پارامترها
anytopicstringمسیرالزامیthe topic's name (any case) or id (
nt_…)environmentstringکوئریone environment's tokens only: production, development or
preview-<branch>; left out, every environment's
پاسخ
200object
topicstringenvironmentstringthe environment asked for; null for every environment
revokedintegerhow many tokens were revoked now
خطاها
| وضعیت | توضیح |
|---|---|
| 400 | Bad request: bad_environment |
| 401 | unauthorized: missing, invalid, expired or revoked credential |
| 403 | Not allowed: forbidden, step_up_required |
| 404 | Not found: not_found |
| 500 | internal: an unexpected failure |
نمونه
curl -X DELETE "https://api.ibel.ai/v1/projects/my-api/notifications/topics/topic/tokens" \
-H "Authorization: Bearer $KEY"/v1/projects/{project}/notifications/topics/{topic}/tokens/{jti}Revoke a subscribe token#
Revokes one token of the topic, by its jti: devices on it are refused from the next minute, until it would have expired, and their open connections end. Revoking it again gives the same answer. A session needs a step-up.
- دسترسی
- کلید API یا نشست داشبورد
- نقشها
- مالک، ادمین، توسعهدهنده
- تایید دوم
- با نشست داشبورد، عامل دوم در ۱۰ دقیقهٔ اخیر لازم است؛ کلید API نیازی ندارد.
پارامترها
anytopicstringمسیرالزامیthe topic's name (any case) or id (
nt_…)jtistringمسیرالزامیthe token's id (16 hex digits), as
jtiin its payload and in the answer that made it
پاسخ
200object
topicstringjtistringrevokedboolean
خطاها
| وضعیت | توضیح |
|---|---|
| 401 | unauthorized: missing, invalid, expired or revoked credential |
| 403 | Not allowed: forbidden, step_up_required |
| 404 | Not found: not_found (no such token, or it has expired) |
| 500 | internal: an unexpected failure |
نمونه
curl -X DELETE "https://api.ibel.ai/v1/projects/my-api/notifications/topics/topic/tokens/jti" \
-H "Authorization: Bearer $KEY"/v1/projects/{project}/notifications/topics/{topic}/usageA topic's usage#
Messages published and deliveries per day, the topic's and its environments' own.
- دسترسی
- کلید API یا نشست داشبورد
- نقشها
- همهٔ نقشها
پارامترها
anytopicstringمسیرالزامیthe topic's name (any case) or id (
nt_…)daysintegerکوئریhow many days back: 1 to 90 (default 30)
پاسخ
200NotificationUsage
daysintegerfromstring (date-time)tostring (date-time)publishedintegerdeliveredintegerper_dayobject[]daystringpublishedintegerdeliveredinteger
metersobject[]list_rialsintegerpricedbooleanfalse until the owner sets the meters' prices
خطاها
| وضعیت | توضیح |
|---|---|
| 400 | Bad request: bad_param |
| 401 | unauthorized: missing, invalid, expired or revoked credential |
| 404 | Not found: not_found |
| 500 | internal: an unexpected failure |
نمونه
curl "https://api.ibel.ai/v1/projects/my-api/notifications/topics/topic/usage" \
-H "Authorization: Bearer $KEY"/v1/projects/{project}/notifications/usageA project's notifications usage#
Messages published and deliveries per day, every topic of the project.
- دسترسی
- کلید API یا نشست داشبورد
- نقشها
- همهٔ نقشها
پارامترها
anydaysintegerکوئریhow many days back: 1 to 90 (default 30)
پاسخ
200NotificationUsage
daysintegerfromstring (date-time)tostring (date-time)publishedintegerdeliveredintegerper_dayobject[]daystringpublishedintegerdeliveredinteger
metersobject[]list_rialsintegerpricedbooleanfalse until the owner sets the meters' prices
خطاها
| وضعیت | توضیح |
|---|---|
| 400 | Bad request: bad_param |
| 401 | unauthorized: missing, invalid, expired or revoked credential |
| 404 | Not found: not_found |
| 500 | internal: an unexpected failure |
نمونه
curl "https://api.ibel.ai/v1/projects/my-api/notifications/usage" \
-H "Authorization: Bearer $KEY"/v1/projects/{project}/notifications/settingsA project's notifications settings#
The secret that signs its devices' tokens (key.secret, in each environment of the project's secrets), how many topics it has, the server and the plan's limits.
- دسترسی
- کلید API یا نشست داشبورد
- نقشها
- همهٔ نقشها
پارامترها
any
پاسخ
200object
projectobjectidstringnamestring
availablebooleanserverstringtopicsintegerkeyobjectsecretstringenvironmentsstring[]token_formatstring
limitsNotificationLimitstopicsintegermessage_bytesintegertitle_charsintegertagsintegertag_charsintegeractionsintegerlabel_charsintegerurl_charsintegermin_delay_sintegermax_delay_sintegerkeep_hoursintegertoken_default_sintegertoken_max_sintegerrecentintegertopics_usedinteger
خطاها
| وضعیت | توضیح |
|---|---|
| 401 | unauthorized: missing, invalid, expired or revoked credential |
| 404 | Not found: not_found |
| 500 | internal: an unexpected failure |
نمونه
curl "https://api.ibel.ai/v1/projects/my-api/notifications/settings" \
-H "Authorization: Bearer $KEY"