{{ post.title }}
{{ post.excerpt }}
### Before User Created Hook Setup
Source: https://docs.notifuse.com/integrations/supabase
Details the setup process for the Before User Created Hook to sync new Supabase users to Notifuse.
```APIDOC
## Before User Created Hook
The Before User Created Hook automatically adds new Supabase users to your Notifuse contact database.
### Setup
1. Toggle on **Before User Created Hook**
2. Generate a webhook secret key in Supabase (different from the auth email hook)
3. Copy the secret key in the Notifuse Supabase integration form
4. (Optional) Select a contact list to automatically add new users to
5. (Optional) Reject disposable email addresses (e.g: @yopmail.com)
```
--------------------------------
### Example Signup Confirmation Template
Source: https://docs.notifuse.com/integrations/supabase
Provides an example of an MJML template for signup confirmation emails.
```APIDOC
## Example Template
Here's an example signup confirmation template with the correct URL format:
```mjml
{{ post.excerpt }}
Thanks for signing up.
" }, "category": "transactional", "created_at": "2023-10-27T10:00:00Z", "updated_at": "2023-10-27T10:00:00Z" } } ``` #### Error Response (400, 401, 404, 500) - **error** (string) - Description of the error (e.g., "Template not found") ``` -------------------------------- ### Fetch Navigation and Other Pages Source: https://docs.notifuse.com/api-reference/list-webhook-subscriptions Instructions on how to fetch the 'llms.txt' file to find navigation and other pages. ```APIDOC ## Fetch Navigation and Other Pages ### Description To find navigation and other pages in this documentation, fetch the llms.txt file from the specified URL. ### Method GET ### Endpoint `https://docs.notifuse.com/llms.txt` ### Response #### Success Response (200) - **content** (string) - The content of the llms.txt file, which may contain links or references to other pages. #### Response Example ``` # Content of llms.txt - /websites/notifuse/navigation - /websites/notifuse/settings ``` ``` -------------------------------- ### Install Certbot on macOS Source: https://docs.notifuse.com/installation Homebrew command to install Certbot on macOS. Certbot is used for obtaining and renewing Let's Encrypt certificates, essential for securing SMTP relay in production environments. ```bash brew install certbot ``` -------------------------------- ### Start Notifuse Standalone Docker for Production Source: https://docs.notifuse.com/installation This command shows how to run Notifuse as a standalone Docker container. This approach requires a separate PostgreSQL database to be provided. It's suitable for production environments where more control over the database is needed. ```bash docker run -d --name notifuse -p 8080:8080 notifuse/notifuse:latest ``` -------------------------------- ### Fetch Navigation and Pages Source: https://docs.notifuse.com/api-reference/batch-import-contacts Fetches navigation and other pages from the documentation. ```APIDOC ## GET /websites/notifuse/llms.txt ### Description Fetches navigation and other pages from the documentation. ### Method GET ### Endpoint /websites/notifuse/llms.txt ### Parameters #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **content** (string) - The content of the llms.txt file. #### Response Example ``` { "content": "(content of llms.txt)" } ``` ``` -------------------------------- ### Install Certbot on CentOS/RHEL Source: https://docs.notifuse.com/installation Shell commands to install Certbot on CentOS or RHEL systems. Certbot is a critical tool for managing Let's Encrypt certificates, enabling secure TLS connections for SMTP relay. ```bash sudo yum install certbot ``` -------------------------------- ### Template Variables Example (JSON) Source: https://docs.notifuse.com/concepts/transactional-api This JSON snippet shows an example of the `data` object structure, which contains variables that can be accessed within your email templates. These variables are used to personalize email content. ```json { "data": { "order_id": "ORD-12345", "total": "$99.99", "discount_code": "WELCOME20" } } ``` -------------------------------- ### Develop with Self-Signed Certificates using OpenSSL Source: https://docs.notifuse.com/installation This snippet demonstrates how to generate self-signed certificates for local development using OpenSSL. It creates a certificate and a private key, then encodes them to base64. These are intended for development environments only and should not be used in production. ```bash # Using the provided script ./scripts/generate-dev-certs.sh localapi.notifuse.com # Or manually with openssl openssl req -x509 -newkey rsa:2048 \ -keyout dev-cert.key.pem \ -out dev-cert.cert.pem \ -days 365 -nodes \ -subj "/CN=localhost" \ -addext "subjectAltName=DNS:localhost,IP:127.0.0.1" # Encode to base64 cat dev-cert.cert.pem | base64 > cert_base64.txt cat dev-cert.key.pem | base64 > key_base64.txt ``` -------------------------------- ### Order Confirmation External ID Example Source: https://docs.notifuse.com/concepts/transactional-api This JSON snippet shows an example `external_id` format for an order confirmation notification. It is used to uniquely identify an order confirmation event. Consistent formatting helps in preventing duplicate notifications. ```json { "external_id": "order-12345-confirmation" } ``` -------------------------------- ### Data Fetching Source: https://docs.notifuse.com/api-reference/toggle-webhook-subscription-enabled-state Instructions on how to fetch navigation and other pages. ```APIDOC ## Fetch Navigation and Pages ### Description To retrieve navigation and other pages within the documentation, fetch the `llms.txt` file from the specified URL. ### Endpoint - **URL**: `https://docs.notifuse.com/llms.txt` ### Method - `GET` ``` -------------------------------- ### Welcome Email External ID Example Source: https://docs.notifuse.com/concepts/transactional-api This JSON snippet illustrates an example `external_id` for a welcome email notification. It typically includes a user identifier for uniqueness. This consistent `external_id` helps ensure that welcome emails are not sent multiple times. ```json { "external_id": "welcome-user123" } ``` -------------------------------- ### POST /api/templates.create Source: https://docs.notifuse.com/api-reference/create-a-template Creates a new template. Each template must have a channel (email or web) with corresponding channel-specific content. ```APIDOC ## POST /api/templates.create ### Description Creates a new template. Each template must have a channel (email or web) with corresponding channel-specific content. ### Method POST ### Endpoint /api/templates.create ### Parameters #### Request Body - **workspace_id** (string) - Required - The ID of the workspace - **id** (string) - Required - Unique identifier for the template (alphanumeric, underscores, and hyphens only) - **name** (string) - Required - Name of the template - **channel** (string) - Required - Communication channel (email or web) - **email** (object) - Optional - Email channel content - **web** (object) - Optional - Web channel content - **category** (string) - Required - Template category (marketing, transactional, welcome, opt_in, unsubscribe, bounce, blocklist, blog, other) - **template_macro_id** (string) - Optional - ID of the template macro (layout) to use - **test_data** (object) - Optional - Test data for template preview - **settings** (object) - Optional - Channel-specific settings ### Request Example ```json { "workspace_id": "ws_1234567890", "id": "welcome_email", "name": "Welcome Email", "channel": "email", "email": { "subject": "Welcome to Notifuse!", "body": "Welcome to our service!
" }, "category": "welcome" } ``` ### Response #### Success Response (201) - **template** (object) - Details of the created template #### Response Example ```json { "template": { "id": "welcome_email", "name": "Welcome Email", "version": 1, "channel": "email", "email": { "subject": "Welcome to Notifuse!", "body": "Welcome to our service!
" }, "category": "welcome" } } ``` #### Error Response (400) - **error** (string) - Description of the error #### Error Response Example ```json { "error": "Template id already exists" } ``` ``` -------------------------------- ### Password Reset External ID Example Source: https://docs.notifuse.com/concepts/transactional-api This JSON snippet demonstrates an example `external_id` for a password reset notification. The format includes user identification and a date stamp for uniqueness. This pattern aids in managing and preventing duplicate password reset requests. ```json { "external_id": "pwd-reset-user123-20240101" } ``` -------------------------------- ### Get Notifuse Template by ID Source: https://docs.notifuse.com/api-reference/get-a-template Retrieves a single Notifuse email or newsletter template by its ID. This GET request can optionally specify a version number to fetch a particular revision. It requires workspace_id and template id as query parameters. Response includes template details or error information. ```yaml openapi: 3.0.3 info: title: Notifuse API description: API for Notifuse - a transactional email and newsletter management platform version: 1.0.0 contact: name: Notifuse Support url: https://www.notifuse.com/support email: hello@notifuse.com servers: - url: https://{notifuseDomain} description: Customer-specific Notifuse API server variables: notifuseDomain: description: Your unique Notifuse domain default: demo.notifuse.com security: [] paths: /api/templates.get: get: summary: Get a template description: >- Retrieves a single template by ID. Optionally specify a version number to retrieve a specific version. operationId: getTemplate parameters: - name: workspace_id in: query required: true schema: type: string description: The ID of the workspace example: ws_1234567890 - name: id in: query required: true schema: type: string description: The ID of the template example: welcome_email - name: version in: query required: false schema: type: integer format: int64 description: Specific version number (defaults to latest) example: 1 responses: '200': description: Template retrieved successfully content: application/json: schema: type: object properties: template: $ref: '#/components/schemas/Template' '400': description: Bad request - validation failed content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' '401': description: Unauthorized - invalid or missing authentication token content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' '404': description: Template not found content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' example: error: Template not found '500': description: Internal server error content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' security: - BearerAuth: [] components: schemas: Template: type: object properties: id: type: string description: >- Unique identifier for the template (alphanumeric, underscores, and hyphens only) example: welcome_email maxLength: 32 pattern: '^[a-zA-Z0-9_-]+$' name: type: string description: Name of the template example: Welcome Email maxLength: 32 version: type: integer format: int64 description: Version number of the template example: 1 channel: type: string enum: - email - web description: Communication channel example: email email: $ref: '#/components/schemas/EmailTemplate' web: $ref: '#/components/schemas/WebTemplate' category: type: string enum: - marketing - transactional - welcome - opt_in - unsubscribe - bounce - blocklist - blog - other description: Template category example: transactional maxLength: 20 template_macro_id: type: string nullable: true description: ID of the template macro (layout) to use integration_id: type: string nullable: true description: ID of the integration managing this template (e.g., Supabase) test_data: type: object additionalProperties: true description: Test data for template preview example: user_name: John Doe action_url: https://example.com/action settings: type: object additionalProperties: true description: Channel-specific third-party settings created_at: type: string format: date-time description: When the template was created updated_at: type: string format: date-time description: When the template was last updated deleted_at: type: string format: date-time nullable: true description: When the template was deleted (null if active) required: ``` -------------------------------- ### Website Configuration Source: https://docs.notifuse.com/api-reference/list-broadcasts This section details the structure for website configurations, including UTM parameters and broadcast variation settings. ```APIDOC ## Website Configuration Details ### Description Provides details on website configurations, including tracking parameters and broadcast variation schemas. ### Parameters #### Request Body - **campaign** (object) - Optional - UTM campaign parameter - **medium** (string) - Optional - UTM medium parameter - **campaign** (string) - Optional - UTM campaign parameter - **term** (string) - Optional - UTM term parameter - **content** (string) - Optional - UTM content parameter - **BroadcastVariation** (object) - Required - Represents a variation of a broadcast message. - **variation_name** (string) - Optional - Name of this variation - **template_id** (string) - Required - Template ID for this variation - **metrics** (object) - Optional - Metrics for this variation (see VariationMetrics schema) - **template** (object) - Optional - Full template object (populated when with_templates=true) ### Response #### Success Response (200) - **BroadcastVariation** (object) - Details of the broadcast variation. - **VariationMetrics** (object) - Metrics associated with the broadcast variation. - **recipients** (integer) - Number of recipients - **delivered** (integer) - Number of delivered messages - **opens** (integer) - Number of opens - **clicks** (integer) - Number of clicks - **bounced** (integer) - Number of bounces - **complained** (integer) - Number of complaints - **unsubscribed** (integer) - Number of unsubscribes ``` -------------------------------- ### Notifuse API - Error Response Examples Source: https://docs.notifuse.com/api-reference/authentication/root-user-programmatic-signin Examples of error responses from the Notifuse API, covering scenarios like missing required fields, invalid JSON bodies, unauthorized credentials, and rate limiting. These responses provide specific error messages to help diagnose issues. ```json { "error": "Missing required fields: email, timestamp, signature" } ``` ```json { "error": "Invalid request body" } ``` ```json { "error": "Invalid credentials" } ``` ```json { "error": "Method not allowed" } ``` -------------------------------- ### Notifuse Endpoints Overview Source: https://docs.notifuse.com/api-reference/introduction This section provides an overview of the available Notifuse API endpoints. For detailed information on each endpoint, including parameters, request/response formats, and examples, please refer to the OpenAPI specification file. ```APIDOC ## Notifuse API Endpoints ### Description This API allows interaction with the Notifuse service for various functionalities. The complete list of endpoints, their methods, parameters, and request/response schemas can be found in the OpenAPI specification. ### Method All standard HTTP methods (GET, POST, PUT, DELETE, etc.) are supported depending on the specific endpoint. ### Endpoint Endpoints follow the base path `/websites/notifuse`. ### Authentication All API endpoints are authenticated using Bearer tokens. Include your token in the `Authorization` header as `Bearer YOUR_TOKEN`. ### Request Example ```json { "example": "Authorization: Bearer YOUR_API_TOKEN" } ``` ### Response Responses vary based on the endpoint used. Refer to the OpenAPI specification for details on success and error responses for each endpoint. ### Further Information For a comprehensive list of all available endpoints and their specific details, please consult the [OpenAPI specification file](https://github.com/notifuse/notifuse/openapi.json). ``` -------------------------------- ### GET /api/templates.list Source: https://docs.notifuse.com/api-reference/list-templates Retrieves a list of all templates in the workspace. Supports optional filtering by category and channel. ```APIDOC ## GET /api/templates.list ### Description Retrieves a list of all templates in the workspace. Supports optional filtering by category and channel. ### Method GET ### Endpoint /api/templates.list ### Parameters #### Query Parameters - **workspace_id** (string) - Required - The ID of the workspace - **category** (string) - Optional - Filter templates by category. Allowed values: marketing, transactional, welcome, opt_in, unsubscribe, bounce, blocklist, blog, other - **channel** (string) - Optional - Filter templates by channel. Allowed values: email, web ### Request Example ```json { "example": "" } ``` ### Response #### Success Response (200) - **templates** (array) - List of templates retrieved successfully - **id** (string) - Unique identifier for the template - **name** (string) - Name of the template - **version** (integer) - Version number of the template - **channel** (string) - Communication channel - **email** (object) - Email template details - **web** (object) - Web template details - **category** (string) - Template category - **template_macro_id** (string) - ID of the template macro (layout) to use - **integration_id** (string) - ID of the integration managing this template - **test_data** (object) - Test data for template preview - **settings** (object) - Channel-specific third-party settings - **created_at** (string) - When the template was created - **updated_at** (string) - When the template was last updated #### Response Example ```json { "templates": [ { "id": "welcome_email", "name": "Welcome Email", "version": 1, "channel": "email", "email": { "subject": "Welcome to Notifuse!", "body": "Thank you for signing up.
" }, "category": "welcome", "created_at": "2023-01-01T12:00:00Z", "updated_at": "2023-01-01T12:00:00Z" } ] } ``` #### Error Response (400) - **error** (string) - Description of the error #### Error Response Example ```json { "error": "workspace_id is required" } ``` #### Error Response (401) - **error** (string) - Description of the error #### Error Response (500) - **error** (string) - Description of the error #### Error Response Example ```json { "error": "Failed to get templates" } ``` ``` -------------------------------- ### GET /api/webhookSubscriptions.deliveries Source: https://docs.notifuse.com/api-reference/get-webhook-delivery-history Returns the delivery history for a webhook subscription, including status and response information. ```APIDOC ## GET /api/webhookSubscriptions.deliveries ### Description Returns the delivery history for a webhook subscription, including status and response information. ### Method GET ### Endpoint /api/webhookSubscriptions.deliveries ### Parameters #### Query Parameters - **workspace_id** (string) - Required - The ID of the workspace - **subscription_id** (string) - Optional - The ID of the webhook subscription (if not provided, returns all deliveries for the workspace) - **limit** (integer) - Optional - Number of deliveries to return (1-100). Defaults to 20. - **offset** (integer) - Optional - Offset for pagination. Defaults to 0. ### Request Example ```json { "example": "GET /api/webhookSubscriptions.deliveries?workspace_id=ws_1234567890&subscription_id=whsub_a1b2c3d4e5f6&limit=20&offset=0" } ``` ### Response #### Success Response (200) - **deliveries** (array) - List of webhook deliveries. Each delivery contains: - **id** (string) - Unique identifier for the delivery. - **subscription_id** (string) - ID of the subscription this delivery belongs to. - **event_type** (string) - Type of event that triggered the delivery. - **payload** (object) - The JSON payload sent in the webhook. - **status** (string) - Current status of the delivery (pending, delivering, delivered, failed). - **attempts** (integer) - Number of delivery attempts made. - **max_attempts** (integer) - Maximum number of retry attempts. - **next_attempt_at** (string) - When the next retry will be attempted (date-time format). - **last_attempt_at** (string) - When the last delivery attempt was made (date-time format). - **total** (integer) - Total number of deliveries. - **limit** (integer) - Number of deliveries per page. - **offset** (integer) - Offset for pagination. #### Response Example ```json { "example": "{\n \"deliveries\": [\n {\n \"id\": \"whdel_x1y2z3\",\n \"subscription_id\": \"whsub_a1b2c3d4e5f6\",\n \"event_type\": \"contact.created\",\n \"payload\": {\n \"contact_id\": \"cont_abcdef123456\"\n },\n \"status\": \"delivered\",\n \"attempts\": 1,\n \"max_attempts\": 10,\n \"next_attempt_at\": null,\n \"last_attempt_at\": \"2024-01-15T10:30:00Z\"\n }\n ],\n \"total\": 150,\n \"limit\": 20,\n \"offset\": 0\n}" } ``` #### Error Response (400) - **error** (string) - Error message (e.g., "workspace_id is required") #### Error Response (401) - **error** (string) - Error message (e.g., "Unauthorized - invalid or missing authentication token") #### Error Response (500) - **error** (string) - Error message (e.g., "Internal server error") ``` -------------------------------- ### Expose Local Server with ngrok (Bash) Source: https://docs.notifuse.com/features/webhooks This bash command demonstrates how to use `ngrok` to expose a local development server (running on port 3000) to the internet. The output provides a public URL that can be used as a webhook endpoint during local testing. This is essential for developing and debugging webhook integrations without deploying to production. ```bash # Start ngrok ngrok http 3000 # Use the ngrok URL as your webhook endpoint # https://abc123.ngrok.io/webhooks/notifuse ```