Skip to main content

Segment

Prefer guided AI setup?

Instead of following these steps manually, you can use the AI Credential Assistant — describe what you want to connect and the AI will walk you through the setup step by step, tailored to your account.

Overview

Connect your Segment account to Nirvai to send customer data, track events, and integrate with your analytics pipeline.

Supported Authentication Methods

  • API Key (Write Key) - Source-specific write key for sending data

Prerequisites

  • A Segment account
  • A Source created in your Segment workspace

Setup Instructions

API Key Authentication

Step 1: Create a Source

  1. Log in to your Segment account
  2. Go to Connections > Sources
  3. Click Add Source
  4. Select Node.js (or appropriate server-side source)
  5. Name your source and click Add Source

Step 2: Get Your Write Key

  1. Open your newly created source
  2. Go to the Settings tab
  3. Find and copy the Write Key

Step 3: Configure in Nirvai

  1. In Nirvai, select Segment API
  2. Paste your Write Key
  3. Save the credential

How Authentication Works

Segment uses the Write Key as a Basic Auth username (with empty password):

Authorization: Basic base64(writekey:)

Nirvai handles this encoding automatically.

Available Operations

With Segment credentials, you can:

  • Track user events and actions
  • Identify users with traits
  • Group users into organizations
  • Send page/screen views
  • Manage user aliases
  • Forward data to integrations

Best Practices

Source Organization

  • Create separate sources for different environments (dev, staging, prod)
  • Use meaningful source names for easy identification
  • Each source has its own Write Key

Data Quality

  • Follow Segment's naming conventions for events
  • Include consistent properties across events
  • Use identify calls before track calls

Troubleshooting

Common Issues

  • 401 Unauthorized: Write Key is invalid or from wrong source
  • Data Not Appearing: Check source debugger in Segment dashboard
  • Wrong Destination: Verify integration settings in your source
  • Rate Limits: Batch events when possible for high-volume sources

Debugging Tips

  1. Use Segment's Source Debugger to verify events
  2. Check the Delivery Overview for destination status
  3. Validate event schema in Event Tester

Adapted from n8n documentation for Nirvai platform


Next Steps

Got your credential? Connect it to an agent

Use the AI Tool Creator to turn this credential into agent-callable tools. Describe what your agent should be able to do and the AI investigates the API, configures the endpoints, and gives you a reviewable toolkit before saving anything.