Documentation Index Fetch the complete documentation index at: https://docs.thena.ai/llms.txt
Use this file to discover all available pages before exploring further.
Custom Integrations
Learn how to create and manage custom integrations to connect your agents with external services and systems.
Custom Integration Overview
Custom integrations allow you to extend your agent’s capabilities by connecting to any external service or system through APIs, webhooks, or other integration methods.
Integration Types
API Integration
REST APIs
GraphQL
SOAP services
Webhook Integration
Event handlers
Callbacks
Notifications
Database Integration
SQL databases
NoSQL databases
Data warehouses
Service Integration
Cloud services
SaaS platforms
Enterprise systems
Building Custom Integrations
Plan Integration
Define integration requirements
Identify endpoints
Plan data flow
Define schema
Implement Connection
Build integration logic
Create client
Handle auth
Map data
Add Error Handling
Implement error management
Validate data
Handle failures
Add retry logic
Test Integration
Verify functionality
Unit tests
Integration tests
Load tests
Integration Structure
interface IntegrationConfig {
name : string ;
type : 'api' | 'webhook' | 'database' ;
auth : {
type : 'oauth' | 'apikey' | 'basic' ;
credentials : Record < string , string >;
};
endpoints : {
base_url : string ;
routes : Record < string , string >;
};
}
class CustomIntegration {
constructor ( config : IntegrationConfig ) {
this . config = config ;
this . client = this . initializeClient ();
}
async connect () : Promise < void > {
await this . authenticate ();
await this . validateConnection ();
}
async execute ( operation : string , data : any ) : Promise < any > {
try {
return await this . client . request ( operation , data );
} catch ( error ) {
this . handleError ( error );
}
}
}
interface DataMapper {
toExternal : ( data : any ) => any ;
fromExternal : ( data : any ) => any ;
validate : ( data : any ) => boolean ;
}
const mapper : DataMapper = {
toExternal : ( data ) => transform ( data ),
fromExternal : ( data ) => normalize ( data ),
validate : ( data ) => validateSchema ( data )
};
Implementation Examples
API Integration
Webhook Handler
Database Integration
class APIIntegration extends CustomIntegration {
async getData ( endpoint : string , params : any ) : Promise < any > {
const response = await this . client . get ( endpoint , { params });
return this . mapper . fromExternal ( response . data );
}
async updateData ( endpoint : string , data : any ) : Promise < void > {
const mappedData = this . mapper . toExternal ( data );
await this . client . post ( endpoint , mappedData );
}
}
Best Practices
Security Implement secure authentication
Error Handling Add comprehensive error management
Monitoring Track integration performance
Documentation Maintain clear documentation
Testing Strategy
Unit Testing
Test individual components
Integration Testing
Test end-to-end flows
Load Testing
Verify performance under load
Security Testing
Validate security measures
Maintenance
Monitoring Track integration health
Updates Keep dependencies current
Optimization Improve performance
Support Maintain documentation
Next Steps