# 3. Third-Party Tool Integration

User Type: **Super Administrator**
Source: *Mi Digital Academy - Education CRM Features Document*

---

## 3. Third-Party Tool Integration

### 3.1 Google Drive Integration
**What it does:** Connects Google Drive for content storage, sharing, and import into the platform.
**Sub-features:**
- OAuth connection (service account or user OAuth).
- Content import (import Drive files as platform content).
- Content sharing (share platform content to Drive).
- Folder mapping (Drive folders to platform categories).
- available on web
- event logging (action performed)
- Audit logging of Google Drive integration
**Super Admin User Journey:**
1. Open Integrations & APIs → Third-Party Tools → Google Drive.
2. Connect via OAuth (service account or user).
3. Map Drive folders to platform categories.
4. Run a test import and verify the content.
5. Activate the integration.
**Rules & Edge Cases:**
- A file without read permission is skipped and flagged.
- An unsupported file type is not imported and is flagged.
- A Drive file deleted after import leaves the platform copy intact (marked orphaned).
- A re-import of the same file updates the existing content (not a duplicate).

### 3.2 Video Conferencing Integration
**What it does:** Integrates Zoom and Microsoft Teams for live sessions and webinars.
**Sub-features:**
- Provider selection (Zoom, Microsoft Teams).
- API credentials and account binding.
- Meeting creation (auto-create for scheduled sessions).
- Join-link generation and distribution.
- available on web
- event logging (action performed)
- Audit logging of video conferencing integration
**Super Admin User Journey:**
1. Open Third-Party Tools → Video Conferencing.
2. Select the provider and enter the API credentials.
3. Bind the provider account.
4. Run a test meeting creation.
5. Activate the integration.
**Rules & Edge Cases:**
- A session with no provider available falls back to the platform's built-in option or is blocked.
- A meeting creation failure is retried and logged; the session is flagged.
- A join link is only generated for enrolled participants.
- A credential expiry suspends the integration and raises an alert.

### 3.3 Payment Gateway Integration
**What it does:** Integrates Stripe, PayPal, and Peach Payments for subscription and one-time payments.
**Sub-features:**
- Gateway selection (Stripe, PayPal, Peach Payments).
- API keys and webhook endpoint configuration.
- Payment method mapping (plans to gateway products/prices).
- Currency and tax settings.
- Refund and chargeback handling.
- available on web
- event logging (action performed)
- Audit logging of payment gateway integration
**Super Admin User Journey:**
1. Open Third-Party Tools → Payment Gateway.
2. Select the gateway and enter the API keys.
3. Configure the webhook endpoint.
4. Map plans to gateway products/prices.
5. Set currency/tax and run a test transaction.
**Rules & Edge Cases:**
- A payment failure does not activate the subscription; the user is prompted to retry.
- A webhook event is idempotent (duplicate events do not double-apply).
- A chargeback flags the account and suspends access per the policy.
- A refund reverses the subscription access per the refund policy.
- A gateway with invalid API keys fails the test transaction and stays disabled.

### 3.4 Email Marketing Integration
**What it does:** Integrates Mailchimp for email campaigns and audience management.
**Sub-features:**
- Mailchimp API key and audience selection.
- Audience sync (students, parents, leads to Mailchimp lists).
- Campaign triggers (welcome, milestone, re-engagement).
- Tag and segment mapping.
- available on web
- event logging (action performed)
- Audit logging of email marketing integration
**Super Admin User Journey:**
1. Open Third-Party Tools → Email Marketing.
2. Enter the Mailchimp API key and select the audience.
3. Map the audience sync (who goes to which list).
4. Configure the campaign triggers and tag mapping.
5. Run a test sync and activate.
**Rules & Edge Cases:**
- A user who unsubscribes in Mailchimp is not re-added on the next sync.
- A sync failure is logged and retried; the last good audience state is kept.
- A campaign trigger fires only once per event per user (no duplicates).
- A missing API key suspends the integration and raises an alert.

### 3.5 CRM Integration
**What it does:** Integrates Salesforce and HubSpot for lead and account synchronization.
**Sub-features:**
- CRM selection (Salesforce, HubSpot).
- API credentials and object mapping (lead, contact, account).
- Sync direction (platform → CRM, CRM → platform, bidirectional).
- Field mapping and deduplication rules.
- available on web
- event logging (action performed)
- Audit logging of CRM integration
**Super Admin User Journey:**
1. Open Third-Party Tools → CRM.
2. Select the CRM and enter the API credentials.
3. Map the objects and fields.
4. Set the sync direction and deduplication rules.
5. Run a test sync and activate.
**Rules & Edge Cases:**
- A duplicate lead (matched by dedup rule) is merged, not created twice.
- A sync conflict is resolved by the configured source of truth.
- A sync failure is logged and retried; existing records are not corrupted.
- A deleted platform record deactivates (not hard-deletes) the CRM record.
