> ## Documentation Index
> Fetch the complete documentation index at: https://koreai.mintlify.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Integrations

# Integrations

Connect AI for Service to enterprise systems.

***

## Overview

AI for Service provides 30+ pre-built integrations and support for custom APIs:

* **CRM** — Salesforce, HubSpot, Dynamics
* **Ticketing** — Zendesk, ServiceNow, Jira
* **Commerce** — Shopify, Magento
* **Communication** — Twilio, SendGrid

***

## Pre-built Integrations

### CRM Integrations

#### Salesforce

```yaml theme={null}
Salesforce Integration:
  auth: oauth2
  actions:
    - get_contact
    - create_case
    - update_opportunity
    - search_accounts
  objects:
    - Contact
    - Case
    - Account
    - Opportunity
```

Available actions:

| Action            | Description                     |
| ----------------- | ------------------------------- |
| **Get Contact**   | Retrieve contact by ID or email |
| **Create Case**   | Create new support case         |
| **Update Case**   | Update case status, notes       |
| **Search**        | Query any Salesforce object     |
| **Create Record** | Create custom objects           |

#### HubSpot

```yaml theme={null}
HubSpot Integration:
  auth: api_key
  actions:
    - get_contact
    - create_deal
    - add_note
    - update_contact
```

#### Microsoft Dynamics

```yaml theme={null}
Dynamics Integration:
  auth: oauth2
  environment: production
  actions:
    - get_account
    - create_lead
    - update_contact
```

### Ticketing Integrations

#### Zendesk

```yaml theme={null}
Zendesk Integration:
  auth: api_token
  actions:
    - create_ticket
    - get_ticket
    - update_ticket
    - add_comment
    - search_articles
```

#### ServiceNow

```yaml theme={null}
ServiceNow Integration:
  auth: oauth2
  instance: company.service-now.com
  actions:
    - create_incident
    - get_incident
    - update_incident
    - get_knowledge
```

#### Jira Service Management

```yaml theme={null}
Jira Integration:
  auth: api_token
  actions:
    - create_issue
    - get_issue
    - add_comment
    - transition_issue
```

### Commerce Integrations

#### Shopify

```yaml theme={null}
Shopify Integration:
  auth: api_key
  actions:
    - get_order
    - get_product
    - search_orders
    - create_refund
```

### Communication Integrations

#### Twilio

```yaml theme={null}
Twilio Integration:
  auth: api_credentials
  actions:
    - send_sms
    - make_call
    - get_call_status
```

#### SendGrid

```yaml theme={null}
SendGrid Integration:
  auth: api_key
  actions:
    - send_email
    - send_template_email
```

***

## Custom API Integration

### Create Custom Action

1. Navigate to **Integrations** → **Custom Actions**
2. Click **Create Action**
3. Configure:

```yaml theme={null}
Action: Get Weather
Method: GET
URL: https://api.weather.com/v1/forecast
Headers:
  X-API-Key: "{{env.WEATHER_API_KEY}}"
Query Parameters:
  location: "{{location}}"
  units: "metric"
Response Mapping:
  temperature: $.forecast.temp
  conditions: $.forecast.conditions
  humidity: $.forecast.humidity
```

### Authentication Types

| Type             | Use Case                                  |
| ---------------- | ----------------------------------------- |
| **API Key**      | Simple API authentication                 |
| **OAuth 2.0**    | Enterprise apps (for example, Salesforce) |
| **Basic Auth**   | Username/password                         |
| **Bearer Token** | JWT-based auth                            |
| **Custom**       | Custom header schemes                     |

### OAuth 2.0 Configuration

```yaml theme={null}
OAuth Config:
  authorization_url: https://auth.example.com/authorize
  token_url: https://auth.example.com/token
  client_id: "{{env.OAUTH_CLIENT_ID}}"
  client_secret: "{{env.OAUTH_CLIENT_SECRET}}"
  scopes:
    - read
    - write
  grant_type: authorization_code
```

***

## Using Integrations in Dialogs

### Action Node

Add integration calls to dialog flows:

```yaml theme={null}
Node: Get Order Status
Type: action
Action: shopify.get_order
Input:
  order_id: "{{context.session.order_id}}"
Output:
  order_status: response.status
  tracking_number: response.tracking
  delivery_date: response.estimated_delivery
On Success: display_order_status
On Failure: handle_error
```

### Error Handling

```yaml theme={null}
Error Handling:
  timeout: 10s
  retry:
    count: 2
    delay: 1s
  fallback:
    message: "I'm having trouble accessing that information. Let me connect you with an agent."
    action: transfer_to_agent
```

***

## Agent Transfer Integrations

### Transfer to Live Agent

Connect to contact center platforms:

| Platform       | Features                      |
| -------------- | ----------------------------- |
| **Genesys**    | Context transfer, routing     |
| **Salesforce** | Omni-channel, case creation   |
| **Zendesk**    | Chat handoff, ticket creation |
| **Custom**     | Webhook-based transfer        |

### Transfer Configuration

```yaml theme={null}
Agent Transfer:
  platform: genesys
  queue_selection:
    method: skill_based
    skills:
      - from_context: issue_type
        mapping:
          billing: billing_queue
          technical: tech_support
  context_transfer:
    - conversation_summary
    - customer_info
    - detected_intent
    - sentiment_score
  pre_transfer_message: "Connecting you with a specialist..."
```

***

## External NLU Adapters

### Connect External NLU

Use external NLU services:

| Provider       | Features                  |
| -------------- | ------------------------- |
| **Dialogflow** | Intent, entity, sentiment |
| **LUIS**       | Microsoft NLU             |
| **Amazon Lex** | AWS NLU                   |
| **Custom**     | Any NLU via API           |

### Configuration

```yaml theme={null}
External NLU: Dialogflow
Project ID: your-project
Credentials: service-account.json
Language: en
Use For:
  - intent_detection
  - entity_extraction
Fallback: built_in_nlu
```

***

## Voice Platform Integrations

### IVR Integration

Connect to IVR platforms:

| Platform           | Integration Type |
| ------------------ | ---------------- |
| **Twilio**         | Native           |
| **Amazon Connect** | Native           |
| **Genesys**        | SIP/webhook      |
| **Avaya**          | SIP/webhook      |
| **Cisco**          | VXML/webhook     |

### Voice Gateway

```yaml theme={null}
Voice Gateway:
  provider: twilio
  phone_numbers:
    - "+1-800-123-4567"
    - "+1-800-765-4321"
  sip_trunk:
    uri: sip.twilio.com
    credentials: "{{env.SIP_CREDENTIALS}}"
  recording:
    enabled: true
    storage: s3
```

***

## Data Tables

### Internal Data Storage

Store and query data within AI for Service:

```yaml theme={null}
Data Table: Product Catalog
Columns:
  - name: product_id
    type: string
    primary: true
  - name: name
    type: string
  - name: price
    type: number
  - name: category
    type: string
    indexed: true
```

### Query Data

```javascript theme={null}
// In dialog script
const product = await dataTable.query('products', {
  where: { category: 'electronics' },
  orderBy: 'price',
  limit: 10
});
```

***

## Best Practices

### Security

* Use environment variables for credentials
* Enable OAuth where available
* Limit scopes to required permissions
* Rotate API keys regularly
* Monitor API usage

### Performance

* Set appropriate timeouts
* Implement retry logic
* Cache frequently accessed data
* Use async calls where possible
* Monitor latency

### Error Handling

* Always handle failures gracefully
* Provide user-friendly error messages
* Log errors for debugging
* Implement fallback paths
* Alert on critical failures

***
