gitlabEdit

๐Ÿ”ŒProviders & Configurations

Understanding how Docs-Dispatcher resolves provider configurations is critical for successful API integration. This guide explains the hybrid 3-tier provider resolution system and how to configure providers for your services.

Overview

Docs-Dispatcher uses a flexible 3-tier provider resolution system that balances simplicity with control:

Tier 1: Company Default Config
      โ†“ (can be overridden)
Tier 2: User Override Config
      โ†“ (can be overridden)
Tier 3: Explicit providerName in Request

This system allows:

  • Companies to set default providers for all users

  • Individual users to override with their preferred providers

  • API requests to explicitly specify providers for one-off cases

How Provider Resolution Works

When you make a dispatch request, Dispatcher resolves the provider in this order:

Resolution Priority (Highest to Lowest)

  1. Explicit providerName in Request - Always wins if provided

  2. User Override Configuration - User-specific provider preference

  3. Company Default Configuration - Fallback for all company users

If no configuration is found at any tier, the request fails with 400 Bad Request.

Real-World Example

Let's see how this works in practice:

Scenario Setup

Company: Acme Corp

  • Default invoicing provider: Qonto

  • Default SMS provider: Brevo

User: Alice

  • SMS override: OVH (she prefers OVH for SMS)

User: Bob

  • No overrides (uses company defaults)

Resolution Examples

Example 1: No Explicit Provider (Uses Defaults)

Alice sends an invoice:

Resolution: Qonto (company default, Alice has no override)


Bob sends SMS:

Resolution: Brevo (company default, Bob has no override)


Alice sends SMS:

Resolution: OVH (Alice's user override)

Example 2: Explicit Provider (Overrides Everything)

Alice sends invoice with explicit provider:

Resolution: PennyLane (explicit request wins, ignores Qonto default)


Bob sends SMS with explicit provider:

Resolution: SMS Magic (explicit request wins, ignores Brevo default)

Provider Configuration Structure

Each provider requires a configuration object with provider-specific credentials and settings.

Configuration Storage

Provider configurations are stored in:

  • Company level: GET /api/v1/companies/:companyId/configs

  • User level: GET /api/v1/users/:userId/configs

Common Configuration Fields

All provider configs share these fields:

Field
Type
Description

service

string

Service type: invoicing, esign, postal, sms, email

providerName

string

Provider identifier (see Available Providers)

isDefault

boolean

Set as default for this service

isActive

boolean

Enable/disable without deleting

config

object

Provider-specific credentials and settings

Provider-Specific Config Examples

Invoicing: Qonto

eSign: Universign

SMS: Brevo

Postal: MySendingBox

Available Providers

Docs-Dispatcher supports 12 external providers across 7 services:

Invoicing (4 providers)

Provider

providerName

Document Types

Webhooks

iPaidThat

ipaidthat

INVOICE, E_INVOICE, QUOTE, CREDIT

No

PennyLane

pennylane

INVOICE, E_INVOICE, QUOTE, CREDIT

No

Qonto

qonto

INVOICE, E_INVOICE, QUOTE, CREDIT

No

SuperPDP

superpdp

INVOICE, E_INVOICE, QUOTE, CREDIT

No

eSign (3 providers)

Provider

providerName

Webhooks

Signaturit

signaturit

Yes

Universign

universign

Yes

Yousign

yousign

No

Postal (1 provider)

Provider

providerName

Webhooks

MySendingBox

mysendingbox

Yes

SMS (4 providers)

Provider

providerName

Webhooks

Brevo

brevo

No

OVH

ovh

No

SMS Factor

sms_factor

No

SMS Magic

sms_magic

No

Email (Built-in SMTP)

Email uses SMTP configuration without external providers.

File & Upload

These services don't require provider configuration (internal printer services).

Setting Up Provider Configurations

Provider configurations are managed through the Templater UI at company and user levels.

Company-Level Setup (Admins Only)

  1. Log in to Templater UI

  2. Navigate to Admin > Company Settings > Providers

  3. Add provider configuration:

    • Select service (e.g., Invoicing)

    • Select provider (e.g., Qonto)

    • Enter credentials

    • Set as default (optional)

    • Save configuration

User-Level Setup

  1. Log in to Templater UI

  2. Navigate to My Account > Provider Overrides

  3. Add override configuration:

    • Select service

    • Select provider

    • Enter credentials

    • Save override

circle-info

Note: User overrides only work if the provider is already configured at company level with proper credentials OR if the user provides their own credentials.

Multi-Provider Scenarios

Scenario 1: Different Providers Per User

Use Case: Each sales rep uses their own accounting platform.

Setup:

  • Company: No default invoicing provider

  • Alice: PennyLane configuration

  • Bob: Qonto configuration

  • Charlie: iPaidThat configuration

Requests:

Scenario 2: Multiple Providers for Same Service

Use Case: Company uses different invoicing providers for different regions.

Setup:

  • Company default: Qonto (France)

  • Explicit provider in request for other regions

Requests:

Scenario 3: Sandbox vs Production

Use Case: Test with sandbox before production dispatch.

Setup:

  • Company default: Qonto with useSandbox: true

  • Explicit production provider in request

Requests:

Common Configuration Issues

Issue 1: "Provider not configured" (400)

Error:

Causes:

  • No company default configured

  • No user override configured

  • Explicit provider has no configuration

Solution:

  1. Verify provider is configured in Templater UI

  2. Check isActive: true in configuration

  3. Verify JWT token belongs to correct user/company

Issue 2: "Invalid provider credentials" (502)

Error:

Causes:

  • API key expired or revoked

  • Incorrect credentials

  • Provider API down

Solution:

  1. Re-enter credentials in Templater UI

  2. Test credentials with provider's API directly

  3. Check provider status page

Issue 3: "Provider not supported for service" (400)

Error:

Causes:

  • Wrong providerName for service

  • Typo in provider name (case-sensitive)

Solution:

Best Practices

1. Use Company Defaults for Consistency

Set company defaults for services used by all users:

2. User Overrides for Special Cases

Use user overrides sparingly:

3. Explicit Providers for Edge Cases

Use explicit providerName for:

  • Multi-region dispatches

  • A/B testing providers

  • One-off provider usage

4. Test with Validation Endpoint

Before configuring a new provider, test with validation:

5. Secure Credential Storage

Never hardcode credentials in requests:

6. Monitor Provider Usage

Track which providers are used for billing and monitoring:

Code Examples

Example 1: Using Company Default

Example 2: Explicit Provider Override

Summary

Key takeaways:

  1. 3-tier resolution: Company Default โ†’ User Override โ†’ Explicit Request

  2. Explicit wins: Always use providerName in request to override defaults

  3. Configure via UI: Manage providers in Templater for security

  4. Test with validation: Use /validate endpoint before real dispatch

  5. Monitor usage: Track provider usage for billing and debugging

Understanding provider configuration is essential for production use. Once configured correctly, Dispatcher automatically routes requests to the right provider with the right credentials.

Last updated