External Systems Integration¶
This guide provides information on integrating the Bluefly LLM ecosystem with external systems and services.
Overview¶
The Bluefly LLM ecosystem can be integrated with various external systems to enhance functionality and extend capabilities:
- Enterprise Systems: CRM, ERP, and knowledge management systems
- Messaging Platforms: Slack, Microsoft Teams, Discord
- Document Management: SharePoint, Google Drive, Confluence
- Customer Support: Zendesk, Intercom, Freshdesk
- Development Tools: GitHub, GitLab, Jira
Integration Approaches¶
There are four primary approaches to integrating with external systems:
- Direct API Integration: Calling Bluefly APIs from external systems
- Webhooks: Event-driven integration using webhooks
- Connectors: Pre-built connectors for common platforms
- Custom Applications: Building custom applications that bridge systems
Common Integration Patterns¶
Sync Integration Pattern¶
The synchronous integration pattern involves direct API calls with immediate responses:
sequenceDiagram
External System->>Bluefly API: API Request
Bluefly API->>Bluefly API: Process Request
Bluefly API->>External System: API Response
This pattern is suitable for real-time integrations where immediate responses are required.
Async Integration Pattern¶
The asynchronous integration pattern uses webhooks for non-blocking operations:
sequenceDiagram
External System->>Bluefly API: Submit Request
Bluefly API->>External System: Acknowledge (Request ID)
Bluefly API->>Bluefly API: Process Request (Background)
Bluefly API->>External System: Webhook Notification (Result)
This pattern is ideal for long-running processes and background operations.
Enterprise System Integrations¶
Salesforce Integration¶
Integrate Bluefly with Salesforce to enhance customer interactions:
- Install the Bluefly Salesforce App from AppExchange
- Configure API credentials in the Bluefly setup page
- Set up data mapping between Salesforce objects and Bluefly data
Example Salesforce Apex code:
public class BlueflyIntegration {
@InvocableMethod(label='Generate Content' description='Generates content using Bluefly AI')
public static List<String> generateContent(List<String> prompts) {
List<String> results = new List<String>();
BlueflyAPI api = new BlueflyAPI();
for (String prompt : prompts) {
String result = api.generateText(prompt);
results.add(result);
}
return results;
}
}
SAP Integration¶
Integrate with SAP systems using the SAP Cloud Platform:
- Create a destination in SAP Cloud Platform Integration
- Configure the Bluefly API endpoint and authentication
- Develop integration flows using SAP Integration Designer
Messaging Platform Integrations¶
Slack Integration¶
The Bluefly Slack app provides AI capabilities within Slack:
- Install the Bluefly Slack app from the Slack App Directory
- Configure API credentials in the app settings
- Set up slash commands for accessing Bluefly features
Example slash commands:
/bluefly generate "Write a product description for our new feature"
/bluefly analyze "Customer feedback text"
/bluefly summarize "URL of document to summarize"
Microsoft Teams Integration¶
Integrate Bluefly with Microsoft Teams:
- Install the Bluefly Teams app from the Microsoft Teams Store
- Configure the app with your Bluefly API credentials
- Add the Bluefly bot to channels where you want to use it
Example Teams card for content generation:
{
"type": "AdaptiveCard",
"version": "1.0",
"body": [
{
"type": "TextBlock",
"text": "Generate Content",
"weight": "bolder",
"size": "medium"
},
{
"type": "Input.Text",
"placeholder": "Enter your prompt",
"id": "promptInput",
"isMultiline": true
}
],
"actions": [
{
"type": "Action.Submit",
"title": "Generate",
"data": {
"action": "generate"
}
}
]
}
Document Management Integrations¶
SharePoint Integration¶
Integrate Bluefly with SharePoint for document processing:
- Install the Bluefly SharePoint app from the SharePoint Store
- Configure the app with your Bluefly API credentials
- Set up document libraries for automated processing
Example SharePoint Flow for document processing:
{
"trigger": {
"type": "sharePointFileCreated",
"library": "Documents"
},
"actions": [
{
"type": "blueflyProcessDocument",
"file": "@triggerOutputs().body.webUrl",
"options": {
"extractText": true,
"summarize": true,
"tags": true
}
},
{
"type": "updateSharePointMetadata",
"file": "@triggerOutputs().body.webUrl",
"metadata": {
"Summary": "@outputs('blueflyProcessDocument').summary",
"Tags": "@outputs('blueflyProcessDocument').tags"
}
}
]
}
Confluence Integration¶
Integrate Bluefly with Atlassian Confluence:
- Install the Bluefly Confluence app from the Atlassian Marketplace
- Configure the app with your Bluefly API credentials
- Use macros in Confluence pages to access Bluefly features
Example macro usage:
{bluefly-generate:prompt=Write a technical explanation of our product architecture|model=bluefly-text-1|tone=technical}
Customer Support Integrations¶
Zendesk Integration¶
Enhance Zendesk support with Bluefly AI capabilities:
- Install the Bluefly Zendesk app from the Zendesk Marketplace
- Configure the app with your Bluefly API credentials
- Set up automation for ticket processing and response generation
Example Zendesk automation:
{
"title": "Auto-categorize Tickets",
"conditions": {
"all": [
{
"field": "status",
"operator": "is",
"value": "new"
}
]
},
"actions": [
{
"field": "bluefly_analyze",
"value": "ticket.description"
},
{
"field": "tags",
"value": "{{bluefly_categories}}"
}
]
}
Development Tool Integrations¶
GitHub Integration¶
Integrate Bluefly with GitHub for code and documentation assistance:
- Install the Bluefly GitHub app from the GitHub Marketplace
- Configure repositories for Bluefly to access
- Set up GitHub Actions for automated processing
Example GitHub Action:
name: Generate Documentation
on:
push:
branches: [ main ]
paths:
- 'src/**'
jobs:
document:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Generate Documentation
uses: bluefly/document-action@v1
with:
api_key: ${{ secrets.BLUEFLY_API_KEY }}
source_files: 'src/**/*.js'
output_dir: 'docs/generated'
model: 'bluefly-doc-1'
- name: Commit Documentation
uses: EndBug/add-and-commit@v7
with:
message: 'docs: Update generated documentation'
add: 'docs/generated'
Jira Integration¶
Integrate Bluefly with Jira for issue management enhancement:
- Install the Bluefly Jira app from the Atlassian Marketplace
- Configure the app with your Bluefly API credentials
- Set up Jira automations for issue processing
Example automation rule:
{
"name": "Summarize Issue Comments",
"trigger": {
"component": "TRIGGER",
"schemaVersion": 1,
"type": "jira.issue.commented",
"value": {
"commentId": "{{comment.id}}",
"issueId": "{{issue.id}}"
}
},
"components": [
{
"component": "ACTION",
"schemaVersion": 1,
"type": "bluefly.summarize",
"value": {
"text": "{{comment.body}}",
"destination": "issue.property.bluefly_summary"
}
}
]
}
Custom Integration Development¶
Integration Architecture¶
When building custom integrations, consider this reference architecture:
graph TD
A[External System] ---> B[Integration Layer]
B ---> C[Bluefly API]
B ---> D[Message Queue]
D ---> E[Background Processor]
E ---> C
E ---> F[Webhook Handler]
F ---> A
Securing Integrations¶
Secure your integrations using these practices:
- API Key Management: Securely store API keys in environment variables or secrets managers
- Request Signing: Sign webhook requests using shared secrets
- IP Restrictions: Restrict API access to specific IP addresses
- Rate Limiting: Implement rate limiting in your integration
- Audit Logging: Log all API requests and responses for audit purposes
Error Handling¶
Implement robust error handling in your integration:
async function processWithRetry(apiFunction, params, maxRetries = 3) {
let retries = 0;
while (retries < maxRetries) {
try {
return await apiFunction(params);
} catch (error) {
if (error.status === 429) {
// Rate limit exceeded, wait and retry
const retryAfter = parseInt(error.headers['retry-after'] || '1') * 1000;
await new Promise(resolve => setTimeout(resolve, retryAfter));
retries++;
} else if (error.status >= 500) {
// Server error, retry with backoff
await new Promise(resolve => setTimeout(resolve, 1000 * Math.pow(2, retries)));
retries++;
} else {
// Client error or other issue, don't retry
throw error;
}
}
}
throw new Error(`Failed after ${maxRetries} retries`);
}
Integration Testing¶
Test your integrations thoroughly:
- Unit Tests: Test individual components of your integration
- Integration Tests: Test the interaction between your system and Bluefly
- End-to-End Tests: Test complete workflows
- Load Tests: Test performance under load
Example integration test:
test('should process document correctly', async () => {
// Setup
const mockDocument = fs.readFileSync('test/fixtures/sample.pdf');
const mockExternalSystem = new MockExternalSystem();
const integration = new BlueflyIntegration(mockExternalSystem);
// Act
await integration.processDocument(mockDocument);
// Assert
expect(mockExternalSystem.metadata).toHaveProperty('summary');
expect(mockExternalSystem.metadata).toHaveProperty('tags');
expect(mockExternalSystem.metadata.summary).not.toBeEmpty();
});
Monitoring and Troubleshooting¶
Monitor your integrations for issues:
- API Usage Dashboards: Track API usage and quota consumption
- Error Rate Monitoring: Monitor error rates and types
- Response Time Tracking: Track API response times
- Webhook Delivery Monitoring: Monitor webhook delivery success rates
Troubleshooting tools:
- Request ID Tracing: Use request IDs to trace requests across systems
- Detailed Logging: Implement detailed logging for debugging
- Integration Health Checks: Set up regular health checks
Best Practices¶
- Rate Limiting: Implement proper rate limiting and backoff strategies
- Batch Processing: Use batch API endpoints for bulk operations
- Caching: Cache responses where appropriate
- Idempotent Operations: Design operations to be idempotent
- Graceful Degradation: Handle API downtime gracefully