← All tutorialsInternal

Slack DM digest

Once a day, chat.read each Slack channel you care about, summarize unreads, chat.dm a personalized digest to each opted-in user.

Cost~$0.01 per recipient
Operations
chat.readtext_generation.generatechat.dm

Prerequisites

  • Slack bot installed with chat.* scopes.
  • Opted-in user list in your DB (preferences per user).

Walkthrough

1. Read channels

chat.read with `since:'24h'` per channel. Dedupe message ids if you run hourly.

2. Summarize per user

GPT-4o-mini, prompt includes the user's interests so the digest is tailored.

3. DM

chat.dm to each user. Idempotency key = `digest_<userId>_<YYYY-MM-DD>` so a duplicate cron run is a no-op.

bash# Per-user DM with date-stamped idempotency.
curl -X POST https://www.upivia.com/v1/service-requests \
  -H "Authorization: Bearer $AGENT_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "service":"chat",
    "operation":"dm",
    "payload":{"user_id":"U0123","text":"*Today's digest*\n- ..."},
    "idempotency_key":"digest_U0123_2026-05-25"
  }'

Next steps

Audit every call at /audit-logs, watch spend at /usage, and tune budgets per service on the agent's page.

Create an account →