Prerequisites

To follow this guide with the API, you’ll need to:
  • Go to Bodhveda Console.
  • Create a new project.
  • Click on API Keys in the sidebar.
  • Click on Create API Key and generate an API key with Full access scope.

Send direct notification with API

Use the send notification API to send a direct notification to a recipient. If the recipient doesn’t exist, Bodhveda creates it automatically when sending a direct notification.
curl -X POST https://api.bodhveda.com/notifications/send \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "to": { "recipient_id": "recipient_123" },
    "payload": { "title": "Welcome!", "message": "Thanks for joining." }
  }'
Then you can use the list recipient’s notifications API and you will see the notification you just sent earlier.
curl -X GET "https://api.bodhveda.com/recipients/recipient_123/notifications" \
  -H "Authorization: Bearer YOUR_API_KEY"
[
    {
        "id": 42069,
        "recipient_id": "recipient_123",
        "payload": {
            "title": "Welcome!",
            "message": "Thanks for joining."
        }
        // ... other fields.
    }
]

Send broadcast notification with API

Broadcast to multiple recipients. This requires some setup:
Create a recipient
Use create recipient API to create a recipient in your project.
curl -X POST https://api.bodhveda.com/recipients \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"recipient_id": "user@example.com", "name": "Jane Doe"}'
Create a project preference
Before broadcasting, you must add at least one project preference to define a target (channel, topic, event):
  1. Go to Bodhveda Console.
  2. Click on Preferences in the sidebar.
  3. Click on Create Preference.
  4. Define a target by mentioning the channel, topic, and event, give it a label, and set default to enabled.
  5. Save the preference.
This way all recipients are by default subscribed to this target in your project.
Send broadcast notification
Use the send notification API to send a broadcast notification to a target that was used to create the project preference.
curl -X POST https://api.bodhveda.com/notifications/send \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "to": { "channel": "announcements", "topic": "product", "event": "new_feature" },
    "payload": { "title": "Big News!", "message": "We just launched a new feature." }
  }'
No recipient_id makes this notification turn into a broadcast. All recipients subscribed to this target will receive this notification.

Send notification from Console

You can also send notifications from the Bodhveda Console:
  1. Go to Notifications tab.
  2. Click on Send Notification to send a direct notification to a recipient or a broadcast to subscribed recipients.
Next Steps