Hackmamba Docs
Developer tools

SDKs

Official SDKs and client libraries for easy integration

SDKs

Official SDKs and client libraries to help you integrate quickly and easily.

Available SDKs

JavaScript/Node.js

Our official JavaScript SDK supports both Node.js and browser environments.

Installation

npm install @hackmamba/sdk

Usage

import { HackmambaClient } from "@hackmamba/sdk";

const client = new HackmambaClient({
  apiKey: "your-api-key",
  environment: "sandbox", // or 'production'
});

// Make API calls
const users = await client.users.list();
const user = await client.users.get("user_123");

Browser Usage

<script src="https://cdn.hackmamba.com/sdk/v1/hackmamba.min.js"></script>
<script>
  const client = new HackmambaClient({
    apiKey: "your-api-key",
  });

  client.users.list().then((users) => {
    console.log(users);
  });
</script>

Python

Our Python SDK provides a clean, Pythonic interface to our API.

Installation

pip install hackmamba-sdk

Usage

from hackmamba import HackmambaClient

client = HackmambaClient(
    api_key='your-api-key',
    environment='sandbox'
)

# Make API calls
users = client.users.list()
user = client.users.get('user_123')

PHP

PHP SDK for server-side applications.

Installation

composer require hackmamba/sdk

Usage

<?php
require_once 'vendor/autoload.php';

use Hackmamba\HackmambaClient;

$client = new HackmambaClient([
    'api_key' => 'your-api-key',
    'environment' => 'sandbox'
]);

// Make API calls
$users = $client->users->list();
$user = $client->users->get('user_123');

Ruby

Ruby gem for Ruby applications.

Installation

gem install hackmamba-sdk

Usage

require 'hackmamba'

client = Hackmamba::Client.new(
  api_key: 'your-api-key',
  environment: 'sandbox'
)

# Make API calls
users = client.users.list
user = client.users.get('user_123')

SDK Features

Automatic Authentication

All SDKs handle authentication automatically:

// No need to manually add headers
const client = new HackmambaClient({ apiKey: "your-key" });
const users = await client.users.list(); // Auth handled automatically

Rate Limit Handling

SDKs automatically handle rate limiting with exponential backoff:

# SDK automatically retries on rate limit
users = client.users.list()  # Handles 429 responses automatically

Type Safety

TypeScript definitions are included for better development experience:

interface User {
  id: string;
  name: string;
  email: string;
  created_at: string;
}

const users: User[] = await client.users.list();

Error Handling

Consistent error handling across all SDKs:

try {
  const user = await client.users.get("invalid-id");
} catch (error) {
  if (error.code === "user_not_found") {
    console.log("User does not exist");
  }
}

SDK Configuration

Environment Variables

All SDKs support environment variables:

# Set environment variables
export HACKMAMBA_API_KEY=your-api-key
export HACKMAMBA_ENVIRONMENT=sandbox
// SDK automatically picks up environment variables
const client = new HackmambaClient(); // Uses env vars

Custom Configuration

const client = new HackmambaClient({
  apiKey: "your-api-key",
  environment: "sandbox",
  timeout: 30000, // 30 seconds
  retries: 3,
  baseURL: "https://custom-api.example.com",
});

Examples

Complete Integration Example

import { HackmambaClient } from "@hackmamba/sdk";

async function syncUsers() {
  const client = new HackmambaClient({
    apiKey: process.env.HACKMAMBA_API_KEY,
  });

  try {
    // Get all users
    const users = await client.users.list();

    // Process each user
    for (const user of users) {
      console.log(`Processing user: ${user.name}`);

      // Update user if needed
      if (user.needsUpdate) {
        await client.users.update(user.id, {
          lastSync: new Date().toISOString(),
        });
      }
    }

    console.log(`Synced ${users.length} users successfully`);
  } catch (error) {
    console.error("Sync failed:", error.message);
  }
}

Getting Help