Routers

A router receives leads at a single URL and decides which flow and source should handle each one. It is useful when the same lead format arrives for many campaigns, or when a partner can only post every lead to one endpoint: LeadConduit picks the destination by looking at the lead itself.

A router has an inbound integration, which parses the incoming request, and an ordered list of routes. Each route pairs a rule set with a flow and a source. When a lead arrives at POST /routers/{router_id}/route, the rules of every route are evaluated against the parsed lead and the last matching route wins. The lead is then submitted to that flow and source exactly as if it had been sent to /flows/{flow_id}/sources/{source_id}/submit. Add dry_run=true to the request to see which route would match without submitting anything.

Router

A router is a single lead-submission endpoint that's able to distribute lead submissions to any one of an account's various Flows, based on evaluation of rules.

The rules of every route are evaluated against the lead, and the last route that matches selects the Flow and Source.

Only one Router for a given integration module-id should exist in an account.

id
string (ID) ^[0-9a-fA-F]{24}$

ID of this router

module_id
string (ModuleID)

The unique identifier of the integration module

Array of objects (Route)

The routes to be evaluated by this router

created_at
string <date-time> (Timestamp)
updated_at
string <date-time> (Timestamp)
{
  • "id": "5fd4371e940df5a34a3888b2",
  • "module_id": "leadconduit-salesforce.outbound.create_contact",
  • "routes": [
    • {
      • "id": "1aacd0",
      • "flow_id": "5fd4371e940df5a34a3888b2",
      • "source_id": "5fd4371e940df5a34a3888b2",
      • "rule_set": {
        • "id": "1aacd0",
        • "op": "and",
        • "rules": [
          • {
            • "id": "1aacd0",
            • "lhv": "string",
            • "op": "is equal to",
            • "rhv": "TX",
            • "rule_set": { }
            }
          ]
        }
      }
    ],
  • "created_at": "2019-08-24T14:15:22Z",
  • "updated_at": "2019-08-24T14:15:22Z"
}

List all routers

Get the list of all routers.

SecurityAPIKey
Responses
200

OK

get/routers
Request samples
Response samples
application/json
[
  • {
    • "id": "5fd4371e940df5a34a3888b2",
    • "module_id": "leadconduit-salesforce.outbound.create_contact",
    • "routes": [
      • {
        • "id": "1aacd0",
        • "flow_id": "5fd4371e940df5a34a3888b2",
        • "source_id": "5fd4371e940df5a34a3888b2",
        • "rule_set": {
          • "id": "1aacd0",
          • "op": "and",
          • "rules": [
            • {
              • "id": "1aacd0",
              • "lhv": "string",
              • "op": "is equal to",
              • "rhv": "TX",
              • "rule_set": { }
              }
            ]
          }
        }
      ],
    • "created_at": "2019-08-24T14:15:22Z",
    • "updated_at": "2019-08-24T14:15:22Z"
    }
]

Create a router

Create a new custom router, adding it to the list of all routers in the account.

SecurityAPIKey
Request
Request Body schema: application/json
required

Create a new Router

module_id
string (ModuleID)

The unique identifier of the integration module

Array of objects (Route)

The routes to be evaluated by this router

Responses
201

Created

post/routers
Request samples
application/json
{
  • "module_id": "leadconduit-salesforce.outbound.create_contact",
  • "routes": [
    • {
      • "rule_set": {
        • "op": "and",
        • "rules": [
          • {
            • "lhv": "string",
            • "op": "is equal to",
            • "rhv": "TX",
            • "rule_set": { }
            }
          ]
        }
      }
    ],
  • "created_at": "2019-08-24T14:15:22Z",
  • "updated_at": "2019-08-24T14:15:22Z"
}
Response samples
application/json
[
  • {
    • "id": "5fd4371e940df5a34a3888b2",
    • "module_id": "leadconduit-salesforce.outbound.create_contact",
    • "routes": [
      • {
        • "id": "1aacd0",
        • "flow_id": "5fd4371e940df5a34a3888b2",
        • "source_id": "5fd4371e940df5a34a3888b2",
        • "rule_set": {
          • "id": "1aacd0",
          • "op": "and",
          • "rules": [
            • {
              • "id": "1aacd0",
              • "lhv": "string",
              • "op": "is equal to",
              • "rhv": "TX",
              • "rule_set": { }
              }
            ]
          }
        }
      ],
    • "created_at": "2019-08-24T14:15:22Z",
    • "updated_at": "2019-08-24T14:15:22Z"
    }
]

Get a router

Fetch a single router.

SecurityAPIKey
Request
path Parameters
id
required
string (ID) ^[0-9a-fA-F]{24}$

The ID of the router

Example: 5fd4371e940df5a34a3888b2
Responses
200

OK

