Documentation
Channels

Channels

A Channel consist of connections.

A connection is combination of a provider and a template.

You send notification payload to a channel and the payload is sent to all the connections in the channel to send notifications.

Channels

Sending Notification

To send a notification, create a channel, copy the channel id and make a POST request to the following endpoint: https://app.baba.tools/api/notification-channels/notify.

The payload structure required when calling this endpoint is.

{
  "channelId": "<YOUR_CHANNEL_ID>",
  "data": {
    <YOUR_DATA>
  }
}

The payload you send to this endpoint is available in the template as .data variable.

For example, if you send { name: { "first": "John Doe" } } in the payload. You can access it in the template as {{ .data.name.first }}.

Steps

  1. Copy the channel id.

Channel Id

  1. To send a notification, you have to make a POST request to the following endpoint: https://app.baba.tools/api/notification-channels/notify.
curl
curl --location --request POST 'https://app.baba.tools/api/notification-channels/notify' \
        --header 'Content-Type: application/json' \
        --header 'Authorization: Bearer <YOUR_API_KEY>' \
        --data '{
        "channelId": "<YOUR_CHANNEL_ID>",
        "data": {
            "from": "<FROM_EMAIL>",
            "user": {
                "name": "John Doe",
                "email": "[email protected]"
            }
        }
    }'
Javascript/Node
import axios from "axios";
 
const channelId = "<YOUR_CHANNEL_ID>";
const apiKey = "<YOUR_API_KEY>";
const payload = {
  from: "<FROM_EMAIL>",
  user: {
    name: "John Doe",
    email: "[email protected]",
  },
};
 
axios.post(
  "https://app.baba.tools/api/notification-channels/notify",
  {
    channelId: channelId,
    data: payload,
  },
  {
    headers: {
      Authorization: `Bearer ${apiKey}`,
    },
  }
);