Managing Integrations
Create, update, and manage integrations for AI agents.
Creating an Integration
Section titled “Creating an Integration”import { BeepsClient } from "@beepsdev/sdk";
const client = new BeepsClient({ apiKey: process.env.BEEPS_API_KEY,});
const integration = await client.integration.create({ name: "Devin Production", provider: "devin", apiKey: process.env.DEVIN_API_KEY, metadata: { environment: "production", endpoint: "https://api.devin.ai/v3/organizations/sessions", },});
console.log(`Created integration: ${integration.id}`);Devin Integration
Section titled “Devin Integration”const devin = await client.integration.create({ name: "Devin Agent", provider: "devin", apiKey: "devin_api_key_here", metadata: { workspace: "production", defaultPriority: "high", },});Cursor Integration
Section titled “Cursor Integration”const cursor = await client.integration.create({ name: "Cursor Agent", provider: "cursor", apiKey: "cursor_api_key_here",});Safe Method (No Exceptions)
Section titled “Safe Method (No Exceptions)”const result = await client.integration.createSafe({ name: "Devin Production", provider: "devin", apiKey: process.env.DEVIN_API_KEY,});
if (result.error) { console.error("Failed to create integration:", result.error.message);} else { console.log(`Created: ${result.data.id}`);}curl -X POST https://api.beeps.dev/integrations \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "name": "Devin Production", "provider": "devin", "apiKey": "devin_api_key_here", "metadata": { "environment": "production" } }'Response:
{ "integration": { "id": "int_abc123", "organizationId": "org_xyz789", "name": "Devin Production", "provider": "devin", "apiKey": "***", "metadata": { "environment": "production" }, "createdBy": "usr_alice", "createdAt": "2025-01-15T10:30:00Z", "updatedAt": "2025-01-15T10:30:00Z", "deletedAt": null }}Listing Integrations
Section titled “Listing Integrations”const integrations = await client.integration.list();
console.log(`Found ${integrations.length} integrations:`);integrations.forEach((integration) => { console.log(`- ${integration.name} (${integration.provider})`);});Filter by Provider
Section titled “Filter by Provider”const integrations = await client.integration.list();
const devinIntegrations = integrations.filter( (i) => i.provider === "devin");const cursorIntegrations = integrations.filter( (i) => i.provider === "cursor");
console.log(`Devin: ${devinIntegrations.length}`);console.log(`Cursor: ${cursorIntegrations.length}`);curl -X GET https://api.beeps.dev/integrations \ -H "Authorization: Bearer YOUR_API_KEY"Response:
{ "integrations": [ { "id": "int_abc123", "organizationId": "org_xyz789", "name": "Devin Production", "provider": "devin", "apiKey": "***", "metadata": { "environment": "production" }, "createdBy": "usr_alice", "createdAt": "2025-01-15T10:30:00Z", "updatedAt": "2025-01-15T10:30:00Z", "deletedAt": null } ]}Getting a Specific Integration
Section titled “Getting a Specific Integration”const integration = await client.integration.get("int_abc123");
console.log(`Name: ${integration.name}`);console.log(`Provider: ${integration.provider}`);console.log(`Metadata:`, integration.metadata);curl -X GET https://api.beeps.dev/integrations/int_abc123 \ -H "Authorization: Bearer YOUR_API_KEY"Updating an Integration
Section titled “Updating an Integration”const updated = await client.integration.update("int_abc123", { name: "Devin Production (Updated)", apiKey: process.env.NEW_DEVIN_API_KEY, metadata: { environment: "production", version: "v2", },});
console.log("Integration updated");Update Name Only
Section titled “Update Name Only”const updated = await client.integration.update("int_abc123", { name: "New Integration Name",});Rotate API Key
Section titled “Rotate API Key”const updated = await client.integration.update("int_abc123", { apiKey: process.env.NEW_API_KEY,});console.log("API key rotated");Update Metadata
Section titled “Update Metadata”const updated = await client.integration.update("int_abc123", { metadata: { endpoint: "https://new-endpoint.example.com", timeout: 60000, },});curl -X PUT https://api.beeps.dev/integrations/int_abc123 \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "name": "Devin Production (Updated)", "apiKey": "new_api_key_here" }'Deleting an Integration
Section titled “Deleting an Integration”await client.integration.delete("int_abc123");console.log("Integration deleted successfully");Safe Method
Section titled “Safe Method”const result = await client.integration.deleteSafe("int_abc123");
if (result.error) { console.error("Failed to delete:", result.error.message);} else { console.log("Deleted:", result.data.success);}curl -X DELETE https://api.beeps.dev/integrations/int_abc123 \ -H "Authorization: Bearer YOUR_API_KEY"Response:
{ "success": true}Type Definitions
Section titled “Type Definitions”IntegrationProvider
Section titled “IntegrationProvider”type IntegrationProvider = "devin" | "cursor";CreateIntegrationInput
Section titled “CreateIntegrationInput”type CreateIntegrationInput = { name: string; // Integration name provider: IntegrationProvider; // Service provider apiKey: string; // API key (stored securely) metadata?: Record<string, unknown>; // Provider-specific config};UpdateIntegrationInput
Section titled “UpdateIntegrationInput”type UpdateIntegrationInput = { name?: string; // Update name apiKey?: string; // Rotate API key metadata?: Record<string, unknown>; // Update metadata};Integration
Section titled “Integration”type Integration = { id: string; organizationId: string; name: string; provider: IntegrationProvider; apiKey: string; // Always returns "***" for security metadata: Record<string, unknown> | null; createdBy: string; // User who created it createdAt: string; updatedAt: string; deletedAt: string | null;};Common Patterns
Section titled “Common Patterns”Complete Setup with Relay Rule
Section titled “Complete Setup with Relay Rule”const integration = await client.integration.create({ name: "Devin Auto-Triage", provider: "devin", apiKey: process.env.DEVIN_API_KEY,});
const relay = await client.relay.create({ name: "Production Alerts",});
await client.relay.rules.create(relay.id, { name: "AI triage first", ruleType: "agent", order: 1, config: { agentType: "devin", integrationId: integration.id, pollInterval: 30000, },});
await client.relay.rules.create(relay.id, { name: "Escalate to humans", ruleType: "schedule_notify", order: 2, config: { scheduleId: "sch_oncall", },});Key Rotation
Section titled “Key Rotation”const integrations = await client.integration.list();
for (const integration of integrations) { if (integration.provider === "devin") { await client.integration.update(integration.id, { apiKey: process.env.NEW_DEVIN_KEY, }); console.log(`Rotated key for ${integration.name}`); }}Environment-Specific Integrations
Section titled “Environment-Specific Integrations”const environments = ["development", "staging", "production"];
for (const env of environments) { await client.integration.create({ name: `Devin - ${env}`, provider: "devin", apiKey: process.env[`DEVIN_${env.toUpperCase()}_KEY`], metadata: { environment: env, }, });}Troubleshooting
Section titled “Troubleshooting”AI agent not responding? See Troubleshooting - AI Agent Never Responds.