### Install Notifo Node Library Source: https://github.com/notifo-io/notifo/blob/main/tools/sdk-ts/README.md Instructions for installing the Notifo Node.js library using npm or yarn package managers. ```bash npm install @notifo/notifo # or yarn add @notifo/notifo ``` -------------------------------- ### JSON Configuration Example Source: https://github.com/notifo-io/notifo/wiki/Configuration Example of a JSON configuration snippet for the asset store folder path. This demonstrates how nested settings are structured in the appsettings.json file. ```json { "assetStore": { "folder": { "path": "MyAssets" } } } ``` -------------------------------- ### Configuration Example: MongoDB Settings Source: https://github.com/notifo-io/notifo/blob/main/README.md This JSON snippet shows an example of MongoDB configuration settings for Notifo. It specifies the connection string to the MongoDB instance. This configuration can be managed via environment variables, where `MONGODB__CONNECTIONSTRING` maps to the `mongoDB.connectionString` setting. ```json { "mongoDB": { "connectionString": "mongodb://localhost" } } ``` -------------------------------- ### Log Entry Example for Failed Admin Creation Source: https://github.com/notifo-io/notifo/wiki/Configuration An example log entry showing an 'Error' level log for the 'createAdmin' action, indicating a failure. This often occurs due to issues with the admin password. ```json { "logLevel": "Error", "action": "createAdmin", "status": "failed", "exception": { ... "message": "Cannot create user:...", ... } } ``` -------------------------------- ### Query Events and Notifications Source: https://context7.com/notifo-io/notifo/llms.txt Provides examples for retrieving event logs for debugging and fetching user-specific notifications to track delivery status. ```bash curl -X GET "https://app.notifo.io/api/apps/{appId}/events/?query=order&take=50" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" curl -X GET "https://app.notifo.io/api/apps/{appId}/notifications?take=100" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" curl -X GET "https://app.notifo.io/api/apps/{appId}/users/user-123/notifications?take=50&channel=email" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" ``` -------------------------------- ### Docker Compose for Notifo Deployment Source: https://github.com/notifo-io/notifo/blob/main/README.md This Docker Compose file demonstrates how to deploy Notifo using Docker images. It outlines the necessary services and configurations for running Notifo in a containerized environment. Ensure Docker is installed and configured on your system. ```yaml version: "3.7" services: notifo: image: squidex/notifo ports: - "8080:80" environment: - "sqids__my_secret=a_very_secret_key" - "mongoDB__connectionString=mongodb://mongo:27017" depends_on: - mongo mongo: image: mongo volumes: - mongo-data:/data/db volumes: mongo-data: ``` -------------------------------- ### GET /api/apps/{appId} Source: https://context7.com/notifo-io/notifo/llms.txt Retrieves detailed configuration, API keys, and contributor information for a specific app. ```APIDOC ## GET /api/apps/{appId} ### Description Retrieve complete information about an app including its configuration, API keys, and contributors. ### Method GET ### Endpoint https://app.notifo.io/api/apps/{appId} ### Parameters #### Path Parameters - **appId** (string) - Required - The unique identifier of the app ### Response #### Success Response (200) - **id** (string) - App ID - **name** (string) - App name - **apiKeys** (object) - Map of API keys - **contributors** (array) - List of users with access #### Response Example { "id": "abc123", "name": "My E-commerce App", "apiKeys": { "default": "app-api-key-xxx" } } ``` -------------------------------- ### GET /users Source: https://github.com/notifo-io/notifo/blob/main/tools/TestSuite/TestSuite.ApiTests/Verify/UsersTests.Should_find_user_mode=ClientId.verified.txt Retrieves a list of users registered in the Notifo system. ```APIDOC ## GET /users ### Description Retrieves a paginated list of users with their associated preferences and configuration settings. ### Method GET ### Endpoint /users ### Parameters None ### Request Example GET /users ### Response #### Success Response (200) - **Items** (array) - List of user objects - **Total** (integer) - Total count of users #### Response Example { "Items": [ { "Id": "Guid_1", "FullName": "Guid_1", "PreferredLanguage": "en", "PreferredTimezone": "UTC", "RequiresWhitelistedTopics": false } ], "Total": 1 } ``` -------------------------------- ### Docker Deployment Configuration for Notifo Source: https://context7.com/notifo-io/notifo/llms.txt Deploy Notifo using Docker Compose by defining services, ports, environment variables for configuration, volumes for persistent storage, and service dependencies. This setup allows for flexible configuration of MongoDB, admin credentials, SignalR, messaging backends, and asset storage. ```yaml # docker-compose.yml version: '3.8' services: notifo: image: squidex/notifo:1 ports: - "5002:5002" environment: # Required: Base URL for redirects and links - URLS__BASEURL=https://notifications.myapp.com # MongoDB connection - STORAGE__MONGODB__CONNECTIONSTRING=mongodb://mongo:27017 - STORAGE__MONGODB__DATABASENAME=Notifications # Admin credentials (or use setup screen) - IDENTITY__ADMINEMAIL=admin@myapp.com - IDENTITY__ADMINPASSWORD=SecurePassword123! # Disable external OAuth providers (optional) - IDENTITY__GOOGLECLIENT= - IDENTITY__GITHUBCLIENT= # SignalR configuration - WEB__SIGNALR__ENABLED=true - WEB__SIGNALR__STICKY=true # Redis for multi-instance scaling (optional) # - CLUSTERING__TYPE=Redis # - CLUSTERING__REDIS__CONNECTIONSTRING=redis:6379 # Messaging backend - MESSAGING__TYPE=Scheduler # For production, use RabbitMQ or Kafka: # - MESSAGING__TYPE=RabbitMq # - MESSAGING__RABBITMQ__URI=amqp://guest:guest@rabbitmq/ # Asset storage - ASSETSTORE__TYPE=Folder - ASSETSTORE__FOLDER__PATH=/app/Assets # For production, use S3 or Azure Blob: # - ASSETSTORE__TYPE=AmazonS3 # - ASSETSTORE__AMAZONS3__BUCKET=notifo-assets # - ASSETSTORE__AMAZONS3__ACCESSKEY=xxx # - ASSETSTORE__AMAZONS3__SECRETKEY=xxx volumes: - notifo-assets:/app/Assets depends_on: - mongo mongo: image: mongo:6 volumes: - mongo-data:/data/db volumes: notifo-assets: mongo-data: ``` -------------------------------- ### Get All Notifications for an App Source: https://context7.com/notifo-io/notifo/llms.txt Retrieve all notifications for a given application. ```APIDOC ## GET /api/apps/{appId}/notifications ### Description Retrieve all notifications for a given application. Supports pagination. ### Method GET ### Endpoint /api/apps/{appId}/notifications ### Parameters #### Query Parameters - **take** (integer) - Optional - The maximum number of notifications to return. ### Request Example ```bash curl -X GET "https://app.notifo.io/api/apps/{appId}/notifications?take=100" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" ``` ### Response #### Success Response (200) - (Response body structure not detailed in the source text, but expected to contain a list of notifications.) #### Response Example (No specific response example provided in the source text.) ``` -------------------------------- ### Get Registered Mobile Push Tokens (API) Source: https://context7.com/notifo-io/notifo/llms.txt Retrieves a list of all registered mobile push tokens for the authenticated user. Requires user API key for authentication. ```bash curl -X GET "https://app.notifo.io/api/me/mobilepush" \ -H "Authorization: Bearer USER_API_KEY" ``` -------------------------------- ### GET /mjml/components/social Source: https://github.com/notifo-io/notifo/blob/main/backend/tests/Notifo.Domain.Tests/Channels/Email/MjmlSchemaTests.Should_build_schema_as_json.verified.txt Retrieves the schema definition for the mj-social component, detailing layout modes and styling attributes. ```APIDOC ## GET /mjml/components/social ### Description Returns the attribute schema for the mj-social component, used for rendering social media icons and links. ### Method GET ### Endpoint /mjml/components/social ### Parameters None ### Response #### Success Response (200) - **mode** (array) - Allowed values: [vertical, horizontal] - **table-layout** (array) - Allowed values: [auto, fixed] - **children** (array) - Allowed child components: [mj-raw, mj-social-element] #### Response Example { "mode": ["vertical", "horizontal"], "children": ["mj-raw", "mj-social-element"] } ``` -------------------------------- ### GET /mjml/components/navbar Source: https://github.com/notifo-io/notifo/blob/main/backend/tests/Notifo.Domain.Tests/Channels/Email/MjmlSchemaTests.Should_build_schema_as_json.verified.txt Retrieves the schema definition for the mj-navbar component, including its alignment and icon configuration attributes. ```APIDOC ## GET /mjml/components/navbar ### Description Returns the attribute schema for the mj-navbar component, which is used to create navigation bars in emails. ### Method GET ### Endpoint /mjml/components/navbar ### Parameters None ### Response #### Success Response (200) - **align** (array) - Allowed values: [left, center, right] - **ico-align** (array) - Allowed values: [left, center, right] - **children** (array) - Allowed child components: [mj-navbar-link, mj-raw] #### Response Example { "align": ["left", "center", "right"], "children": ["mj-navbar-link", "mj-raw"] } ``` -------------------------------- ### Get User Notifications (API) Source: https://context7.com/notifo-io/notifo/llms.txt Retrieves a list of notifications for the authenticated user. It supports pagination via the 'take' parameter. Requires user API key for authentication. ```bash curl -X GET "https://app.notifo.io/api/me/notifications?take=20" \ -H "Authorization: Bearer USER_API_KEY" ``` -------------------------------- ### GET /api/apps/{appId}/logs Source: https://context7.com/notifo-io/notifo/llms.txt Retrieves diagnostic logs for a specific application to assist in troubleshooting and monitoring. ```APIDOC ## GET /api/apps/{appId}/logs ### Description Fetches diagnostic logs for the specified application to monitor events and errors. ### Method GET ### Endpoint https://app.notifo.io/api/apps/{appId}/logs ### Parameters #### Path Parameters - **appId** (string) - Required - The unique identifier of the application. #### Query Parameters - **take** (integer) - Optional - Number of log entries to retrieve. ### Response #### Success Response (200) - **items** (array) - List of log entries. - **total** (integer) - Total count of logs available. #### Response Example { "items": [ { "message": "Email sent to john@example.com", "timestamp": "2024-01-15T10:30:00Z", "eventCode": "NotificationSent", "userId": "user-123" } ], "total": 100 } ``` -------------------------------- ### Get Archived User Notifications (API) Source: https://context7.com/notifo-io/notifo/llms.txt Retrieves a list of archived notifications for the authenticated user. Requires user API key for authentication. ```bash curl -X GET "https://app.notifo.io/api/me/notifications/archive" \ -H "Authorization: Bearer USER_API_KEY" ``` -------------------------------- ### Initialize Notifo Client and Publish Events Source: https://github.com/notifo-io/notifo/blob/main/tools/sdk-ts/README.md Demonstrates how to initialize the NotifoClient with credentials and publish events using the client. It shows options for token storage, including in-memory and local storage. ```typescript import { NotifoClient, NotifoInMemoryTokenStore, NotifoStorageTokenStore } from "@notifo/notifo"; const client = new NotifoClient({ clientId: "client-id", clientSecret: "client-secret", apiKey: "my-key", // url: "https://your.notifo-deployment", // tokenStore: new NotifoInMemoryTokenStore(), // tokenStore: new NotifoStorageTokenStore() // Keep the tokens in the local store. // tokenStore: new NotifoStorageTokenStore(sessionStorage, "CustomKey") }); const response = await client.events.publishEvents({...}); ``` -------------------------------- ### Initialize Notifo SDK Source: https://github.com/notifo-io/notifo/wiki/Web-Plugin Initializes the Notifo SDK with a user-specific API key. This step is crucial for authenticating users and ensuring they receive their own messages. An alternative is to use a WebManager API Key to automatically create new users. ```html ``` -------------------------------- ### Get User Notifications Source: https://context7.com/notifo-io/notifo/llms.txt Retrieve notifications for a specific user, optionally filtered by channel. ```APIDOC ## GET /api/apps/{appId}/users/{userId}/notifications ### Description Retrieve notifications for a specific user, optionally filtered by channel. Supports pagination. ### Method GET ### Endpoint /api/apps/{appId}/users/{userId}/notifications ### Parameters #### Path Parameters - **userId** (string) - Required - The ID of the user. #### Query Parameters - **take** (integer) - Optional - The maximum number of notifications to return. - **channel** (string) - Optional - Filter notifications by channel (e.g., "email"). ### Request Example ```bash curl -X GET "https://app.notifo.io/api/apps/{appId}/users/user-123/notifications?take=50&channel=email" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" ``` ### Response #### Success Response (200) - (Response body structure not detailed in the source text, but expected to contain a list of notifications for the specified user.) #### Response Example (No specific response example provided in the source text.) ``` -------------------------------- ### Combined Notifo Web Plugin Integration Source: https://github.com/notifo-io/notifo/wiki/Web-Plugin Demonstrates a complete integration of the Notifo web plugin, including SDK initialization, subscribing to notifications, and displaying both the notification and topic subscription widgets. ```html
``` -------------------------------- ### GET /api/apps/{appId}/users Source: https://context7.com/notifo-io/notifo/llms.txt Retrieve user details or query a list of users with pagination support. ```APIDOC ## GET /api/apps/{appId}/users/{userId} ### Description Fetch details for a specific user. ### Method GET ### Endpoint /api/apps/{appId}/users/{userId} ### Parameters #### Path Parameters - **appId** (string) - Required - The unique identifier of the application. - **userId** (string) - Required - The unique identifier of the user. #### Query Parameters - **withDetails** (boolean) - Optional - Include additional user details. ### Response #### Success Response (200) - **id** (string) - User ID - **fullName** (string) - User full name - **emailAddress** (string) - User email ### Response Example { "id": "user-123", "fullName": "John Doe", "emailAddress": "john@example.com" } ``` -------------------------------- ### Include Notifo SDK Script Source: https://github.com/notifo-io/notifo/wiki/Web-Plugin References the Notifo SDK JavaScript file and initializes the global 'notifo' object. This is the first step to integrate the SDK into your website. ```html ``` -------------------------------- ### Retrieve Notifo App Details Source: https://context7.com/notifo-io/notifo/llms.txt Fetches configuration details, API keys, and contributor information for a specific application using its unique ID. ```bash curl -X GET "https://app.notifo.io/api/apps/{appId}" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" ``` -------------------------------- ### Command Line Argument Configuration Source: https://github.com/notifo-io/notifo/wiki/Configuration Illustrates how to set the asset store folder path using command line arguments. This format aggregates keys from the JSON structure using colons. ```bash assetstore:folder:path="MyAssets" ``` -------------------------------- ### POST /api/apps/ Source: https://context7.com/notifo-io/notifo/llms.txt Creates a new notification project (app) in Notifo to manage users, topics, and templates. ```APIDOC ## POST /api/apps/ ### Description Creates a new app to start managing notifications for your application. ### Method POST ### Endpoint https://app.notifo.io/api/apps/ ### Request Body - **name** (string) - Required - The name of the app - **languages** (array) - Required - Supported languages - **confirmUrl** (string) - Optional - URL for delivery confirmation ### Request Example { "name": "My E-commerce App", "languages": ["en", "de", "fr"], "confirmUrl": "https://myapp.com/notifications/confirm" } ### Response #### Success Response (200) - **id** (string) - The unique ID of the created app - **apiKeys** (object) - Generated API keys for the app #### Response Example { "id": "abc123", "name": "My E-commerce App", "languages": ["en", "de", "fr"], "apiKeys": { "default": "app-api-key-xxx" }, "role": "Owner" } ``` -------------------------------- ### Create a new Notifo App Source: https://context7.com/notifo-io/notifo/llms.txt Creates a new isolated notification project within Notifo. Requires an access token and defines basic app settings like name, supported languages, and confirmation URL. ```bash curl -X POST "https://app.notifo.io/api/apps/" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "name": "My E-commerce App", "languages": ["en", "de", "fr"], "confirmUrl": "https://myapp.com/notifications/confirm" }' ``` -------------------------------- ### Initialize Notifo Client (TypeScript/Node.js SDK) Source: https://context7.com/notifo-io/notifo/llms.txt Initializes the Notifo client with API key or OAuth2 credentials. Optionally, a custom API URL and token store can be provided. This client is used to interact with the Notifo API. ```typescript import { NotifoClient, NotifoInMemoryTokenStore } from "@notifo/notifo"; // Initialize the client const client = new NotifoClient({ apiKey: "your-app-api-key", // Or use OAuth2 credentials: // clientId: "your-client-id", // clientSecret: "your-client-secret", // url: "https://your.notifo-deployment", // Optional custom URL // tokenStore: new NotifoInMemoryTokenStore() // Optional token storage }); ``` -------------------------------- ### Configure Email Templates with MJML and Liquid Syntax Source: https://context7.com/notifo-io/notifo/llms.txt Create and manage responsive email templates using MJML, which supports Liquid syntax for dynamic content personalization. This involves using cURL commands to create new templates with HTML and text bodies, subjects, and then previewing them. ```bash # Create an email template curl -X POST "https://app.notifo.io/api/apps/{appId}/email-templates/" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "language": "en", "name": "order-email-template", "bodyHtml": "Hello {{user.fullName}},{{notification.body}}{{notification.linkText}}", "bodyText": "Hello {{user.fullName}}, {{notification.body}} - {{notification.linkUrl}}", "subject": "{{notification.subject}}" }' # Preview an email template curl -X POST "https://app.notifo.io/api/apps/{appId}/email-templates/render" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "template": "order-email-template", "type": "Html" }' ``` -------------------------------- ### MJML Component Attributes Reference Source: https://github.com/notifo-io/notifo/blob/main/backend/tests/Notifo.Domain.Tests/Channels/Email/MjmlSchemaTests.Should_build_schema_as_json.verified.txt This section details the attributes available for various MJML components. These attributes control the styling and behavior of email elements. For example, 'text-align' can be set to 'left', 'right', 'center', or 'justify'. ```json { "mj-navbar": { "attrs": { "align": [ "left", "center", "right" ], "base-url": null, "hamburger": null, "ico-align": [ "left", "center", "right" ], "ico-close": null, "ico-color": null, "ico-font-family": null, "ico-font-size": null, "ico-line-height": null, "ico-open": null, "ico-padding": null, "ico-padding-bottom": null, "ico-padding-left": null, "ico-padding-right": null, "ico-padding-top": null, "ico-text-decoration": null, "ico-text-transform": null, "padding": null, "padding-bottom": null, "padding-left": null, "padding-right": null, "padding-top": null, "css-class": null }, "children": [ "mj-navbar-link", "mj-raw" ] }, "mj-navbar-link": { "attrs": { "color": null, "font-family": null, "font-size": null, "font-style": null, "font-weight": null, "href": null, "letter-spacing": null, "line-height": null, "name": null, "navbar-base-url": null, "padding": null, "padding-bottom": null, "padding-left": null, "padding-right": null, "padding-top": null, "rel": null, "target": null, "text-decoration": null, "text-transform": null, "css-class": null }, "children": null }, "mj-preview": { "attrs": {}, "children": null }, "mj-raw": { "attrs": { "css-class": null }, "children": null }, "mjml": { "attrs": { "dir": null, "lang": null }, "children": [ "mj-body", "mj-head", "mj-raw" ] }, "mj-section": { "attrs": { "background-color": null, "background-position": null, "background-position-x": null, "background-position-y": null, "background-repeat": null, "background-size": null, "background-url": null, "border": null, "border-bottom": null, "border-left": null, "border-radius": null, "border-right": null, "border-top": null, "direction": null, "full-width": null, "padding": null, "padding-bottom": null, "padding-left": null, "padding-right": null, "padding-top": null, "text-align": [ "left", "right", "center", "justify" ], "text-padding": null, "css-class": null }, "children": [ "mj-column", "mj-group", "mj-raw" ] }, "mj-social": { "attrs": { "align": [ "left", "center", "right" ], "border-radius": null, "color": null, "container-background-color": null, "font-family": null, "font-size": null, "font-style": null, "font-weight": null, "icon-height": null, "icon-padding": null, "icon-size": null, "inner-padding": null, "line-height": null, "mode": [ "vertical", "horizontal" ], "padding": null, "padding-bottom": null, "padding-left": null, "padding-right": null, "padding-top": null, "table-layout": [ "auto", "fixed" ], "text-decoration": null, "text-padding": null, "vertical-align": [ "top", "middle", "bottom" ], "css-class": null }, "children": [ "mj-raw", "mj-social-element" ] }, "mj-social-element": { "attrs": { "align": [ "left", "center", "right" ], "alt": null, "background-color": null, "border-radius": null, "color": null, "font-family": null, "font-size": null, "font-style": null, "font-weight": null, "href": null, "icon-height": null, "icon-padding": null, "icon-size": null, "line-height": null, "name": null, "padding": null, "padding-bottom": null, "padding-left": null, "padding-right": null, "padding-top": null, "rel": null, "sizes": null, "src": null, "srcset": null, "target": null, "text-decoration": null, "text-padding": null, "title": null, "vertical-align": [ "top", "middle", "bottom" ], "css-class": null }, "children": null }, "mj-spacer": { "attrs": { "border": null } } } ``` -------------------------------- ### Environment Variable Configuration Source: https://github.com/notifo-io/notifo/wiki/Configuration Demonstrates how to set the asset store folder path using environment variables. This format aggregates keys from the JSON structure using double underscores. ```bash ASSETSTORE__FOLDER__PATH="MyAssets" ``` -------------------------------- ### Manage Notification Templates Source: https://context7.com/notifo-io/notifo/llms.txt Create, list, and delete reusable notification templates. Templates support localization and variable injection using double curly braces. ```bash curl -X POST "https://app.notifo.io/api/apps/{appId}/templates/" -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -H "Content-Type: application/json" -d '{"requests": [{"code": "order_shipped", "formatting": {"subject": {"en": "Your order {{properties.orderId}} has shipped!", "de": "Ihre Bestellung {{properties.orderId}} wurde versendet!"}, "body": {"en": "Track your package: {{properties.trackingUrl}}", "de": "Verfolgen Sie Ihr Paket: {{properties.trackingUrl}}"}, "linkUrl": {"en": "{{properties.trackingUrl}}"}, "linkText": {"en": "Track Package", "de": "Paket verfolgen"}, "confirmMode": "Explicit"}, "settings": {"email": {"send": "Send", "template": "order-email-template"}, "mobilepush": {"send": "Send"}}}, {"code": "payment_received", "formatting": {"subject": {"en": "Payment of {{properties.amount}} received"}, "body": {"en": "Thank you for your payment for order #{{properties.orderId}}"}, "confirmMode": "Seen"}}]}' curl -X GET "https://app.notifo.io/api/apps/{appId}/templates/?take=50" -H "Authorization: Bearer YOUR_ACCESS_TOKEN" curl -X DELETE "https://app.notifo.io/api/apps/{appId}/templates/old_template" -H "Authorization: Bearer YOUR_ACCESS_TOKEN" ``` -------------------------------- ### Publish Notification Events via API Source: https://context7.com/notifo-io/notifo/llms.txt Demonstrates how to trigger notifications by publishing events to specific topics. This includes both template-based delivery and inline preformatted content. ```bash curl -X POST "https://app.notifo.io/api/apps/{appId}/events/" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "requests": [ { "topic": "orders/user-123", "templateCode": "order_shipped", "properties": { "orderId": "ORD-12345", "trackingUrl": "https://tracking.example.com/ORD-12345" }, "correlationId": "order-ORD-12345-shipped", "data": "{\"internalRef\": \"abc123\"}" } ] }' curl -X POST "https://app.notifo.io/api/apps/{appId}/events/" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "requests": [ { "topic": "users/user-456", "preformatted": { "subject": { "en": "Welcome to our platform!", "de": "Willkommen auf unserer Plattform!" }, "body": { "en": "Get started by completing your profile.", "de": "Beginnen Sie, indem Sie Ihr Profil vervollstandigen." }, "linkUrl": { "en": "https://myapp.com/profile" }, "linkText": { "en": "Complete Profile" }, "imageSmall": { "en": "https://myapp.com/images/welcome.png" }, "confirmMode": "Seen" }, "settings": { "email": { "send": "Send", "delayInSeconds": 0 }, "webpush": { "send": "Send" } } } ] }' ``` -------------------------------- ### Manage App Integrations Source: https://context7.com/notifo-io/notifo/llms.txt Configures and retrieves delivery channel integrations such as Firebase or Amazon SES. Allows enabling services and setting provider-specific properties. ```bash curl -X POST "https://app.notifo.io/api/apps/{appId}/integration/" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "type": "Firebase", "enabled": true, "properties": { "project": "my-firebase-project", "credentials": "{...firebase-service-account-json...}" } }' curl -X GET "https://app.notifo.io/api/apps/{appId}/integrations" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" ``` -------------------------------- ### Handle OIDC Silent Callback with Notifo.io (JavaScript) Source: https://github.com/notifo-io/notifo/blob/main/backend/src/Notifo/wwwroot/authentication/login-silent-callback.html This snippet demonstrates how to set up logging and handle the silent callback for OIDC authentication using the Notifo.io library. It configures the UserManager with a 'query' response mode and attempts a silent sign-in callback, logging any errors encountered. Ensure the oidc-client-js library is included in your project. ```javascript oidc.Log.setLogger(console); new oidc.UserManager({ response_mode: 'query' }).signinSilentCallback().catch(error => { console.error(error); }); ``` -------------------------------- ### Create Users (TypeScript/Node.js SDK) Source: https://context7.com/notifo-io/notifo/llms.txt Creates new users in the Notifo system for a given application. It accepts an array of user creation requests, each specifying user details like ID, name, email, and preferred settings. Handles potential API errors. ```typescript // Create users const users = await client.users.postUsers("my-app-id", { requests: [ { id: "user-123", fullName: "John Doe", emailAddress: "john@example.com", preferredLanguage: "en", settings: { email: { send: "Send" }, webpush: { send: "Send" } } } ] }); ``` -------------------------------- ### Manage Notification Topics Source: https://context7.com/notifo-io/notifo/llms.txt Define, query, and delete notification topics. Topics act as categories for user subscriptions and support localized names and descriptions. ```bash curl -X POST "https://app.notifo.io/api/apps/{appId}/topics/" -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -H "Content-Type: application/json" -d '{"requests": [{"path": "orders", "name": {"en": "Order Updates", "de": "Bestellaktualisierungen"}, "description": {"en": "Notifications about your orders", "de": "Benachrichtigungen zu Ihren Bestellungen"}, "showAutomatically": true}, {"path": "products/deals", "name": {"en": "Daily Deals"}}]}' curl -X GET "https://app.notifo.io/api/apps/{appId}/topics/?query=order&take=20" -H "Authorization: Bearer YOUR_ACCESS_TOKEN" curl -X DELETE "https://app.notifo.io/api/apps/{appId}/topics/products/deals" -H "Authorization: Bearer YOUR_ACCESS_TOKEN" ``` -------------------------------- ### Upsert Users in Notifo Source: https://context7.com/notifo-io/notifo/llms.txt Performs a batch upsert of users, including their contact details, language preferences, and channel-specific notification settings. ```bash curl -X POST "https://app.notifo.io/api/apps/{appId}/users/" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "requests": [ { "id": "user-123", "fullName": "John Doe", "emailAddress": "john@example.com", "phoneNumber": "+1234567890", "preferredLanguage": "en", "preferredTimezone": "America/New_York", "properties": { "plan": "premium", "company": "Acme Inc" }, "settings": { "email": { "send": "Send", "delayInSeconds": 300 }, "webpush": { "send": "Send" }, "mobilepush": { "send": "Send" } } } ] }' ``` -------------------------------- ### Configure Channel Settings in JSON Source: https://context7.com/notifo-io/notifo/llms.txt This JSON object demonstrates how to configure settings for different notification channels like email, webpush, mobilepush, SMS, and messaging. It specifies parameters such as send status, conditions for delivery, delay, and template usage. ```json { "settings": { "email": { "send": "Send", "condition": "Always", "required": "NotRequired", "delayInSeconds": 300, "template": "custom-email-template", "groupKey": "daily-digest" }, "webpush": { "send": "Send", "condition": "IfNotSeen", "delayInSeconds": 0 }, "mobilepush": { "send": "Send", "condition": "IfNotConfirmed", "required": "Required" }, "sms": { "send": "NotSending", "condition": "Always" }, "messaging": { "send": "Send", "condition": "Always" } } } ``` -------------------------------- ### Register Web Push Subscription (API) Source: https://context7.com/notifo-io/notifo/llms.txt Registers a web push subscription for a browser to receive push notifications. Requires user API key and a JSON payload containing the subscription endpoint and keys. ```bash curl -X POST "https://app.notifo.io/api/me/webpush" \ -H "Authorization: Bearer USER_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "subscription": { "endpoint": "https://fcm.googleapis.com/fcm/send/xxx", "keys": { "p256dh": "base64-encoded-key", "auth": "base64-encoded-auth" } } }' ``` -------------------------------- ### POST /api/apps/{appId}/integration/ Source: https://context7.com/notifo-io/notifo/llms.txt Configures a delivery channel integration (e.g., Firebase, Amazon SES) for a specific app. ```APIDOC ## POST /api/apps/{appId}/integration/ ### Description Configure delivery channel integrations for an app to connect to external services. ### Method POST ### Endpoint https://app.notifo.io/api/apps/{appId}/integration/ ### Parameters #### Path Parameters - **appId** (string) - Required - The unique identifier of the app ### Request Body - **type** (string) - Required - Integration type (e.g., Firebase) - **enabled** (boolean) - Required - Whether the integration is active - **properties** (object) - Required - Integration-specific configuration ### Request Example { "type": "Firebase", "enabled": true, "properties": { "project": "my-firebase-project" } } ``` -------------------------------- ### POST /api/apps/{appId}/templates Source: https://context7.com/notifo-io/notifo/llms.txt Create and manage reusable notification templates. ```APIDOC ## POST /api/apps/{appId}/templates ### Description Create notification templates with localized content and formatting settings. ### Method POST ### Endpoint /api/apps/{appId}/templates ### Request Body - **requests** (array) - List of template objects including code, formatting, and delivery settings. ### Response Example { "status": "success" } ``` -------------------------------- ### Manage Users via Notifo API Source: https://context7.com/notifo-io/notifo/llms.txt Retrieve specific user details or query a list of users with pagination. Requires a valid Bearer token for authentication. ```bash curl -X GET "https://app.notifo.io/api/apps/{appId}/users/user-123?withDetails=true" -H "Authorization: Bearer YOUR_ACCESS_TOKEN" curl -X GET "https://app.notifo.io/api/apps/{appId}/users/?query=john&take=20&skip=0" -H "Authorization: Bearer YOUR_ACCESS_TOKEN" ``` -------------------------------- ### Manage User Subscriptions Source: https://context7.com/notifo-io/notifo/llms.txt Subscribe users to specific topics with custom settings, retrieve current subscriptions, or remove a subscription. Supports hierarchical topic paths. ```bash curl -X POST "https://app.notifo.io/api/apps/{appId}/users/user-123/subscriptions" -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -H "Content-Type: application/json" -d '{"subscribe": [{"topicPrefix": "orders/user-123", "topicSettings": {"email": {"send": "Send"}, "webpush": {"send": "Send"}, "mobilepush": {"send": "Send"}}}, {"topicPrefix": "products/deals", "topicSettings": {"email": {"send": "Send", "delayInSeconds": 3600}}}], "unsubscribe": ["old/topic/path"]}' curl -X GET "https://app.notifo.io/api/apps/{appId}/users/user-123/subscriptions" -H "Authorization: Bearer YOUR_ACCESS_TOKEN" curl -X DELETE "https://app.notifo.io/api/apps/{appId}/users/user-123/subscriptions/products/deals" -H "Authorization: Bearer YOUR_ACCESS_TOKEN" ``` -------------------------------- ### Manage Scheduled and Grouped Events Source: https://context7.com/notifo-io/notifo/llms.txt Shows how to schedule notifications for future delivery, group events to avoid notification fatigue, and cancel scheduled events using a correlation ID. ```bash curl -X POST "https://app.notifo.io/api/apps/{appId}/events/" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "requests": [ { "topic": "reminders/user-123", "templateCode": "appointment_reminder", "scheduling": { "type": "ScheduledAtTime", "date": "2024-02-15", "time": "09:00:00" }, "properties": { "appointmentTime": "10:00 AM", "doctorName": "Dr. Smith" } } ] }' curl -X POST "https://app.notifo.io/api/apps/{appId}/events/" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "requests": [ { "topic": "comments/post-789", "groupKey": "comments-post-789", "templateCode": "new_comment", "properties": { "postTitle": "My Blog Post", "commenterName": "Jane" } } ] }' curl -X DELETE "https://app.notifo.io/api/apps/{appId}/events/" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "correlationId": "appointment-reminder-123" }' ``` -------------------------------- ### Handle SDK Errors (TypeScript/Node.js SDK) Source: https://context7.com/notifo-io/notifo/llms.txt Demonstrates how to handle specific Notifo API errors (e.g., BadRequestError, NotFoundError) when using the SDK. This allows for graceful error management and user feedback. ```typescript // Error handling try { await client.events.postEvents("my-app-id", { requests: [] }); } catch (err) { if (err instanceof Notifo.BadRequestError) { console.log("Validation error:", err.message); console.log("Details:", err.body); } else if (err instanceof Notifo.NotFoundError) { console.log("App not found"); } } ``` -------------------------------- ### Integrate Notifo Web Plugin for Real-time Notifications Source: https://context7.com/notifo-io/notifo/llms.txt Embed the Notifo web plugin into your website to enable real-time notifications, web push subscriptions, and a user-friendly topic management interface. This involves including the Notifo SDK script and initializing it with user or API keys, then configuring UI elements like the notification bell and topic subscription buttons. ```html My App
``` -------------------------------- ### Subscribe to Web Push Notifications Source: https://github.com/notifo-io/notifo/wiki/Web-Plugin Enables the user to subscribe to web push notifications through the Notifo SDK. This function call should be made after the SDK has been initialized. ```html ``` -------------------------------- ### POST /api/apps/{appId}/email-templates Source: https://context7.com/notifo-io/notifo/llms.txt Creates a new email template for a specific application using MJML syntax and Liquid placeholders. ```APIDOC ## POST /api/apps/{appId}/email-templates ### Description Creates a new email template for a specific application. Supports MJML for responsive design and Liquid syntax for dynamic content. ### Method POST ### Endpoint https://app.notifo.io/api/apps/{appId}/email-templates/ ### Parameters #### Path Parameters - **appId** (string) - Required - The unique identifier of the application. #### Request Body - **language** (string) - Required - Language code (e.g., "en"). - **name** (string) - Required - Unique name for the template. - **bodyHtml** (string) - Required - MJML content for the email body. - **bodyText** (string) - Required - Plain text fallback for the email. - **subject** (string) - Required - Email subject line. ### Request Example { "language": "en", "name": "order-email-template", "bodyHtml": "...", "bodyText": "Hello {{user.fullName}}...", "subject": "{{notification.subject}}" } ``` -------------------------------- ### Enable esModuleInterop for TypeScript ESM Projects Source: https://github.com/notifo-io/notifo/blob/main/tools/sdk-ts/README.md Configuration snippet for tsconfig.json to enable esModuleInterop, ensuring compatibility for TypeScript ESM projects when importing the Notifo Node SDK. ```json { "compilerOptions": { "esModuleInterop": true, ... } } ``` -------------------------------- ### POST /api/apps/{appId}/topics Source: https://context7.com/notifo-io/notifo/llms.txt Define and manage notification topics. ```APIDOC ## POST /api/apps/{appId}/topics ### Description Create or update notification topics for the application. ### Method POST ### Endpoint /api/apps/{appId}/topics ### Request Body - **requests** (array) - List of topic definitions including path, name, and description. ### Response Example { "status": "success" } ``` -------------------------------- ### POST /api/apps/{appId}/users/{userId}/subscriptions Source: https://context7.com/notifo-io/notifo/llms.txt Manage user topic subscriptions and settings. ```APIDOC ## POST /api/apps/{appId}/users/{userId}/subscriptions ### Description Subscribe a user to specific topics or unsubscribe from existing ones. ### Method POST ### Endpoint /api/apps/{appId}/users/{userId}/subscriptions ### Request Body - **subscribe** (array) - List of subscription objects containing topicPrefix and topicSettings. - **unsubscribe** (array) - List of topic paths to unsubscribe from. ### Response Example { "items": [ { "topicPrefix": "orders/user-123", "topicSettings": { "email": { "send": "Send" } } } ], "total": 1 } ```