Integration Management
Complete guide to managing integrations in the Pragma monorepo
An integration, also called third-party, is a software component that allows different applications or systems to communicate and work together. Integrations enable businesses to connect their platforms with our services.
Key Concepts
Providers vs Integrations
Understanding the distinction between providers and integrations :
| Concept | Description | Example |
|---|---|---|
| Provider | Internal concept representing a type of service connection | OrderProvider, Consumer, LoyaltyService, Recipient |
| Integration | Specific instance displayed to users, linked to a provider | Uber Eats, Deliveroo, Koust, Hey Pongo |
An Integration (e.g., "Uber Eats") is linked to a Provider (e.g., OrderProvider with name UBER_EATS). This separation allows:
- Clean display names and branding for the marketplace
- Flexible configuration per integration
Provider Types
| Provider Type | Purpose | Examples |
|---|---|---|
| Consumer | API consumers that access our endpoints | Koust, Inpulse, Sommit |
| OrderProvider | External ordering platforms | Uber Eats, Deliveroo, Popina Order |
| LoyaltyService | Customer loyalty programs | Hey Pongo, Zerosix |
| Recipient | Webhook recipients for event notifications | Killbills, custom webhooks |
Integration Categories
Integrations are organized into categories for the marketplace:
accounting- Accounting software integrationsstock- Inventory managementdigital_receipt- Digital receipt providersmanagement- Business management toolsstaff_management- Staff and HR toolsloyalty- Loyalty programsorder- Order providers (delivery platforms)payment- Payment providersKDS- Kitchen Display Systems
Admin App: Integration Management
The Admin app (apps/admin) provides comprehensive tools for managing integrations.
Location / Third-Party Tab
This tab displays all providers configured for a specific location:
- Order Providers: Activate/deactivate delivery platforms
- Consumers: Manage API access for third-party services
- Loyalty Providers: Enable/disable loyalty programs
- Payment Providers: Configure payment integrations
From here, you can:
- Activate or deactivate a provider for the location
- Configure provider-specific settings
- Manage API keys and credentials
Third-Party Administration Pages
Base path: /third-parties/
1. Links/Connectors Management
Create and configure the underlying providers (connectors):
| Route | Purpose |
|---|---|
/third-parties/links/consumers | Manage API consumers (scopes, credentials) |
/third-parties/links/recipients | Configure webhook recipients (HMAC secrets) |
/third-parties/links/order-providers | Set up order providers (authentication, actions) |
/third-parties/links/loyalty-services | Configure loyalty services |
/third-parties/links/accounting-configs | Accounting provider settings |
2. Integrations Configuration
Path: /third-parties/integrations/configuration/
Manage integrations (the user-facing entities):
| Route | Action |
|---|---|
/configuration | List all integrations |
/configuration/create | Create a new integration |
/configuration/[integrationId] | Edit an existing integration |
/configuration/incomplete | View integrations missing required data |
When creating/editing an integration, you can:
- Set name, description, and branding (icons, logos)
- Associate a provider (Consumer, OrderProvider, LoyaltyService, or Recipient)
- Assign to categories
- Configure the activation type (API key, webhook, boolean toggle, etc.)
3. Marketplace Management
Path: /third-parties/integrations/marketplace
Control how integrations appear in the backoffice marketplace:
- Set display order within categories
- Show/hide integrations from the marketplace
- Configure integration visibility per category
Technical Architecture
Package Structure
The integration logic lives in the package integration:
packages/integration/src/
├── accounting/ # Accounting provider services functions
├── consumer-key/ # API key generation services functions
├── location/ # Location-level integration queries
│ ├── location.schema.ts
│ └── location.service.ts # getLocationIntegrationList()
├── third-party/ # Third-party API services
│ ├── v2/
│ │ └── third-party.service.ts # getV2IntegrationList()
│ └── utils/
├── webhook-integrations/ # Webhook management
├── integrations.ts # Static integration configuration
└── schema.ts # Core schemas and typesDatabase Models
Core Entity Relationships
Here is a simplified overview of the core Integration model and its relationships with providers and categories:
Integration
├── Consumer (API consumer)
├── OrderProvider (delivery platform)
├── LoyaltyService (loyalty provider)
├── Recipient (webhook recipient)
├── Accounting (accounting provider)
└── IntegrationCategoryLink[] → IntegrationCategoryKey Models
Here is a summary of the main database models involved in integrations:
| Model | Purpose |
|---|---|
Integration | Central integration entity |
IntegrationCategory | Category definitions |
IntegrationCategoryLink | Many-to-many: Integration to Category |
Consumer | API consumers with scopes |
OrderProvider | Order provider definitions |
OrderProviderConfig | Location-specific order config |
LoyaltyService | Loyalty service definitions |
LoyaltyServiceConfig | Location-specific loyalty config |
Recipient | Webhook recipients |
Webhook | Location-specific webhook subscriptions |
LocationStateIntegrationLink | Location integration enabled state |
PaymentProviderCreds | Location-specific payment providers |
Configuration Types
Integrations support different activation mechanisms available for the user when enabling an integration on the backoffice:
| Type | Description |
|---|---|
API_KEY_GENERATION | Consumer generates an API key |
EMAIL_ACCOUNTING | Email-based accounting setup |
ACCOUNTING_CONFIG | Accounting configuration |
BOOLEAN_ACTIVATION | Simple on/off toggle |
WEBHOOK_CODE_ACTIVATION | Webhook with activation code |
WEBHOOK_BOOLEAN_ACTIVATION | Webhook with toggle |
API Endpoints
tRPC Router
Location: apps/admin/src/server/trpc/router/integration/integrations.router.ts
Key procedures:
paginatedIntegrationList- List integrations with paginationgetMarketPlaceIntegrations- Marketplace-ready integrationsgetConsumerList/getRecipientList/getOrderProviderList/getLoyaltyProviderList- Fetch provider listscreateIntegration/updateIntegration- CRUD operationscountIncompleteIntegrations- Track incomplete setups
Third-Party Endpoint (POS)
The POS team expects to display all integrations on the POS, and also display connected integrations for a single location. This page aims to manage the integrations.
The POS fetches integrations via the POS API endpoint : v2/third-party
This returns active/inactive integrations for the location.
Workflow: Adding a New Integration
Step 1: Create the Provider
If the provider doesn't exist yet:
- Go to the appropriate links page (e.g.,
/third-parties/links/consumersfor a consumer provider) - Create the provider with required configuration
- Set up authentication, scopes, or webhook secrets as needed (e.g., name for consumers, HMAC secret for recipients)
Step 2: Create the Integration
-
Navigate to
/third-parties/integrations/configuration/create -
Create a new integration by filling the mandatory following fields:
- Name, displayed name and category
- Description
- Documentation and website URLs
- Select the associated provider
-
Assign categories
-
Configure the activation type:
- For consumers, select
API_KEY_GENERATIONand link the provider - For webhook-based providers, select
WEBHOOK_CODE_ACTIVATIONand link the recipient provider - For simple toggles, select
BOOLEAN_ACTIVATION
- For consumers, select
-
Save the integration
Step 3: Add to Marketplace
- Go to
/third-parties/integrations/marketplace - Find your integration in the corresponding category list
- Set the display order (drag and drop)
Step 4: Enable at Location Level
- Go to Location settings - Third-party tab
- Find the integration/provider
- Activate the integration for the location
User Workflow (Backoffice)
From a user perspective in the backoffice:
- Discover: Browse the marketplace to find integrations
- Connect: Click to connect an integration
- Configure: Provide credentials, API keys, or settings
- Manage: View status, update settings, or disconnect
Troubleshooting
Integration not appearing in marketplace?
- Check if it's linked to a category in admin
- Verify it's not marked as
hidden - Check marketplace ordering
Integration shows as inactive?
- Verify the provider is properly associated
- Check location-level configuration
- Ensure required configs exist (e.g.,
OrderProviderConfigfor order providers)
Incomplete integrations?
- Visit
/third-parties/integrations/configuration/incomplete - Add missing icons, descriptions, or provider associations