# Frontline

Inbox, channel integrations, tickets, forms, surveys, and knowledge base


Customer service: unified inbox, channel integrations, tickets, forms, surveys, knowledge base, and help center configuration.

Frontline is the customer-communication plugin. Agents work a unified inbox of conversations that arrive through per-channel integrations: erxes messenger, Facebook, Instagram, mail (Cloudflare Email Routing), Discord, Call (SIP), and Call Pro (webhook PBX). Conversations can be answered in place or converted into tickets (handled by Frontline's own ticket pipelines), deals (created by `sales` over tRPC), or tasks (created by `operation` over tRPC). The plugin also provides forms and form submissions, channel-scoped surveys, the knowledge base (topics → categories → articles), help center configuration records, response templates, and frontline reports.

For embedding chat on a site, see [Messenger Widget](https://erxes.io/docs/erxes-messenger). For the published help center app, see [Help Center](https://erxes.io/docs/app-help-center).

## Enabling and ports

```dotenv
ENABLED_PLUGINS=frontline
```

The base name maps to the Nx projects `frontline_api` and `frontline_ui`; the dev scripts append `_api`/`_ui` to each entry.

| Project | Role | Dev port |
| --- | --- | --- |
| `frontline_api` | Federated GraphQL subgraph + tRPC + Express webhook routes; subscriptions enabled | `3304` |
| `frontline_ui` | Module Federation remote (remote name `frontline_ui`) | `3004` |

The API port is set in [`main.ts`](https://github.com/erxes/erxes/blob/f91e8c6f4714c910a32c6b6e14fe085f6435c89e/backend/plugins/frontline_api/src/main.ts).

## Module map

Backend modules live under `backend/plugins/frontline_api/src/modules/`.

| Module | What it contains | Key collections | Module page |
| --- | --- | --- | --- |
| `inbox/` | Conversations, messages, integrations records, widget and client-portal resolvers, `receiveInboxMessage` | `conversations`, `conversation_messages`, `integrations` | [Inbox & Channels](https://erxes.io/docs/frontline-inbox-channels) |
| `channel/` | Team and personal channels, membership, roles (`admin`/`lead`/`member`) | `channels`, `channel_members` | [Inbox & Channels](https://erxes.io/docs/frontline-inbox-channels) |
| `response/` | Response templates | `response_templates` | [Inbox & Channels](https://erxes.io/docs/frontline-inbox-channels) |
| `integrations/<kind>/` | `facebook`, `instagram`, `mail`, `discord`, `call`, `callpro` runtimes plus the `trpc` router | Per-kind mirror collections (`mail_integrations`, `conversations_discord`, `calls_cdr`, …) | [Channel Integrations](https://erxes.io/docs/frontline-integrations) |
| `ticket/` | Pipelines, statuses, tickets, activities, notes, ticket configs, import/export | `frontline_tickets`, `frontline_tickets_pipeline`, `frontline_tickets_pipeline_status`, `frontline_ticket_activities`, `frontline_tickets_notes`, `frontline_ticket_configs` | [Tickets](https://erxes.io/docs/frontline-tickets) |
| `form/` | Form definitions, fields, submissions | `frontline_forms`, `frontline_form_submissions` | [Forms & Surveys](https://erxes.io/docs/frontline-forms-surveys) |
| `survey/` | Channel-scoped surveys, vote ledger, per-option ticket automation | `frontline_surveys`, `frontline_survey_votes` | [Forms & Surveys](https://erxes.io/docs/frontline-forms-surveys) |
| `knowledgebase/` | Topics, categories, articles; AI knowledge source provider | `knowledgebase_topics`, `knowledgebase_categories`, `knowledgebase_articles` | [Knowledge Base](https://erxes.io/docs/frontline-knowledge-base) |
| `helpcenter/` | The client portal config record behind a published help center site | `frontline_help_center_configs` | [Knowledge Base](https://erxes.io/docs/frontline-knowledge-base) |
| `reports/` | Inbox/ticket/call/Facebook report aggregations, saved `ReportCharts` | `frontline_report_charts` | [Knowledge Base](https://erxes.io/docs/frontline-knowledge-base#reports) |

The frontend remote under `frontend/plugins/frontline_ui/src/modules/` mirrors this structure (`inbox`, `ticket`, `pipelines`, `status`, `channels`, `forms`, `survey`, `knowledgebase`, `helpcenter`, `integrations`, `integrations-config`, `report`, `responseTemplate`, `settings`), plus `src/widgets/` automation remote entries and `src/pages/` route pages. Navigation is registered from `src/config.tsx` under `frontline/*` (`inbox`, `tickets`, `reports`, `calls/dashboard`, `calls/statistics`, `forms`, `surveys`, `knowledgebase`, `helpcenter`) and `settings/frontline/*` (`channels`, `personal-channel`, `config`).

## HTTP routes

[`src/routes.ts`](https://github.com/erxes/erxes/blob/f91e8c6f4714c910a32c6b6e14fe085f6435c89e/backend/plugins/frontline_api/src/routes.ts) mounts webhook routers on the plugin's Express app: `/facebook`, `/instagram`, `/mail` (`POST /mail/receive`, HMAC-signed by the Cloudflare worker), and `/callpro` (`POST /callpro/receive`, only when `CALLPRO_ENABLED=true`). See [Channel Integrations](https://erxes.io/docs/frontline-integrations).

## tRPC

[`src/init-trpc.ts`](https://github.com/erxes/erxes/blob/f91e8c6f4714c910a32c6b6e14fe085f6435c89e/backend/plugins/frontline_api/src/init-trpc.ts) merges the `integration`, `inbox`, `conversation`, `form`, `ticket`, `relation`, and `fields` routers. Notable procedures include `inbox.createConversationAndMessage`, `inbox.getConversationsList`, `ticket.create`, `form.submissionsByConversation`, and `relation.onRelationAdded`.

## How it connects to Core

- Contacts/customers come from Core: inbound messages and webhooks create or reuse core customers over tRPC.
- `meta/` registers permissions (`inbox`, `channel`, `integration`, `ticket`, `form`, `survey`, `callReport`, `responseTemplate`, `knowledgeBase`, `helpCenter` modules), automations (facebook, instagram, inbox, tickets, discord workers plus the knowledgebase AI source), notifications, segments, references, `relations` (`frontline:conversation` subscribed type), tags (`conversation`, `ticket`, `form`), and `properties` (the `conversation` and `ticket` property types, each with `systemFields`).
- Import/export producers cover ticket import/export (`frontline:ticket.ticket`) and form-submission export (`frontline:formSubmission.formSubmission`).
- Messenger and form embed bundles are built by the `apps/frontline-widgets` app (`messengerBundle.js`, `formBundle.js`); install dialogs build snippet URLs from `REACT_APP_WIDGETS_URL`.

## Configuration

Backend env vars read by this plugin:

| Variable | Purpose |
| --- | --- |
| `CALLPRO_ENABLED` | `true` turns on Call Pro |
| `CALLPRO_SUBDOMAINS` | Comma-separated tenant list that restricts Call Pro on shared deployments |
| `MAIL_RECEIVE_URL`, `MAIL_WORKER_URL`, `MAIL_TENANT`, `MAIL_WEBHOOK_SECRET` | Inbound mail delivery from the Cloudflare worker |
| `MAIL_DOMAIN`, `MAIL_SENDING_ACCOUNT_ID`, `MAIL_SENDING_API_TOKEN`, `MAIL_SENDING_DAILY_LIMIT` | The deployment's own Cloudflare account used when a workspace has not connected its own |
| `CALL_ENDPOINT_URL`, `CALL_WEBHOOK_REQUIRE_SIGNATURE`, `CALL_SUBSCRIPTION_REQUIRE_AUTH` | Call (SIP) integration |
| `FACEBOOK_GRAPH_URL` | Graph API base URL |
| `DOMAIN`, `ENDPOINT_URL`, `JWT_TOKEN_SECRET`, `VERSION` | Shared platform vars (`VERSION=saas` toggles SaaS behavior) |

Meta app credentials (`FACEBOOK_APP_ID`, `FACEBOOK_APP_SECRET`, `FACEBOOK_VERIFY_TOKEN`, `FACEBOOK_POST_APP_ID`, `FACEBOOK_POST_APP_SECRET`, `INSTAGRAM_*`) are read through `getConfig`: per-workspace records first, env vars as fallback, env-only when `VERSION=saas`. See [Channel Integrations](https://erxes.io/docs/frontline-integrations).

## Pages in this section

- [Inbox & Channels](https://erxes.io/docs/frontline-inbox-channels): Conversations, messages, team and personal channels, and response templates
- [Channel Integrations](https://erxes.io/docs/frontline-integrations): Facebook, Instagram, mail, Discord, call, and Call Pro runtimes and webhooks
- [Tickets](https://erxes.io/docs/frontline-tickets): Boards, pipelines, statuses, and conversation-to-ticket conversion
- [Forms & Surveys](https://erxes.io/docs/frontline-forms-surveys): Form definitions, submissions, lead capture, and in-conversation surveys
- [Knowledge Base](https://erxes.io/docs/frontline-knowledge-base): Topics, categories, articles, and help center configuration
- [Messenger Widget](https://erxes.io/docs/erxes-messenger): Embed the Frontline Messenger widget on your website and verify the conversation round trip
- [Help Center](https://erxes.io/docs/app-help-center): Public knowledge base and ticket flows

