Skip to content

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:

  1. Direct API Integration: Calling Bluefly APIs from external systems
  2. Webhooks: Event-driven integration using webhooks
  3. Connectors: Pre-built connectors for common platforms
  4. 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:

  1. Install the Bluefly Salesforce App from AppExchange
  2. Configure API credentials in the Bluefly setup page
  3. 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:

  1. Create a destination in SAP Cloud Platform Integration
  2. Configure the Bluefly API endpoint and authentication
  3. Develop integration flows using SAP Integration Designer

Messaging Platform Integrations

Slack Integration

The Bluefly Slack app provides AI capabilities within Slack:

  1. Install the Bluefly Slack app from the Slack App Directory
  2. Configure API credentials in the app settings
  3. 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:

  1. Install the Bluefly Teams app from the Microsoft Teams Store
  2. Configure the app with your Bluefly API credentials
  3. 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:

  1. Install the Bluefly SharePoint app from the SharePoint Store
  2. Configure the app with your Bluefly API credentials
  3. 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:

  1. Install the Bluefly Confluence app from the Atlassian Marketplace
  2. Configure the app with your Bluefly API credentials
  3. 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:

  1. Install the Bluefly Zendesk app from the Zendesk Marketplace
  2. Configure the app with your Bluefly API credentials
  3. 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:

  1. Install the Bluefly GitHub app from the GitHub Marketplace
  2. Configure repositories for Bluefly to access
  3. 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:

  1. Install the Bluefly Jira app from the Atlassian Marketplace
  2. Configure the app with your Bluefly API credentials
  3. 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:

  1. API Key Management: Securely store API keys in environment variables or secrets managers
  2. Request Signing: Sign webhook requests using shared secrets
  3. IP Restrictions: Restrict API access to specific IP addresses
  4. Rate Limiting: Implement rate limiting in your integration
  5. 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:

  1. Unit Tests: Test individual components of your integration
  2. Integration Tests: Test the interaction between your system and Bluefly
  3. End-to-End Tests: Test complete workflows
  4. 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:

  1. API Usage Dashboards: Track API usage and quota consumption
  2. Error Rate Monitoring: Monitor error rates and types
  3. Response Time Tracking: Track API response times
  4. Webhook Delivery Monitoring: Monitor webhook delivery success rates

Troubleshooting tools:

  1. Request ID Tracing: Use request IDs to trace requests across systems
  2. Detailed Logging: Implement detailed logging for debugging
  3. Integration Health Checks: Set up regular health checks

Best Practices

  1. Rate Limiting: Implement proper rate limiting and backoff strategies
  2. Batch Processing: Use batch API endpoints for bulk operations
  3. Caching: Cache responses where appropriate
  4. Idempotent Operations: Design operations to be idempotent
  5. Graceful Degradation: Handle API downtime gracefully