Shuntline›Solutions›Leads›Documentation

Shuntline Leads · documentation · version 1.0

Install, send, collect

For Snowflake administrators, integration teams and security reviewers: how to install Shuntline Leads, how systems send and collect leads, how the rules work, and how the app is built.

← Shuntline Leads: what it does and why

Install and try

A Snowflake Native App, available on the Snowflake Marketplace. It runs entirely inside your Snowflake account: no container, no external connection, nothing on a schedule.

  1. 01 · INSTALL

    From the listing

    Install into your account and approve the privileges, each explained at install.

  2. 02 · GRANT

    Two roles

    Grant LEADS_USER to the people and agents who work leads, LEADS_INTEGRATION to the systems that send and collect.

  3. 03 · TRY

    Sample company

    One click, or one call, loads a fictional company: three sources, six folders, about 430 leads over 30 days.

  4. 04 · CONFIGURE

    Your sources

    Declare your sources, folders and rules in the console; try any payload before it goes live.

CALL SHUNTLINE_LEADS.API.MANAGE('load_sample', {});
Privilege requestedWhy
CREATE WAREHOUSEThe app's own small warehouse for the console and the API, suspended when idle.
EXECUTE TASK, EXECUTE MANAGED TASKA serverless background task for phone checks and re-reading leads after a source changes. It has no schedule: it runs only after work arrives.

Concepts

Four words carry the whole app: source, rule, folder, status.

SourceA system or form that sends leads (a website form, trade fair scans, a partner portal, an import), each in its own JSON. A source declares the fields that identify a lead (an email, a phone, a contact id) and the fields that scope access (a country, a brand).
RulesPer source, in five steps: formatting (trim, case), validation (flags such as "no consent"), enrichment (fill what is blank), dedup (the same key across sources within a time window) and dispatch (the first matching rule files the lead).
FolderWhere leads are filed for a team or a system to collect: a dealer network, a sales team, key accounts.
StatusTo review: no rule matched, a person decides. To collect: waiting for its folder's system. Collected: acknowledged by that system. Delivery failed.
RevisionsEvery lead is stored exactly as sent. Rules and people add revisions beside it; the original stays readable.
DuplicatesFound, linked and flagged, never merged: both records stay.
IntakeStored as sentAPI.INTAKE · SQL API or any driver
Source's rulesFormat · validate · enrich · dedup · dispatchno rule matches: To review
FolderCollected exactly onceAPI.CLAIM then API.ACK, by the CRM or extranet

API

Procedures in the app's API schema, called through the Snowflake SQL API (HTTPS) or any Snowflake driver; read views in the DATA schema.

ObjectPurpose
API.INTAKE(source, payload, idempotency_key)Send one lead. The answer says where it was filed. A repeat of the same lead is recognised by the sender's id or the idempotency key.
API.INTAKE_BATCHSend up to 2,000 leads in one call.
API.CLAIM(folder, n)Reserve a folder's waiting leads for 30 minutes. Two systems never take the same lead.
API.ACKAcknowledge what was stored: the leads become Collected. Leads not acknowledged go back to the folder.
API.CORRECT_LEAD, API.PLACE_LEADCorrect a lead (a new revision) or file a lead a person decided on.
API.SIMULATE(source, payload)Run a source's rules on a payload and show each step and the destination, writing nothing.
API.MANAGE(action, args)Configuration and administration, including load_sample.
DATA.LEADS, DATA.SOURCES, DATA.FOLDERSRead views for analytics, dashboards and AI agents.

Examples

They run in order on a fresh install, as the role that installed the app, after the sample company is loaded. SHUNTLINE_LEADS is the default app name.

Send a lead

The call a website or a partner makes. The rules tidy the email and the country, check the keys, look for a duplicate and file the lead; the answer says where.

