outrnk.

| WhatsApp API Dokumentation

WhatsApp Multi-Session API

Professionelle WhatsApp API für Unternehmen mit Multi-Session Support, ChatBot-Funktionen und Enterprise-Features.

🚀 Multi-Session

Mehrere WhatsApp-Accounts gleichzeitig verwalten

🤖 ChatBot Ready

Webhooks und Message History für ChatBots

🔒 Enterprise

API Keys, Rate Limiting, Monitoring

Base URL

https://wa.outrnk.io

Authentifizierung

Die API verwendet API Keys für die Authentifizierung. Jede Instanz hat einen eigenen API Key.

Gateway API (Empfohlen)

curl -X POST https://wa.outrnk.io/api/send-message \
  -H "X-API-Key: wapi_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"phone": "491234567890", "message": "Hello!"}'

Admin API (für Management)

curl -X POST https://wa.outrnk.io/api/auth/login \
  -H "Content-Type: application/json" \
  -d '{"username": "admin", "password": "your_password"}'

Nachrichten senden

POST /api/send-message

Sendet eine WhatsApp-Nachricht an eine Telefonnummer.

Request Body

{
  "phone": "491234567890",
  "message": "Hallo! Das ist eine Test-Nachricht."
}

Response

{
  "success": true,
  "data": {
    "messageId": "3EB0C767D26A1B2C5F",
    "phone": "491234567890",
    "status": "sent"
  }
}
POST /api/send-bulk

Sendet Nachrichten an mehrere Empfänger gleichzeitig.

{
  "messages": [
    {"phone": "491234567890", "message": "Hallo Person 1!"},
    {"phone": "491234567891", "message": "Hallo Person 2!"}
  ]
}

ChatBot APIs

Spezielle APIs für die Entwicklung von ChatBots mit Message History und Webhook-Support.

GET /api/instances/{id}/chats

Ruft alle Chats mit der letzten Nachricht ab.

curl -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  https://wa.outrnk.io/api/instances/INSTANCE_ID/chats

Response

{
  "success": true,
  "data": [
    {
      "chatId": "491234567890@c.us",
      "lastMessage": {
        "id": "3EB0C767D26A1B2C5F",
        "body": "Hallo!",
        "timestamp": 1703123456789,
        "isFromMe": false,
        "contactName": "Max Mustermann"
      },
      "messageCount": 15
    }
  ]
}
GET /api/instances/{id}/chats/{chatId}/messages

Ruft Nachrichten eines bestimmten Chats ab.

curl -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  "https://wa.outrnk.io/api/instances/INSTANCE_ID/chats/491234567890@c.us/messages?limit=50"
GET /api/instances/{id}/messages/recent

Ruft die neuesten Nachrichten über alle Chats ab.

curl -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  "https://wa.outrnk.io/api/instances/INSTANCE_ID/messages/recent?limit=100"

Webhooks

Konfiguriere Webhooks um über eingehende Nachrichten und Events benachrichtigt zu werden.

POST /api/instances/{id}/webhook

Konfiguriert eine Webhook-URL für eine Instanz.

Request

{
  "url": "https://your-bot.com/webhook",
  "secret": "optional-secret-for-hmac"
}

Webhook Payload

{
  "event": "message",
  "instanceId": "instance-uuid",
  "timestamp": 1703123456789,
  "data": {
    "id": "3EB0C767D26A1B2C5F",
    "chatId": "491234567890@c.us",
    "from": "491234567890@c.us",
    "body": "Hallo Bot!",
    "isFromMe": false,
    "contactName": "Max Mustermann",
    "timestamp": 1703123456789
  }
}

Webhook Events

message

Eingehende Nachricht empfangen

message_sent

Nachricht erfolgreich gesendet

message_ack

Nachricht zugestellt/gelesen

ready

WhatsApp-Instanz verbunden

Kontakte

GET http://57.129.5.88:3010/api/check-number/{phone}

Prüft ob eine Telefonnummer auf WhatsApp registriert ist.

Hinweis: Diese API ist nur direkt über den Instance-Port erreichbar.

curl http://57.129.5.88:3010/api/check-number/491234567890

Response

{
  "success": true,
  "data": {
    "phone": "491234567890",
    "registered": true,
    "whatsappId": "491234567890@c.us"
  }
}
GET http://57.129.5.88:3010/api/contact/{phone}

Ruft Kontaktinformationen ab.

{
  "success": true,
  "data": {
    "id": "491234567890@c.us",
    "name": "Max Mustermann",
    "pushname": "Max",
    "number": "491234567890",
    "isBlocked": false,
    "isBusiness": false
  }
}

Beispiele

Einfacher ChatBot (Node.js)

const express = require('express');
const axios = require('axios');

const app = express();
app.use(express.json());

const CONFIG = {
  whatsappApiUrl: 'https://wa.outrnk.io',
  apiKey: 'wapi_YOUR_API_KEY'
};

// Webhook Endpoint
app.post('/webhook', async (req, res) => {
  const { event, data } = req.body;
  
  if (event === 'message' && !data.isFromMe) {
    const phone = data.from.replace('@c.us', '');
    const message = data.body.toLowerCase();
    
    let response = null;
    
    if (message.includes('hallo')) {
      response = `Hallo ${data.contactName}! Wie kann ich dir helfen?`;
    } else if (message.includes('hilfe')) {
      response = 'Verfügbare Befehle: hallo, hilfe, zeit';
    } else if (message.includes('zeit')) {
      response = `Aktuelle Zeit: ${new Date().toLocaleString('de-DE')}`;
    }
    
    if (response) {
      await axios.post(`${CONFIG.whatsappApiUrl}/api/send-message`, {
        phone,
        message: response
      }, {
        headers: { 'X-API-Key': CONFIG.apiKey }
      });
    }
  }
  
  res.json({ success: true });
});

app.listen(4000, () => {
  console.log('ChatBot läuft auf Port 4000');
});

Python Beispiel

import requests
import json

API_URL = "https://wa.outrnk.io"
API_KEY = "wapi_YOUR_API_KEY"

def send_message(phone, message):
    headers = {
        "X-API-Key": API_KEY,
        "Content-Type": "application/json"
    }
    
    data = {
        "phone": phone,
        "message": message
    }
    
    response = requests.post(
        f"{API_URL}/api/send-message",
        headers=headers,
        json=data
    )
    
    return response.json()

# Nachricht senden
result = send_message("491234567890", "Hallo von Python!")
print(result)

Fehlerbehandlung

HTTP Status Codes

200 Erfolgreich
400 Ungültige Anfrage
401 Nicht authentifiziert
503 WhatsApp nicht verbunden

Fehler Response

{
  "success": false,
  "error": "WhatsApp not connected",
  "code": "WHATSAPP_DISCONNECTED"
}

Rate Limiting

Die API implementiert intelligentes Rate Limiting um WhatsApp-Sperren zu vermeiden:

  • 1.5-3 Sekunden Verzögerung zwischen Nachrichten
  • Automatische Retry-Logik bei Fehlern
  • Queue-System für Bulk-Nachrichten