### Install Novu Go SDK Source: https://docs.novu.co/platform/sdks/server/go Install the Novu Go SDK using the go get command. This is the first step to integrating Novu into your Go project. ```go go get github.com/novuhq/novu-go ``` -------------------------------- ### Download and Run Novu Setup Script Source: https://docs.novu.co/community/self-hosting-novu/deploy-with-docker Use this command to download necessary files, generate secrets, and start Novu services. It defaults to the current directory. ```bash curl -fsSL https://raw.githubusercontent.com/novuhq/novu/next/docker/community/setup.sh | bash ``` -------------------------------- ### NovuProvider Setup with Subscriber ID Source: https://docs.novu.co/platform/sdks/react-native/hooks/novu-provider This example shows how to set up the NovuProvider with the required subscriberId and applicationIdentifier props. Ensure these values are correctly obtained from your Novu application. ```javascript import { NovuProvider } from '@novu/react-native'; function App() { return ( {/* Your app components */} ); } ``` -------------------------------- ### Create React App with bun Source: https://docs.novu.co/platform/quickstart/react Create a new React app using Vite with bun. Navigate into the project directory, install dependencies, and start the development server. ```bash bunx create-vite novu-inbox-react --template react-ts cd novu-inbox-react bun install bun run dev ``` -------------------------------- ### Initialize Project Setup Source: https://docs.novu.co/community/add-a-new-provider Run the project setup command to prepare your local Novu environment. ```bash pnpm run setup:project ``` -------------------------------- ### Install Dependencies Source: https://docs.novu.co/guides/webhooks/stripe Install the necessary packages for Novu, Clerk, and Stripe integration. ```bash npm install @novu/api @clerk/nextjs @stripe ``` -------------------------------- ### Create React App with npm Source: https://docs.novu.co/platform/quickstart/react Create a new React app using Vite with npm. Navigate into the project directory, install dependencies, and start the development server. ```bash npm create vite@latest novu-inbox-react -- --template react-ts cd novu-inbox-react npm install npm run dev ``` -------------------------------- ### Start Local Studio Source: https://docs.novu.co/framework/quickstart/express Start the Local Studio for previewing and testing workflows. It will be available at http://localhost:2022. ```bash npx novu dev ``` -------------------------------- ### Initialize and Run Bridge Application Source: https://docs.novu.co/community/self-hosting-novu/deploy-with-docker Set up the bridge application for workflow definitions. This involves initializing the application with API details, installing dependencies, and starting the development server. ```bash # Initialize the bridge application npx novu@latest init \ --secret-key= \ --api-url=http://localhost:3000 # Install dependencies npm install # Start the bridge application npm run dev ``` -------------------------------- ### Install Novu SDK Source: https://docs.novu.co/guides/inngest Install the Novu SDK using npm. This is the first step to integrating Novu into your project. ```bash npm i @novu/api ``` -------------------------------- ### Install Dependencies Source: https://docs.novu.co/guides/webhooks/clerk Installs the necessary packages for Clerk and Novu integration. ```bash npm install svix @novu/api @clerk/nextjs ``` -------------------------------- ### Install Novu Agent Toolkit Source: https://docs.novu.co/platform/build-with-ai/agent-toolkit Install the @novu/agent-toolkit package using npm. ```bash npm install @novu/agent-toolkit ``` -------------------------------- ### Install Novu Typescript SDK with Bun Source: https://docs.novu.co/platform/sdks/server/typescript Install the Novu API package using Bun. ```bash bun add @novu/api ``` -------------------------------- ### Create React App with pnpm Source: https://docs.novu.co/platform/quickstart/react Create a new React app using Vite with pnpm. Navigate into the project directory, install dependencies, and start the development server. ```bash pnpm create vite novu-inbox-react --template react-ts cd novu-inbox-react pnpm install pnpm run dev ``` -------------------------------- ### Start Novu Studio on VPS Source: https://docs.novu.co/community/self-hosting-novu/deploy-with-docker Configure and start Novu Studio when running on a VPS. This involves setting the Novu API URL in the bridge application's .env file and then starting Studio with the VPS dashboard URL. ```bash # update the bridge .env file with below variables NOVU_API_URL=http://:3000 # Start Novu Studio with your VPS dashboard URL and bridge application URL npx novu@latest dev -d http://:4000 ``` -------------------------------- ### Create React App with yarn Source: https://docs.novu.co/platform/quickstart/react Create a new React app using Vite with yarn. Navigate into the project directory, install dependencies, and start the development server. ```bash yarn create vite novu-inbox-react --template react-ts cd novu-inbox-react yarn install yarn dev ``` -------------------------------- ### Install Novu Ruby Gem Source: https://docs.novu.co/platform/sdks/server/ruby Install the Novu Ruby SDK using the gem command. ```bash gem install novu ``` -------------------------------- ### Install Novu JS SDK Source: https://docs.novu.co/platform/build-with-ai/skills Install the Novu JS SDK for use in vanilla JavaScript applications. ```bash npm install @novu/js ``` -------------------------------- ### Install Novu Python SDK with PIP Source: https://docs.novu.co/platform/sdks/server/python Install the Novu Python SDK using pip, the standard package installer for Python. ```bash pip install novu-py ``` -------------------------------- ### Install Novu Laravel SDK Source: https://docs.novu.co/platform/sdks/server/laravel Install the Novu Laravel SDK using Composer. ```php composer require novu/novu-laravel ``` -------------------------------- ### Start Kannel Service Source: https://docs.novu.co/platform/integrations/sms/kannel Command to start the Kannel bearerbox service. Ensure the path to your kannel.conf file is correct. ```bash bearerbox /path/to/kannel.conf ``` -------------------------------- ### Install React Native SDK Source: https://docs.novu.co/platform/sdks/react-native Install the Novu React Native hooks SDK using npm. ```bash npm install @novu/react-native ``` -------------------------------- ### Install @novu/react Package Source: https://docs.novu.co/platform/inbox/headless-mode Install the Novu React SDK package using your preferred package manager. ```bash npm i @novu/react ``` ```bash pnpm add @novu/react ``` ```bash yarn add @novu/react ``` ```bash bun add @novu/react ``` -------------------------------- ### Install React Email Components Source: https://docs.novu.co/framework/content/react-email Install the necessary React Email components and the react-email package using npm. ```bash npm install @react-email/components react-email ``` -------------------------------- ### Start Redis Docker Container Source: https://docs.novu.co/community/self-hosting-novu/data-migrations Command to start a Redis Docker container, which is a prerequisite for some Novu migration scripts. ```bash docker run -p 6379:6379 redis ``` -------------------------------- ### Run Novu Setup Script in a Specific Directory Source: https://docs.novu.co/community/self-hosting-novu/deploy-with-docker Specify a custom directory for Novu installation by setting the NOVU_DIR environment variable. ```bash curl -fsSL https://raw.githubusercontent.com/novuhq/novu/next/docker/community/setup.sh | NOVU_DIR=~/novu bash ``` -------------------------------- ### List Integrations Source: https://docs.novu.co/api-reference/integrations/list-all-integrations This example demonstrates how to list all integrations for an organization using a GET request. It includes the necessary authorization and idempotency headers. ```APIDOC ## GET /v1/integrations ### Description Retrieves a list of all integrations belonging to the organization. ### Method GET ### Endpoint /v1/integrations ### Headers - **Authorization** (string) - Required - Bearer token for authentication. - **Idempotency-Key** (string) - Required - Unique key to ensure request idempotency. ### Response #### Success Response (200) Returns an array of integration objects. Each object contains details such as `_id`, `_environmentId`, `_organizationId`, `name`, `identifier`, `providerId`, `channel`, `kind`, `active`, `deleted`, `primary`, and optionally `credentials`, `configurations`, `deletedAt`, `deletedBy`, and `conditions`. ```json [ { "_id": "string", "_environmentId": "string", "_organizationId": "string", "name": "string", "identifier": "string", "providerId": "string", "channel": "in_app" | "email" | "sms" | "chat" | "push", "kind": "delivery" | "agent", "credentials": { ... }, "configurations": { ... }, "active": true, "deleted": false, "deletedAt": "string", "deletedBy": "string", "primary": true, "conditions": [ ... ] } ] ``` #### Error Responses - **400**: Bad Request - **401**: Unauthorized - **403**: Forbidden - **404**: Not Found - **405**: Method Not Allowed - **409**: Conflict - **413**: Payload Too Large - **414**: URI Too Long - **415**: Unsupported Media Type - **422**: Unprocessable Entity - **429**: Too Many Requests - **500**: Internal Server Error - **503**: Service Unavailable ``` -------------------------------- ### Run Remix Application Source: https://docs.novu.co/platform/quickstart/remix Start your Remix development server using your preferred package manager. ```bash npm run dev ``` ```bash pnpm run dev ``` ```bash yarn dev ``` ```bash bun run dev ``` -------------------------------- ### Retrieve a Context (TypeScript) Source: https://docs.novu.co/api-reference/contexts/retrieve-a-context Example of retrieving a context using TypeScript. This snippet demonstrates making a GET request to the Novu API. ```typescript import { Novu } from "@novu/node"; constnovu = new Novu("novu_secret_key"); novu.context.get("string", "string"); ``` -------------------------------- ### Retrieve a Context (Go) Source: https://docs.novu.co/api-reference/contexts/retrieve-a-context Example of retrieving a context using Go. This snippet demonstrates making a GET request to the Novu API. ```go package main import ( "fmt" "log" "github.com/novuhq/go-novu/sdk" ) func main() { client := sdk.NewClient("novu_secret_key", "") ctx, err := client.Context.Get("string", "string") if err != nil { log.Fatal(err) } fmt.Printf("%+v\n", ctx) } ``` -------------------------------- ### Retrieve a Context (Python) Source: https://docs.novu.co/api-reference/contexts/retrieve-a-context Example of retrieving a context using Python. This snippet demonstrates making a GET request to the Novu API. ```python from novu import Novu novu = Novu("novu_secret_key") novu.context.get('string', 'string') ``` -------------------------------- ### Install Project Dependencies Source: https://docs.novu.co/community/run-in-local-machine Navigate to the Novu directory and install all project dependencies using npm. This command also sets up default environment variables. ```bash cd novu && npm run setup:project ``` -------------------------------- ### Retrieve a Context (PHP) Source: https://docs.novu.co/api-reference/contexts/retrieve-a-context Example of retrieving a context using PHP. This snippet demonstrates making a GET request to the Novu API. ```php $novu = new Novu('novu_secret_key'); $novu->context()->get('string', 'string'); ``` -------------------------------- ### Quick Start with OpenAI Source: https://docs.novu.co/platform/build-with-ai/agent-toolkit Initialize the Novu Agent Toolkit for OpenAI and use it to send a welcome email. ```typescript import { createNovuAgentToolkit } from '@novu/agent-toolkit/openai'; import OpenAI from 'openai'; const openai = new OpenAI(); const toolkit = await createNovuAgentToolkit({ secretKey: process.env.NOVU_SECRET_KEY, subscriberId: 'user-123', }); const response = await openai.chat.completions.create({ model: 'gpt-4o', messages: [{ role: 'user', content: 'Send a welcome email to user-123' }], tools: toolkit.tools, }); for (const toolCall of response.choices[0].message.tool_calls ?? []) { const result = await toolkit.handleToolCall(toolCall); console.log(result); } ``` -------------------------------- ### Retrieve a Context (JavaScript) Source: https://docs.novu.co/api-reference/contexts/retrieve-a-context Example of retrieving a context using JavaScript. This snippet demonstrates making a GET request to the Novu API. ```javascript fetch("https://api.novu.co/v2/contexts/string/string", { "method": "GET", "headers": { "Authorization": "", "idempotency-key": "string" } }) .then(response => { console.log(response); }) .catch(err => { console.error(err); }); ``` -------------------------------- ### Basic Subscription Component Setup Source: https://docs.novu.co/platform/subscription/overview This snippet shows the basic setup for the Subscription component. It requires the topicKey prop and must be wrapped within the NovuProvider for session context. ```javascript import { NovuProvider, Subscription } from '@novu/react'; export function Novu() { return ( ) } ``` -------------------------------- ### Basic NovuProvider Setup Source: https://docs.novu.co/platform/sdks/react/hooks/novu-provider Demonstrates the basic setup of the NovuProvider at the root of a React application. Ensure you replace placeholder values with your actual subscriber ID and application identifier. ```javascript import { NovuProvider } from '@novu/react'; function App() { return ( {/* Your app components */} ); } ``` -------------------------------- ### Start Novu Project Source: https://docs.novu.co/community/run-in-local-machine Run the entire Novu project using the npm start command, which launches the Jarvis CLI tool for easy management. ```bash npm run start ``` -------------------------------- ### Retrieve Subscriber Notifications Count (cURL) Source: https://docs.novu.co/api-reference/subscribers/retrieve-subscriber-notifications-count Example cURL request to get the count of in-app notifications for a subscriber, using filters for read status, archived status, and tags. ```bash curl -X GET "https://api.novu.co/v2/subscribers/string/notifications/count?filters=%5B%7B%22read%22%3Afalse%2C%22archived%22%3Afalse%7D%2C%7B%22tags%22%3A%5B%22important%22%5D%7D%2C%7B%22tags%22%3A%7B%22and%22%3A%5B%7B%22or%22%3A%5B%22a%22%2C%22b%22%5D%7D%2C%7B%22or%22%3A%5B%22c%22%5D%7D%5D%7D%7D%5D" \ -H "idempotency-key: string" \ -H "Authorization: " ``` -------------------------------- ### Start Novu Services on VPS Source: https://docs.novu.co/community/self-hosting-novu/deploy-with-docker After configuring the .env file for a VPS, use this command to start all Novu services in detached mode. ```bash docker compose up -d ``` -------------------------------- ### Delete Messages by Transaction ID (JavaScript) Source: https://docs.novu.co/api-reference/messages/delete-messages-by-transactionid This JavaScript example demonstrates how to delete messages by transaction ID using the Novu SDK. Ensure you have the SDK installed and configured with your API key. ```javascript import { Novu } from "@novu/node"; constnovu = new Novu("YOUR_NOVU_API_KEY"); async function deleteMessagesByTransactionId() { try { awaitnovu.messages.deleteByTransactionId("507f1f77bcf86cd799439011", { channel: "in_app", }); console.log("Messages deleted successfully."); } catch (error) { console.error("Error deleting messages:", error); } } ``` -------------------------------- ### Access Novu Client Instance Source: https://docs.novu.co/platform/sdks/react-native/hooks/use-novu Use the `useNovu` hook to get the Novu client instance within a `NovuProvider`. This example shows how to mark all notifications as read and archive all read notifications. ```javascript import { useNovu } from '@novu/react-native'; import { View, Button, ActivityIndicator } from 'react-native'; function NotificationActions() { const novu = useNovu(); if (isLoading) return ; const markAllAsRead = async () => { await novu.notifications.readAll(); }; const archiveAllRead = async () => { await novu.notifications.archiveAllRead(); }; return (