CALL SHUNTLINE_LEADS.API.INTAKE('website', PARSE_JSON('{
  "ref": "WEB-26-77001", "first_name": "Claire", "last_name": "Dumont",
  "email": "  Claire.Dumont@Paysages-Dumont.fr ", "phone": "+33 6 41 27 83 90",
  "company": "Paysages Dumont", "city": "Annecy", "postal_code": "74000",
  "country": " fr ", "brand": "acme_pro", "product": "Mini excavator 3.5 t", "optin": true
}'));

Try a payload without storing it

In the dealer portal's own shape; this one goes to Key accounts, its quote being over 50,000.

CALL SHUNTLINE_LEADS.API.SIMULATE('dealers', PARSE_JSON('{
  "dealer_ref": "DLR-77001", "dealer": "Macchine Padane",
  "customer": {"email": "giulia.rossi@libero.it", "mobile": "+39 333 123 4567"},
  "country_code": "it", "brand": "acme_pro", "quote_amount": 72000
}'));

Where leads are

SELECT folder_code, status, COUNT(*) AS leads
FROM SHUNTLINE_LEADS.DATA.LEADS
GROUP BY folder_code, status
ORDER BY folder_code, status;

Leads a person should look at

SELECT id, source_name, keys, flags, received_at
FROM SHUNTLINE_LEADS.DATA.LEADS
WHERE status = 'manual' OR ARRAY_CONTAINS('possible_duplicate'::VARIANT, flags)
ORDER BY received_at DESC
LIMIT 10;

Collect a folder

What a CRM or a dealer extranet does: claim the waiting leads, store them, then acknowledge them with API.ACK.

CALL SHUNTLINE_LEADS.API.CLAIM('france-benelux', 5);

Access

The same rule applies at every way in: the console, the API, intake (a sender only sends leads of its scope), collection (a collector only takes leads of its scope) and the view AI agents query.

Available now

The app's two roles

LEADS_USER for people and their AI agents: console, corrections, configuration, every lead. LEADS_INTEGRATION for systems: send and collect. Granted by your Snowflake administrator; works at once after install.

With Shuntline Hub

Roles per team and scope

Administrator, router, viewer, sender, collector, each optionally limited to values of a scope: a source, a country, a brand. Team access reaches sub-teams; start and end dates; reviews; one audit log. Connected by one call; a Hub that does not answer refuses rather than opens. Shuntline Hub →

Connecting the stack

What the app does itself, and what sits next to it.

NeedHowStatus
A system sends leadsSnowflake SQL API (HTTPS) or any Snowflake driver, as a service user: API.INTAKE, or API.INTAKE_BATCH for up to 2,000 at once.Available now
A partner or SaaS form without Snowflake credentialsAn API gateway (Apigee, Azure API Management, AWS API Gateway) in front of the SQL API: partner keys, rate limits and webhook signatures checked there.Outside the app
A CRM or extranet collects its folderAPI.CLAIM then API.ACK, on its own schedule.Available now
Leads pushed to a webhookA small job outside the app that claims, posts (HTTPS, idempotency key) and acknowledges.Outside the app
AI agents read and actCortex Agents or an MCP server over DATA.LEADS and the API procedures, as the person using them.Available now
AnalyticsDATA.LEADS in Snowflake, next to the rest of your data.Available now

Architecture

Installed from the Marketplace into your account, the app runs there with your data, and nothing leaves.

ComponentWhat it is
ConsoleStreamlit in Snowsight: dashboard, register with filters and search, each lead with its keys, scope, checks, revisions, duplicates and hand-overs; sources, rules, flags and lists; intake journal and audit trail.
API proceduresINTAKE, INTAKE_BATCH, CLAIM, ACK, CORRECT_LEAD, PLACE_LEAD, SIMULATE, MANAGE.
Rule engineJavaScript procedures.
Hybrid tablesLeads, revisions, dedup keys, claims, hand-overs, journal, audit.
Standard tablesSources, folders, rules, settings.
Background taskServerless, no schedule: phone checks (Google's libphonenumber) and re-keying.
Read viewsDATA.LEADS, DATA.SOURCES, DATA.FOLDERS.

Design choices

Hybrid tables for everything written lead by leadRow locks and enforced unique keys: concurrent senders don't slow each other, and a repeat of the same lead is refused by the database.
JSON payloads, typed columns for what is searchedEach source keeps its own shape; status, folder, dates, keys and scope values are extracted at intake into indexed columns, so lists and filters never read the JSON.
JavaScript for every call someone waits onA JavaScript procedure starts at once, so senders and people never wait on a cold start.
Background work on events onlyA call that leaves work records it; a stream triggers a serverless task shortly after. An idle install costs nothing.
No container, no external connectionSimpler to install and to review; nothing to patch; nothing leaves the account.

Structure

Schemas inside the app: core (state), logic (internal procedures), api (what people, agents and systems call), data (read views), setup (installation), ui (the console).

Shuntline Leads

Every lead, from every source, filed where it belongs

What the app changes for marketing, sales and CRM teams, and why the lead stage belongs upstream of the CRM.

Back to Shuntline Leads →the problem · Salesforce · FAQ