Developer recipe

Build an automated follow-up sequence

Create a personalized campaign with two timed follow-ups that stop automatically when a recipient replies.

Result
Contacts are queued for an initial message, a first follow-up after 48 hours, and a second follow-up 72 hours later.
Time
10 minutes
Key scopes
readsend

How timing works

Campaign creation queues the recipients; GramClaw's background worker performs the sends. decision_wait_hours controls the delay from the initial message to the first follow-up. The next step's wait_hours controls the delay after the preceding follow-up.

An inbound reply marks that campaign contact as replied and clears its next scheduled action before another follow-up is sent.

1. Set your credentials

Terminal
export GRAMCLAW_BASE_URL="https://gramclaw.com"
export GRAMCLAW_API_KEY="gc_live_replace_with_your_key"
export TELEGRAM_ACCOUNT_ID="replace_with_account_id"

2. Create the sequence

Use account_pool instead of account_id when you intentionally want GramClaw to distribute new conversations across several connected accounts.

Terminal
curl -s "$GRAMCLAW_BASE_URL/api/v1/campaigns" \
  -H "Authorization: Bearer $GRAMCLAW_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: early-access-sequence-001" \
  -d '{
    "name": "Early access follow-up",
    "account_id": "'"$TELEGRAM_ACCOUNT_ID"'",
    "message_text": "Hi {{name}}, would a Telegram-first outreach workspace be useful for your team?",
    "contacts": [
      { "name": "Alex", "identifier": "@alex_username" },
      { "name": "Sam", "identifier": "@sam_username" }
    ],
    "decision_wait_hours": 48,
    "max_followups": 2,
    "daily_quota_per_account": 20,
    "steps": [
      {
        "branch": "no_reply",
        "step_order": 0,
        "wait_hours": 48,
        "variants": ["Hi {{name}}, just bringing this back in case it got buried. Is this relevant right now?"]
      },
      {
        "branch": "no_reply",
        "step_order": 1,
        "wait_hours": 72,
        "variants": ["Hi {{name}}, I will close the loop here. Feel free to message me if this becomes useful later."]
      }
    ]
  }'

3. Check delivery and replies

The creation response returns campaign.id. Use it to inspect per-contact status; this read requires the read scope.

Terminal
export CAMPAIGN_ID="replace_with_campaign_id"

curl -s "$GRAMCLAW_BASE_URL/api/v1/campaigns/$CAMPAIGN_ID" \
  -H "Authorization: Bearer $GRAMCLAW_API_KEY"
  • Campaigns accept at most 5,000 contacts per request.
  • Suppressed contacts are blocked at send time, including retries and follow-ups.
  • Daily quotas and quiet hours can delay a due message; queued does not mean it was sent immediately.
  • A 400 response includes a plain error string for invalid contacts, accounts, or sequence data.
Chat on Telegram