adstage
Data Hub

Scheduled Exports

Data Hub > Scheduled Exports runs a query at set times and delivers the result. Only organization OWNER / ADMIN can create and change exports.

1. Create one

The easiest way is to check the query in Data Explorer and press Schedule export. The form opens with connector, fields, range and filters filled in.

FieldDescription
NameShown in the email subject and Slack message
DestinationEmail (CSV attachment), Slack, Webhook (HTTPS POST)
Recipients / URLEmail: up to 10 recipients. Slack: an Incoming Webhook URL https://hooks.slack.com/.... Webhook: an https:// URL (no private networks, IP addresses or localhost)
Body formatWebhook only: JSON or CSV
Connector, fieldsSame as Data Explorer. Fields and filters are checked on save; invalid ones are rejected
AccountsOptional. Comma-separated account ids. Filled in when you come from Data Explorer with accounts selected, cleared when you change the connector. Empty means all accounts
Date rangePreset evaluated at run time. yesterday suits a daily summary, last_7d a weekly one
ScheduleHourly (at :05), Daily (at HH:05), Weekly (weekday at HH:05), in the organization timezone
EnabledDisabled exports don't run

Each run sends up to 10,000 rows. An organization can have up to 50 exports.

2. What each destination receives

Email — subject [AdStage] Name — start ~ end, a totals summary in the body, and the full result as a CSV attachment (with a BOM for Excel).

Slack — name, organization, range, row count, totals and the first 15 rows as a table. Use email or a webhook for the full data.

Webhook — a POST to your URL.

{
  "task": { "id": "…", "name": "Daily channel summary" },
  "data": [ { "date": "2026-11-13", "datasource": "google_ads", "spend": 152000 } ],
  "meta": { "connector": "all", "date_from": "2026-11-13", "date_to": "2026-11-13", "currency": "KRW", "totals": { "spend": 152000 } }
}
HeaderValue
Content-Typeapplication/json or text/csv; charset=utf-8
X-AdStage-Export-IdScheduled export id
X-AdStage-TimestampSend time (Unix seconds)
X-AdStage-Signaturesha256= + HMAC-SHA256(signing secret, timestamp + . + body)

A non-2xx response counts as a failure. Redirects are not followed. Respond within 30 seconds.

3. Verifying the webhook signature

When you create a webhook export, its signing secret (whsec_…) is shown once. Verify requests like this and reject timestamps older than 5 minutes.

Node.js

const crypto = require('crypto');
 
function verify(req, rawBody, secret) {
  const ts = req.headers['x-adstage-timestamp'];
  const sig = req.headers['x-adstage-signature'] || '';
  if (Math.abs(Date.now() / 1000 - Number(ts)) > 300) return false;
  const expected = 'sha256=' + crypto.createHmac('sha256', secret).update(`${ts}.${rawBody}`).digest('hex');
  return sig.length === expected.length && crypto.timingSafeEqual(Buffer.from(sig), Buffer.from(expected));
}

Python

import hmac, hashlib, time
 
def verify(headers, raw_body: bytes, secret: str) -> bool:
    ts = headers["X-AdStage-Timestamp"]
    if abs(time.time() - int(ts)) > 300:
        return False
    expected = "sha256=" + hmac.new(secret.encode(), f"{ts}.".encode() + raw_body, hashlib.sha256).hexdigest()
    return hmac.compare_digest(headers.get("X-AdStage-Signature", ""), expected)

4. Run history and failures

  • The list shows the last run time and result (SUCCESS + row count / FAILED + reason) and the next run time.
  • Run now (▶) sends once immediately. The next scheduled time stays the same.
  • A failed run is retried on the next schedule. After 10 consecutive failures the export turns itself off. Fix the cause (URL, recipients, fields) and turn it back on.
  • When editing, leave the URL empty to keep the saved URL (the screen shows it only partially).

สารบัญ