# Integrations Overview

MailTrixy integrates with popular third-party services to extend your workflow. Connect your CRM, calendar, payment, and automation tools.

## Available Integrations

Integration | Type | Description
--- | --- | ---
Slack | Communication | Get notifications and manage conversations in Slack channels
Salesforce | CRM | Two-way sync contacts and deals with Salesforce CRM
HubSpot | CRM | Sync contacts and companies with HubSpot
Google Calendar | Productivity | Schedule meetings and sync calendar events
Zapier | Automation | Connect MailTrixy with 5,000+ apps via webhooks
Stripe | Payments | View customer payment data alongside conversations

## How to Connect

1. Go to Settings → Integrations
2. Click Connect on the integration you want
3. For OAuth integrations (Slack, Salesforce, Google Calendar): you will be redirected to authorize access
4. For API key integrations (Stripe, HubSpot): enter your API key and click Save
5. For Zapier: a webhook URL and API token are generated automatically

> Note: OAuth credentials (Google, Slack, Salesforce) are configured by your admin in Admin → Settings → Integrations. Users just click "Connect" to authorize.

## In-Conversation Cards (Right Panel)

When an integration is connected and the conversation's contact email matches a record in that external service, Mailtrixy renders a read-only card in the conversation's right panel. Agents get full context without tab-switching.

Open any conversation and toggle the right panel (details icon at the top-right of the conversation header). Cards stack below the Contact card. Each card is cached per-email for 5 minutes to avoid hammering the third-party API.

### Stripe card

- Customer ID (`cus_…`) in monospace.
- Total Spent (sum of all paid, non-refunded charges).
- Active-subscription badge.
- Subscriptions list: plan names, amount, interval (monthly/yearly), status pill (Active / Past Due / Trialing / Canceled).
- Recent Payments (last 5): amount, date, Paid / Refunded badge.
- Red warning strip if the Stripe customer is marked delinquent.

### HubSpot card

- Lifecycle-stage badge (Lead / MQL / SQL / Customer / etc.) if set.
- Company, job title, lead status, owner.
- Up to 5 associated deals with name, stage, and amount.
- "Open in HubSpot" deep-link to the contact record.

### Salesforce card

- Contact's account name, title, and lead source.
- Up to 5 recent opportunities on the account with name, stage, amount, and a Won / Lost / Open pill.
- "Open in Salesforce" deep-link to the contact record.

### When cards appear (and when they don't)

- The integration must be active for the workspace.
- The conversation's contact must have an email.
- That email must match an existing record in the external service.
- If any of the above are not true, the card is simply omitted — no placeholder, no error.

## Slack: Forwarding Inbound Messages

Slack connection grants two capabilities: sending manual notifications, and optionally forwarding every inbound message to a Slack channel.

- Default is OFF. An active Slack integration alone does not mirror inbound activity into Slack — your channel stays quiet by design.
- To enable: go to Settings → Integrations → Slack card → tick "Forward new messages to Slack". Untick it to stop forwarding again.
- When enabled, every inbound message (Email, WhatsApp, SMS, Telegram, Slack DM, Live Chat) posts a "New message received" card to the configured Slack channel with From / Channel / Subject / Priority.
- The toggle persists per workspace in the Slack integration's encrypted credentials as `forward_new_messages`.

## Integration Behavior Summary

Integration | Right-panel card | Inbox behavior | Background sync
--- | --- | --- | ---
Stripe | Yes — billing snapshot | None (read-only) | Live API on open (5 min cache)
HubSpot | Yes — CRM snapshot | None | Optional bulk contact sync
Salesforce | Yes — CRM snapshot | None | Two-way contact & deal sync
Slack | No | Optional "Forward new messages" toggle (OFF by default) | —
Google Calendar | No | Create / list events via workflows & settings | OAuth token auto-refresh
Zapier | No | Fires outbound events & accepts inbound webhooks | —