Skip to main content

What are Integrations?

Integrations connect LexQ to your external services. When a rule’s action fires, LexQ can call your coupon system, point platform, notification service, or any webhook endpoint. Integrations are configured once and then referenced in rule actions by their ID.

Integration Types

TypeDescriptionUse Case
WEBHOOKCall any HTTP endpointOrder processing, custom logic
COUPONIssue coupons via external serviceWelcome coupons, seasonal promotions
POINTAward or deduct pointsLoyalty programs, cashback
NOTIFICATIONSend SMS, email, or pushOrder confirmations, alerts
CRMSync user data or tagsCustomer segmentation
MESSENGERSend messages via chat platformsCustomer support automation

Creating an Integration

Console

Navigate to Management → Integrations → Create Integration, select the type, and fill in the configuration.

CLI

lexq integrations save --json '{
  "type": "WEBHOOK",
  "name": "Order Processing Webhook",
  "baseUrl": "https://api.example.com/webhooks/orders",
  "isActive": true
}'

Check Required Configuration

Each type requires different configuration fields. Check what’s needed:
lexq integrations config-spec --type WEBHOOK
lexq integrations config-spec --type COUPON

Using Integrations in Rules

Reference an integration by its ID in rule action parameters:
{
  "type": "POINT",
  "parameters": {
    "refVar": "payment_amount",
    "method": "PERCENTAGE",
    "rate": 1,
    "integrationId": "<your-point-integration-id>"
  }
}
{
  "type": "COUPON_ISSUE",
  "parameters": {
    "couponId": "WELCOME_10",
    "integrationId": "<your-coupon-integration-id>"
  }
}
{
  "type": "NOTIFICATION",
  "parameters": {
    "channel": "SMS",
    "templateId": "ORDER_CONFIRM",
    "integrationId": "<your-notification-integration-id>"
  }
}
{
  "type": "WEBHOOK",
  "parameters": {
    "url": "<your-webhook-integration-id>",
    "method": "POST",
    "payloadTemplate": {
      "text": "Rule {{ruleName}} matched — {{fact.customer_tier}} customer, amount: {{output.payment_amount}}"
    }
  }
}
The payloadTemplate field is optional. When omitted, all facts are sent as the request body. When provided, only the template structure is sent with {{variables}} replaced by actual values. See Policy Rules — WEBHOOK for the full variable reference.

Managing Integrations

lexq integrations list
lexq integrations get --id <integrationId>
lexq integrations save --json '{...}'
lexq integrations delete --id <integrationId>

Failure Handling

When an integration call fails during execution (network timeout, 5xx response, etc.), the failure is recorded in the Failure Log. You can retry, skip, or resolve failures:
lexq logs list --status PENDING
lexq logs action --id <logId> --action RETRY
During batch simulations, integration calls are always mocked. In dry runs, mocking is controlled by the Mock External Calls toggle in the Console (API parameter: mockExternalCalls, default: true). When set to false, the engine attempts real calls — if they fail, entries are written to the Failure Log.

Next Steps

Policy Rules

Learn how to use integrations in rule actions.

Troubleshooting

Common integration issues and solutions.