get/routers/{id}
Request samples
Response samples
application/json
{
  • "id": "5fd4371e940df5a34a3888b2",
  • "module_id": "leadconduit-salesforce.outbound.create_contact",
  • "routes": [
    • {
      • "id": "1aacd0",
      • "flow_id": "5fd4371e940df5a34a3888b2",
      • "source_id": "5fd4371e940df5a34a3888b2",
      • "rule_set": {
        • "id": "1aacd0",
        • "op": "and",
        • "rules": [
          • {
            • "id": "1aacd0",
            • "lhv": "string",
            • "op": "is equal to",
            • "rhv": "TX",
            • "rule_set": { }
            }
          ]
        }
      }
    ],
  • "created_at": "2019-08-24T14:15:22Z",
  • "updated_at": "2019-08-24T14:15:22Z"
}

Update a router

Update an existing custom router. Standard routers cannot be updated.

SecurityAPIKey
Request
path Parameters
id
required
string (ID) ^[0-9a-fA-F]{24}$

The ID of the router

Example: 5fd4371e940df5a34a3888b2
Request Body schema: application/json
required

Update an existing Router

module_id
string (ModuleID)

The unique identifier of the integration module

Array of objects (Route)

The routes to be evaluated by this router

Responses
200

OK

put/routers/{id}
Request samples
application/json
{
  • "module_id": "leadconduit-salesforce.outbound.create_contact",
  • "routes": [
    • {
      • "rule_set": {
        • "op": "and",
        • "rules": [
          • {
            • "lhv": "string",
            • "op": "is equal to",
            • "rhv": "TX",
            • "rule_set": { }
            }
          ]
        }
      }
    ],
  • "created_at": "2019-08-24T14:15:22Z",
  • "updated_at": "2019-08-24T14:15:22Z"
}
Response samples
application/json
[
  • {
    • "id": "5fd4371e940df5a34a3888b2",
    • "module_id": "leadconduit-salesforce.outbound.create_contact",
    • "routes": [
      • {
        • "id": "1aacd0",
        • "flow_id": "5fd4371e940df5a34a3888b2",
        • "source_id": "5fd4371e940df5a34a3888b2",
        • "rule_set": {
          • "id": "1aacd0",
          • "op": "and",
          • "rules": [
            • {
              • "id": "1aacd0",
              • "lhv": "string",
              • "op": "is equal to",
              • "rhv": "TX",
              • "rule_set": { }
              }
            ]
          }
        }
      ],
    • "created_at": "2019-08-24T14:15:22Z",
    • "updated_at": "2019-08-24T14:15:22Z"
    }
]

Submit a lead to a router

Submits a lead to a router instead of to a specific flow and source. The router's inbound integration parses the request, the rules of each route are evaluated against the lead, and the last matching route decides which flow and source receive it. From there the lead is processed exactly as a submission to /flows/{flow_id}/sources/{source_id}/submit, and the response is the same.

The body may be JSON, XML, or form encoded; set the Content-Type header accordingly. No credentials are needed.

Add dry_run=true to find out which route would match without submitting the lead.

Request
path Parameters
router_id
required
string (ID) ^[0-9a-fA-F]{24}$

The ID of the router

Example: 5fd4371e940df5a34a3888b2
query Parameters
dry_run
boolean

When true, report the matching route and stop without submitting the lead.

Request Body schema:
required

The lead data to route, as key-value pairs.

property name*
additional property
string
Responses
200

Returned only with dry_run=true. Reports the route that would handle the lead, or that none matched.

201

The lead was routed and processed. Check outcome: a lead rejected by the flow's acceptance criteria or by a cap is also reported here, with outcome: "failure".

404

No router exists with this ID.

413

The request body is larger than the 10 MB limit.

422

The router_id is not a valid ID, or no route matched the lead.

post/routers/{router_id}/route
Request samples
{
  • "email": "user@example.com",
  • "fname": "Example User"
}
Response samples
application/json
{
  • "message": "Route matched",
  • "module_id": "leadconduit-default.inbound",
  • "flow_id": "5fd4371e940df5a34a3888b2",
  • "source_id": "5fd4371e940df5a34a3888b2"
}

Submit a lead to a router using query parameters

An alternative to POST /routers/{router_id}/route for senders that cannot issue a request body. The lead fields are read from the query string. Behavior, including dry_run=true, is otherwise identical to the POST form.

Request
path Parameters
router_id
required
string (ID) ^[0-9a-fA-F]{24}$

The ID of the router

Example: 5fd4371e940df5a34a3888b2
query Parameters
dry_run
boolean

When true, report the matching route and stop without submitting the lead.

Responses
200

Returned only with dry_run=true. See the POST form.

201

The lead was routed and processed. See the POST form.

404

No router exists with this ID.

422

The router_id is not a valid ID, or no route matched the lead.

get/routers/{router_id}/route
Request samples
Response samples
application/json
{
  • "outcome": "success",
  • "reason": "lead.phone must have valid format",
  • "lead": {
    • "id": "5fd4371e940df5a34a3888b2"
    },
  • "price": 20
}