Sending Notifications

Base URL: notifications.dreaminfluence.io

Endpoint: POST /notify

Description: Sends a batch of notifications, either emails or push notifications, to specified users.

Authorization Required

Required headers

  • Content-Type: application/json

  • Authorization: YOUR_API_KEY_HERE

Request Body Schema

The request body should be an array of notification requests, each including the user type, user ID, and the content of notifications:

Types

enum NotificationService {
    email = "email",
    push = "push"
}

interface NotificationContentMail {
    service: NotificationService.email;
    text?: string;
    html?: string;
    subject?: string;
    template?: string;

    from?: {
        name: string;
        email: string;
    };
}
interface NotificationContentPush {
    service: NotificationService.push;
    title: string;
    text: string;
    data?: object;
    sound?: "default" | string;
}
enum NotificationUserType {
    company = "company",
    influencer = "influencer"
}
interface NotificationRequest {
    userType: NotificationUserType;
    userID: number;

    content: Array<NotificationContentMail | NotificationContentPush>;

    variables?: object;
}
interface NotificationResponse {
    success: boolean;
    message: string;
}

We expect the body matching NotificationRequest[] for example sending a email and push notifcation to an influencer would look like:

[
    {
        "userID": 16981,
        "userType": "influencer",
        "content": [
            {
                "service": "email",
                "template": "d-267f6e9ceb714f51b51ae0011227325d"
            },
            {
                "service": "push",
                "title": "%platform% review results",
                "text": "Open the app to see your results of your @%account_handle% %platform%"
            }
        ],
        "variables": {
            "platform": "Instagram",
            "account_handle": "Hundeklemmen"
        }
    }
]

Last updated