Callbacks
Bnotify API can send you information when a specific user subscribes or unsubscribes from a channel.
All need to do is set a callback URL in your channel.
Below, you can see the request sent by Bnotify API to your callback URL.
Ensure you allow https://bnotify.io to access your endpoint (CORS, IP, etc.). Otherwise, the call will be refused.
Note that we also send an Authorization header with the request. We highly recommend verifying that header to check if the callback originated from Bnotify. You can obtain the channel auth header from the channel information. We also recommend API rate limiting for extra security.
Bnotify Callback
When a user subscribe a notification channel.
https://your-callback-url
- Name
- Description
Authorization
string
- Channel auth header e.g. "Basic your-channel-auth-header"
- Property
- Description
type
string
required
Type of callback, can be "subscription" or "unsubcription"
message
string
required
The message text that we sent.
channelId
string
required
Your channel id, from where the callback is related to.
iuid
string
required
Your interal user id, from where the callback is related to.
date
number
required
POSIX time when the callback was triggered.
{
"type": "subscription",
"message": "Channel subscription.",
"channelId": "...59f5326c1",
"iuid": "your-internal-user-id",
"date": 1673984274
}
Check the next section to see how to display the subscription QR Code to your costumers.