n8n

How to Integrate the MarketingBlocks API with n8n

Step 1: Get Your Bearer Token

Before starting, you'll need a valid API token:


Step 2: Create a New Workflow in n8n

  1. Open your n8n editor.

  2. Click the “+” icon to add a new node.

  3. Select HTTP Request as the node type.


Step 3: Configure HTTP Request Node

Fill in the following details to call the MarketingBlocks API:

  • HTTP Method: GET / POST / etc. (depending on the endpoint you're calling)

  • URL: Example: https://app.marketingblocks.ai/api/v1/social-sparks/create-post or https://app.marketingblocks.ai/api/v1/social-sparks/get-channels

  • Authentication:

    • Choose: None (since we’ll use custom headers)

  • Headers: Add a header with:

    Key: Authorization
    Value: Bearer mab_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  • Response Format: JSON

  • Request Body (for POST requests): Switch Body Content Type to JSON and fill out parameters based on the endpoint.


Step 4: Test the Connection

Click “Execute Node” to test the request. If everything is set up correctly, you’ll receive a response from the API.


Optional: Reuse Token Across Multiple Requests

If you're building a more complex workflow:

  1. Store your token in an Environment Variable or a Set node.

  2. Use {{ $json["your_token_field"] }} in the Authorization header field.


Rate Limiting Notice

  • The API is rate-limited to 100 requests per second per token.

  • Avoid loops or large parallel runs that exceed this limit.


📘 Example Usage: Fetching Channels

  • Method: GET

  • URL: https://app.marketingblocks.ai/api/v1/social-sparks/get-channels

  • Authorization Header:

    Bearer mab_abc123xyz456...
  • Success Response:

{
  "channels": {
    "current_page": 1,
    "data": [
      {
        "channel_id": 254,
        "platform": "facebook",
        "account_name": "Jon Snow",
        "avatar": "https://example.com/avatar.jpg"
      }
    ],
    "total": 1
  },
  "status": true
}

Last updated