Shuntline›Solutions›Send · documentation
Shuntline Send · documentation · version 1.0
Constrain, segment, send
Reverse ETL for messaging, inside your Snowflake account: segments built on your own tables, mailings sent through your own Postmark or Amazon SES account (SMS and WhatsApp through Twilio, and Salesforce Marketing Cloud, coming), and every message, run and provider answer kept as SQL views. No platform in between, nothing copied out. For Snowflake administrators, marketing operations, data engineers and security reviewers.
Install and try
A Snowflake Native App from the Snowflake Marketplace. It runs in your account, reads your tables with the grants you give it, and reaches only the provider hosts you approve.
- 01 · INSTALL
From the listing
Install into your account and approve the privileges it asks for.
- 02 · TRY
The sample
Ten test contacts in Send's own list, a sandbox sender that renders and records without sending, four templates, a segment and a mailing sent once. No table of yours is created.
- 03 · CONNECT
Your provider
A sender with its credentials, kept in a secret of the app; you approve its host and nothing leaves before.
- 04 · SEND
Your contacts
Grant a table, set it up once as a source, build a segment, then preview and activate a mailing.
CALL SHUNTLINE_SEND.API.MANAGE('load_sample', {});
| Privilege requested | Why |
|---|---|
CREATE WAREHOUSE | The app's own X-Small warehouse (SHUNTLINE_SEND_WH) for the console and its procedures, suspended 60 seconds after the last query. |
EXECUTE TASK · EXECUTE MANAGED TASK | Serverless tasks for scheduled and one-time mailings, for the checks your pipeline asks for, and for runs started from the console. None runs without a mailing to run. |
CREATE EXTERNAL ACCESS INTEGRATION | To reach your provider's API, only on the hosts you approve (api.postmarkapp.com, email.<region>.amazonaws.com). |
Standard tables only: every cloud and region, trial accounts included. CALL SHUNTLINE_SEND.SETUP.STATUS(); shows the edition, the connections, the hosts' approval, the senders, the mailings and the tasks.
Editions
Standard is the free Marketplace listing, with no end date. Enterprise is the full product, on request. Snowflake tells the app which listing it came from: there is no licence key to keep.
| Standard · free | Enterprise · on request | |
|---|---|---|
| Sources, segments, mailings, templates, rules, events and suppression, test contacts, imports, schedules, console, SQL API | ✓ | ✓ |
| Email through Postmark, the sandbox sender | ✓ | ✓ |
| Email through Amazon SES | ✓ | |
| SMS and WhatsApp through Twilio | ✓ delivery coming | |
| Email and SMS through Salesforce Marketing Cloud | ✓ delivery coming |
To move to Enterprise, use Request full access on the listing: we answer with an Enterprise listing for your account, installed as its own application. Twilio and Marketing Cloud senders can already be configured and their mailings built and previewed; they send once their delivery ships.
Concepts
Your data stays where it is. The app reads it with the grants you give it, at each run, and copies nothing.
| Source | A table or view of yours, granted to the app once and set up by an administrator: the column that identifies a contact (the key), the address, the consent register that answers for these contacts (Shuntline Opt-in or a table of decisions), and how it is refreshed (on its own, or by your data pipeline). Contacts can be customers, partners or employees: the app does not mind. |
|---|---|
| Segment | Who, among a source's rows: conditions on its columns, in groups that match all or any, nested up to three deep. Compiled into the source's scan at each run, values bound, never written into SQL. A segment without conditions is everyone in its source. |
| Mailing | A template sent to a segment through a sender. The segment says who receives it; the mailing says what, and when: each person once, again when chosen fields change, or everyone at each send. Rules apply on the way: consent, built-in suppression, a frequency cap; optionally a campaign. |
| Template | A subject, preheader, HTML and text body, with placeholders filled from the row; or a template designed at your provider, with the fields it receives. |
| Sender | A provider account: Postmark, Amazon SES, Twilio, Salesforce Marketing Cloud, or the sandbox. Credentials live in a secret of the app, never a table or a view. |
| Events | Send's log of what the providers report about addresses (bounces, complaints, unsubscriptions): the view DATA.EMAIL_EVENTS, and the built-in suppression every mailing applies. |
| Test contacts | Send's own short list of internal people and test addresses: a built-in source for trying a mailing, and the recipients a test send picks from. |
| Run | One execution of a mailing: one statement Snowflake executes, the messages rendered and handed to the provider, the outcome recorded. Only one run of a mailing at a time. |
How a run decides
Each run reads the segment as it is at that moment, one row per key, picks who is due, then applies the rules in order, each row getting one status.
Who is due
Each person once once | Keys never sent by this mailing: a welcome, an onboarding step, a confirmation. |
|---|---|
Again when fields change on_change | Keys whose chosen fields changed since their last message (a renewal date, a plan, a balance), or any field: a renewal notice, a statement, an alert. |
Everyone, at each send every_run | Every row, every time: a digest or a newsletter. |
A once or on_change mailing starts from a baseline: its first run remembers the people already there and sends nothing, so activating a welcome email does not mail every contact you have. send_to_existing sends to them too.
The rules
invalid | No address, or not an address. |
|---|---|
suppressed | Built in: the address's latest event in Send's log is a hard bounce, a complaint, inactive or invalid (every mailing), or an unsubscription (marketing mailings only: an order or a renewal notice still reaches it). |
no_consent | A marketing mailing asks its source's consent register for a purpose, and the decision does not allow it: opted_in sends only to those who agreed, not_opted_out to all but those who refused. A refusal in any row wins. |
capped | A marketing mailing, and the address already received the frequency cap's number of marketing messages in its window. |
deferred | Beyond the run's maximum (10,000 by default): sent by the next run. |
What remains is rendered and delivered: Postmark in batches of 500, Amazon SES paced to your sending rate. Each batch is recorded as soon as the provider answers, so a run that stops loses at most the batch in flight. API.PREVIEW_MAILING shows all of this before anything is sent, writing nothing.
Providers
Your own provider accounts: the app hands each message straight to them. Credentials go into a secret of the app, read only by the delivery procedure, and travel as bound parameters, so they appear in no query history.
| Postmark | A server API token and a From address confirmed in Postmark; the broadcast message stream for marketing (Postmark adds the one-click unsubscribe headers and link). The token POSTMARK_API_TEST accepts messages and delivers none: a safe first run. |
|---|---|
| Amazon SES Enterprise | An IAM access key allowed ses:SendEmail, ses:GetAccount, ses:GetEmailTemplate and ses:ListSuppressedDestinations (and ses:TestRenderEmailTemplate to preview SES templates); a verified From address or domain; your region; optionally a configuration set. |
| Twilio Enterprise · coming | SMS and WhatsApp: the Account SID, the channel, a From number or a messaging service. |
| Salesforce Marketing Cloud Enterprise · coming | Email or SMS through a transactional send definition: tenant subdomain, business unit, definition key. |
| Sandbox | Renders and records as a provider would be given it, sends nothing. |
Approving the provider's host
A Native App cannot reach the internet by default. Once a sender has credentials, Send asks for its provider's exact host, and only that host: api.postmarkapp.com for Postmark, email.<region>.amazonaws.com for Amazon SES. The request is an app specification named EMAIL_PROVIDERS. Your account administrator approves it with a role holding MANAGE APPLICATION SPECIFICATIONS (by default SECURITYADMIN; owning the app is not enough). In Snowsight: Catalog › Apps › SHUNTLINE_SEND, the Settings icon in the toolbar, Connections; expand Details to see the requested endpoint, then … › Approve. Or in SQL:
CALL SHUNTLINE_SEND.SETUP.SET_CREDENTIALS('postmark_main', '<server token>');
-- the first credentials make the app ask for the provider's host; nothing leaves until you approve
SHOW SPECIFICATIONS IN APPLICATION SHUNTLINE_SEND;
DESC SPECIFICATION EMAIL_PROVIDERS IN APPLICATION SHUNTLINE_SEND;
ALTER APPLICATION SHUNTLINE_SEND APPROVE SPECIFICATION EMAIL_PROVIDERS SEQUENCE_NUMBER = <the latest>;
Until then the sender's page says Waiting for approval and its mailings do not run. A new provider, or an SES sender in another region, changes the list of hosts: Snowflake gives the specification a new sequence number, to approve again.
Events and suppression
What the providers report about addresses is kept in Send's events log, and holds those addresses back. Nothing to set up: suppression is built in, the same for every source.
| What comes back | Hard bounces, spam complaints, unsubscriptions through the provider's links, inactive or invalid recipients: with the answer to each batch, and the provider's suppression list pulled before each run (at most hourly). Each event is tied to the latest message sent to that address: its mailing, its source, its row. |
|---|---|
| Held back | An address whose latest event is a hard bounce, a complaint, inactive or invalid is held back from every mailing; an unsubscription, from marketing mailings only. Until an administrator reactivates it (SQL, audited), e.g. after removing it from the provider's own list. |
| Shuntline Opt-in optional | A source can record its mailings' unsubscriptions and complaints, the person's own choices, as opt-outs in Shuntline Opt-in. Bounces are facts about the address and stay in Send. |
DATA.EMAIL_EVENTS | Every event, with its address, when, the provider and message id, the mailing, source and row, the provider's detail, and its passes to Opt-in. Copy it into a table of yours with a task if you want your own names. |
-- what came back this week, by mailing
SELECT mailing, event, COUNT(*) AS addresses
FROM SHUNTLINE_SEND.DATA.EMAIL_EVENTS
WHERE at > DATEADD(day, -7, CURRENT_TIMESTAMP())
GROUP BY 1, 2 ORDER BY 1, 3 DESC;
-- an address fixed at the provider: sendable again
CALL SHUNTLINE_SEND.API.MANAGE('reactivate_address', {'address': 'ada@example.com', 'reason': 'Typo fixed, removed from Postmark suppressions'});
Importing history
Bounces and unsubscriptions from before Send, or messages sent elsewhere, come in as one import batch from a table or view granted to the app: import_activity with kind: 'events' (they join the log and its suppression) or kind: 'messages' (deliveries, and the mailing's record, so a once mailing does not send them again). Refused rows are counted by reason, never written. DATA.IMPORTS lists every batch, and remove_import takes one back out, exactly.
GRANT SELECT ON TABLE crm.marketing.old_bounces TO APPLICATION SHUNTLINE_SEND;
CALL SHUNTLINE_SEND.API.MANAGE('import_activity', {'kind': 'events', 'source': 'CRM.MARKETING.OLD_BOUNCES'});
Templates
Placeholders filled from the row. A template's page previews as you type with its sample values (or the first test contact), using the same code the runs render with; a mailing's preview renders real rows of its segment.
| Write | Renders |
|---|---|
{{ first_name }} | A column of the row, whatever its case; HTML-escaped in the HTML body. |
{{ address.city }} | A field inside a VARIANT or OBJECT column. |
{{{ cta_url }}} | The value as it is: HTML, or a URL your view built. |
{{ first_name | default: "there" }} | Filters: default, upper, lower, capitalize, trim, url, number: 2. |
{{# is_vip }}…{{/ is_vip }} | Shown when true; repeated once per item of an array. |
{{^ auto_renew }}…{{/ auto_renew }} | Shown when false or empty. |
{{ campaign.utm_campaign }} | The mailing's campaign, from the campaign referential. |
Templates designed at your provider. A template can also live in Postmark or Amazon SES, with their editors and layouts: Send holds its reference and the fields it receives (only those leave Snowflake, never the whole row). A mailing's preview asks the provider to render it with each sample row, read-only and without sending (Postmark validates the template with the fields as its test model; SES TestRenderEmailTemplate), and shows the fields under the rendering. With the sandbox, or a sender not ready yet, the preview shows the fields and says why it is not rendered.
When a mailing sends
Who receives it is the segment's business; when is the mailing's. A scheduled or one-time mailing has a serverless task of its own while it is active; pausing it removes the task.
| Each time its source is refreshed | The source is refreshed by your data pipeline: after each load the pipeline calls API.SOURCE_REFRESHED('<source>'), and every active welcome, onboarding or renewal mailing on that source is checked within a minute. The pipeline's role needs only the application role SEND_PIPELINE. |
|---|---|
| Checked on a clock | The same mailings without a pipeline signal: every 15 minutes, hour or day. |
| Once, at a date and time | send_at: '2026-12-01 12:00' in the mailing's time zone: a newsletter, an announcement. It sends at that minute, then is completed. |
| On a schedule | A cron (0 8 * * 1) in its time zone: digests; the mode decides who is due at each send. |
| Manually | The console's Send now, for a mailing to everyone sent by hand. |
-- once, by an administrator
GRANT APPLICATION ROLE SHUNTLINE_SEND.SEND_PIPELINE TO ROLE <pipeline role>;
-- at the end of each load (dbt, Airflow, a Snowflake task)
CALL SHUNTLINE_SEND.API.SOURCE_REFRESHED('contacts');
SQL API
Everything the console does, callable from a worksheet, a pipeline, any Snowflake driver or an AI agent. SHUNTLINE_SEND is the default app name.
Read
| View | What it holds |
|---|---|
DATA.DELIVERIES | Every message handed to a provider: address, key, subject, sent or failed, the provider's message id, the campaign. Never the bodies. |
DATA.RUNS · DATA.DAILY | Runs (how started, rows per status, error); per day and mailing, sent, failed, recipients. |
DATA.RECIPIENTS | What each mailing last sent each key. |
DATA.EMAIL_EVENTS · DATA.FEEDBACK_PASSES | Send's events log, tied to mailings and sources; every pass to Shuntline Opt-in. |
DATA.IMPORTS · DATA.TEST_CONTACTS | Import batches (rows accepted and refused, removed or not); the test contacts. |
DATA.SOURCES · DATA.SEGMENTS · DATA.MAILINGS · DATA.TEMPLATES · DATA.SENDERS · DATA.MAPPINGS | The configuration: sources with their consent register and refresh; senders without their credentials; the campaign referential. |
Act
| Procedure | Purpose |
|---|---|
API.SAVE_SEGMENT · API.PREVIEW_SEGMENT | A segment's conditions; the keys it holds now, sample rows and the WHERE it compiles to. |
API.SAVE_TEMPLATE · API.PREVIEW_TEMPLATE · API.CHECK_TEMPLATE · API.RENDER | Templates, rendered with a row; a provider template looked up at the provider (read-only). |
API.SAVE_MAILING · API.MAILING_ACTION | A mailing to a segment (created paused); activate, pause, archive, restore. |
API.PREVIEW_MAILING | What a run would do now, writing nothing: rows per status, rendered samples (a provider template rendered by the provider), rows not sent and why. |
API.SOURCE_REFRESHED | Your pipeline says a source has loaded: its triggered mailings are checked within a minute. |
API.RUN_MAILING · API.TEST_SEND | A check or send now (SQL only, not in the console); one test message, subject prefixed. |
API.MANAGE(op, args) | Administrators: senders, sources, the campaign referential, imports, reactivation, rules, the sample; editors: test contacts. |
SETUP.SET_CREDENTIALS · SETUP.STATUS | A sender's credentials, into a secret; the install's state. |
Examples
Set up a source, segment it, mail it on your pipeline's signal, follow what comes back, measure in the warehouse.
A source and a segment
GRANT USAGE ON DATABASE crm TO APPLICATION SHUNTLINE_SEND;
GRANT USAGE ON SCHEMA crm.marketing TO APPLICATION SHUNTLINE_SEND;
GRANT SELECT ON TABLE crm.marketing.contacts TO APPLICATION SHUNTLINE_SEND;
GRANT SELECT ON TABLE crm.marketing.email_preferences TO APPLICATION SHUNTLINE_SEND;
CALL SHUNTLINE_SEND.API.MANAGE('save_source', {'code': 'contacts', 'name': 'Contacts',
'source': 'CRM.MARKETING.CONTACTS', 'columns': {'key': 'contact_id', 'email': 'email'},
'refreshed_by': 'pipeline',
'consent': {'type': 'table', 'source': 'CRM.MARKETING.EMAIL_PREFERENCES',
'columns': {'email': 'email', 'status': 'status', 'purpose': 'topic'},
'granted': ['subscribed'], 'refused': ['unsubscribed']}});
CALL SHUNTLINE_SEND.API.SAVE_SEGMENT({'code': 'eu_renewals', 'name': 'EU renewals', 'source': 'contacts',
'conditions': {'match': 'all', 'conditions': [
{'column': 'country', 'op': 'in', 'value': ['FR', 'DE', 'ES']},
{'column': 'renewal_date', 'op': 'in_next_days', 'value': 30}]}});
A renewal notice, again when the renewal date changes
CALL SHUNTLINE_SEND.API.SAVE_MAILING({'code': 'renewal_reminders', 'name': 'Renewal reminders',
'segment': 'eu_renewals', 'template': 'renewal_reminder', 'sender': 'postmark_main',
'mode': 'on_change', 'change_fields': ['renewal_date'], 'category': 'transactional'});
CALL SHUNTLINE_SEND.API.MAILING_ACTION('renewal_reminders', 'activate');
-- then, from the pipeline, after each load
CALL SHUNTLINE_SEND.API.SOURCE_REFRESHED('contacts');
What came back, and attribution
SELECT address, event, at, mailing, detail
FROM SHUNTLINE_SEND.DATA.EMAIL_EVENTS
WHERE source = 'contacts' ORDER BY at DESC LIMIT 50;
SELECT d.mailing, COUNT_IF(d.status = 'sent') AS sent, COUNT(DISTINCT o.order_id) AS orders_within_7_days
FROM SHUNTLINE_SEND.DATA.DELIVERIES d
LEFT JOIN shop.orders o ON o.email = d.email AND o.ordered_at BETWEEN d.at AND DATEADD(day, 7, d.at)
GROUP BY d.mailing;
Access
The same rule at every way in: the console, the procedures, the views and the AI agents that use them.
| Application role | Opens |
|---|---|
SEND_VIEWER | The DATA views, previews, API.RENDER. |
SEND_EDITOR | Templates, segments and mailings, test contacts, test sends (includes viewer). |
SEND_ADMIN | The Streamlit console; senders and credentials, sources, the campaign referential, imports and reactivation, the rules, connections, the sample (includes editor). The installing role holds it. |
SEND_PIPELINE | API.SOURCE_REFRESHED only: for your data pipeline's service role. |
The app's roles
Granted by your Snowflake administrator; the grant is the whole decision.
Roles per person
Administrator, editor, viewer, decided per person in the console, the procedures and the views. Shuntline Hub →
GRANT APPLICATION ROLE SHUNTLINE_SEND.SEND_EDITOR TO ROLE <marketing ops role>;
GRANT APPLICATION ROLE SHUNTLINE_SEND.SEND_VIEWER TO ROLE <analyst role>;
-- with Shuntline Opt-in: a source's consent register, and where its opt-outs are recorded
GRANT APPLICATION ROLE SHUNTLINE_OPTIN.OPTIN_VIEWER TO APPLICATION SHUNTLINE_SEND;
GRANT APPLICATION ROLE SHUNTLINE_OPTIN.OPTIN_INTEGRATION TO APPLICATION SHUNTLINE_SEND;
CALL SHUNTLINE_SEND.SETUP.CONNECT_OPTIN('SHUNTLINE_OPTIN');
-- with Shuntline Hub
GRANT APPLICATION ROLE SHUNTLINE_HUB.SOLUTION_RUNTIME TO APPLICATION SHUNTLINE_SEND;
CALL SHUNTLINE_SEND.SETUP.CONNECT_HUB('SHUNTLINE_HUB', 'send');
Architecture
Installed from the Marketplace into your account, the app runs there with your data. The only thing that leaves is each message, to the provider host you approved.
| Component | What it is |
|---|---|
| Console | Streamlit in Snowsight: overview, mailings (and test contacts), segments, templates, runs (and events); sources, senders and settings for administrators. |
| Engine | JavaScript procedures: sources, segments, rules, rendering, runs, imports, access. One planning statement per run. |
| Delivery | A Python procedure created with the external access integration and the senders' secrets, the only code that reaches out: sends, provider feedback, template checks and previews. |
| Tasks | Serverless: one per scheduled or one-time mailing while active, and a runner on the queue of console runs and pipeline signals. |
| Tables | Standard tables: configuration, runs, deliveries, the ledger of what each key received, the events log and its passes, import batches, test contacts, audit. |
Design choices
| Read live, copy nothing | Sources, segments, consent registers and campaigns are joins of one statement, with the app's grants. No sync between tables. |
|---|---|
| Segments are data, not SQL | Columns checked and quoted, values bound: a segment cannot inject SQL. |
| Suppression built in | One events log, one rule for every source: what a provider refused is not sent to again until someone says why. |
| Hosts you approve | An app specification lists each provider host; nothing leaves until you approve it, and you can revoke it. |
| One run per mailing | A compare-and-set lock: two runs never send the same mailing at once. |