Prerequisite You need to have made an account on Dingify and have your API key ready.

Create a channel

Channels are containers for events. Use one for payments, another for logins, etc.

On the Dashboard you can click create new channel and name it new-payment

Pro-tip: Keep your channel name simple

Install SDK

To get the most out of this guide, you’ll need to:

1. Install

Get your Dingify SDK.

pnpm i dingify

2. Send your first notification

Get your Dingify SDK.

page.tsx
import { Dingify } from "dingify";

const dingify = new Dingify({
    apiKey: "<YOUR_API_KEY_HERE>",
});

async function run() {
    const result = await dingify.events.create({
        name: "You got a new payment",
        channel: "new-channel-name",
        icon: "🎉",
        notify: true,
        tags: {
            plan: "premium",
            cycle: "monthly",
        },
    });

    // Handle the result
    console.log(result);
}

Try it yourself

Now that you have everything, you can track your first event. You can do this by making a POST request to the API or by using the SDK.

curl -X POST https://api.dingify.workers.dev/api/events \
-H "Content-Type: application/json" \
-H "x-api-key: <API-KEY>" \
-d '{
  "channel": "new-channel-namex",
  "name": "New-payment",
  "event": "New-payment",
  "user_id": "user-222",
  "icon": "🤩",
  "notify": true,
  "tags": {
    "plan": "premium",
    "cycle": "monthly"
  }
}'

After making the request you will see the event tracked at Dingify dashboard. It will be under the channel you created.