Sentry

OpenClaw Integration

Build powerful AI agents that can automate payment workflows, send invoices, manage customers, and analyze sales data using the Sentry Payments API.

Why OpenClaw + Sentry Payments?

  • 🤖 AI-powered invoicing - Agents can listen for customer requests and automatically send invoices
  • 📊 Smart analytics - Agents can analyze sales data and provide business insights
  • 🔐 Secure scoped access - API keys with granular permissions for safe automation
  • 🔄 Real-time updates - Agents can monitor payment status and send reminders

Getting Started

Follow these steps to create an OpenClaw skill that integrates with Sentry Payments:

1

Create API Key

In your merchant portal, go to Settings → API Keys and create a new key with appropriate scopes:

customer:read, customer:write, invoice:read, invoice:write, sales:read
2

Store API Key Securely

Store the API key in OpenClaw's secure environment variables:

SENTRY_API_KEY=sntr_abcdefghijklmnopqrstuvwxyz123456
SENTRY_BASE_URL=https://sandbox.sentrypos.app
3

Build Your Skill

Create an OpenClaw skill that uses the Sentry Payments API to perform actions on behalf of your merchant account.

Example Skill: Invoice Assistant

Here's a complete example of an OpenClaw skill that can send invoices:

invoice-assistant.js

const SENTRY_API_KEY = process.env.SENTRY_API_KEY;
const SENTRY_BASE_URL = process.env.SENTRY_BASE_URL;

class InvoiceAssistant {
  constructor() {
    this.headers = {
      'Authorization': `Bearer ${SENTRY_API_KEY}`,
      'Content-Type': 'application/json'
    };
  }

  async sendInvoice(customerInfo, amount, description) {
    try {
      // Create or update customer
      const customerResponse = await fetch(`${SENTRY_BASE_URL}/public/api/v1/customers`, {
        method: 'POST',
        headers: this.headers,
        body: JSON.stringify({
          name: customerInfo.name,
          phone: customerInfo.phone,
          email: customerInfo.email
        })
      });

      if (!customerResponse.ok) {
        throw new Error(`Failed to create customer: ${await customerResponse.text()}`);
      }

      const customerData = await customerResponse.json();
      
      // Create invoice
      const invoiceResponse = await fetch(`${SENTRY_BASE_URL}/public/api/v1/invoices`, {
        method: 'POST',
        headers: this.headers,
        body: JSON.stringify({
          customerId: customerData.customer.id,
          amountCents: Math.round(amount * 100), // Convert dollars to cents
          description: description,
          sendVia: 'SMS' // Send immediately via SMS
        })
      });

      if (!invoiceResponse.ok) {
        throw new Error(`Failed to create invoice: ${await invoiceResponse.text()}`);
      }

      const invoiceData = await invoiceResponse.json();
      
      return {
        success: true,
        invoiceId: invoiceData.invoice.id,
        customerName: customerInfo.name,
        amount: amount,
        paymentUrl: invoiceData.invoice.paymentUrl,
        message: `Invoice sent to ${customerInfo.phone}`
      };
      
    } catch (error) {
      return {
        success: false,
        error: error.message
      };
    }
  }

  async getSalesSummary(days = 30) {
    try {
      const startDate = new Date();
      startDate.setDate(startDate.getDate() - days);
      
      const response = await fetch(
        `${SENTRY_BASE_URL}/public/api/v1/sales/summary?startDate=${startDate.toISOString().split('T')[0]}`,
        { headers: this.headers }
      );

      if (!response.ok) {
        throw new Error(`Failed to get sales summary: ${await response.text()}`);
      }

      return await response.json();
      
    } catch (error) {
      return {
        success: false,
        error: error.message
      };
    }
  }
}

module.exports = InvoiceAssistant;

Skill Patterns

Common patterns for OpenClaw skills integrating with Sentry Payments:

Invoice on Demand

Agent listens for customer requests and sends invoices automatically:

User: "Send an invoice to John for $250 for consulting"
Agent: 
1. Looks up John's contact info
2. Creates invoice via API
3. Sends via SMS
4. Confirms with payment link

Sales Analyst

Agent analyzes sales data and provides insights:

User: "How did we do last month?"
Agent:
1. Fetches sales summary for last 30 days
2. Calculates growth, averages, trends
3. Identifies top customers
4. Reports on payment success rate

Payment Reminder

Agent monitors unpaid invoices and sends reminders:

Agent (scheduled task):
1. Lists all unpaid invoices > 7 days old
2. Sends reminder via API
3. Logs which reminders were sent
4. Escalates to merchant if needed

API Key Scopes for Common Use Cases

Agent TypeRequired ScopesDescription
Invoice Assistantcustomer:write,invoice:writeSend invoices to customers
Sales Analystsales:read,invoice:readAnalyze sales data and trends
Customer Managercustomer:read,customer:writeManage customer profiles
Full Business Assistantcustomer:read,customer:write,invoice:read,invoice:write,sales:readComplete business automation

Security Best Practices

✅ Least Privilege

Only grant the scopes your agent actually needs. An invoice assistant doesn't need sales:read.

⚠️ Key Rotation

Set API key expiration dates and rotate keys periodically (every 90 days for production).

🔒 IP Restrictions

If your OpenClaw instance has a static IP, restrict the API key to that IP address.

📝 Audit Trail

Use descriptive API key names like "OpenClaw-Invoice-Bot" for clear audit trails.

Testing Your Integration

Test your OpenClaw skill with the sandbox environment before going to production:

Test Script

// test-invoice-assistant.js
const InvoiceAssistant = require('./invoice-assistant');
const assistant = new InvoiceAssistant();

async function test() {
  console.log('Testing Invoice Assistant...');
  
  // Test 1: Send invoice
  const result = await assistant.sendInvoice(
    {
      name: 'Test Customer',
      phone: '2025550199',
      email: 'test@example.com'
    },
    99.99,
    'Test invoice from OpenClaw'
  );
  
  console.log('Invoice Result:', result);
  
  // Test 2: Get sales summary
  const summary = await assistant.getSalesSummary(7);
  console.log('Sales Summary:', summary);
}

test().catch(console.error);

Ready to Build?

Start building your OpenClaw skill today with the comprehensive Sentry Payments API.