attio-slack-summaries
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Viewing readonly version of experimenting branch: v562View latest version
This val summarizes recent events on Attio lists on Slack
This project receives Attio webhooks, verifies and processes them, and stores events, messages, and list entry state data in SQLite. A scheduled cron job uses then periodically sends summaries with these stored messages to Slack.
- Remix this val
- Get a Slack webhook
& set it as
SLACK_WEBHOOK_URL
in this val's Environment variables in the left sidebar - Get an Attio Access Token
(with all read & write permissions) & set it as
ATTIO_API_KEY
in this val's Environment variables in the left sidebar - Set
config.workspaceName
inconfig.ts
to the name of your Attio workspace - For each list you want to get notifications about, add an object to the
config.lists
array inconfig.ts
. This object must contain alistId
,notificationHeader
, andobjectName
.- To find your list's id,
navigate to the list and copy the path segment after
collection
:https://app.attio.com/<workspaceName/collection/<listId>
. - The
notificationHeader
is the header that will appear in slack. objectName
is the singular name of the object that list entries in the target list are a instances of. If you're unsure, navigate to the record for one of the list entries and copy the path segment after your workspace's name:https://app.attio.com/<workspaceName/<objectName>/<record_id>
- To find your list's id,
navigate to the list and copy the path segment after
- Go to
setup.ts
and click run to set up the events database and Attio webhook - Go to
alert.ts
and click run to set up the cron job - Go trigger some Attio events and see the message in Slack!
If you want to get notifications about more than one list from your workspace,
simply add another listConfig
object to the lists
array in
config.ts
the same way as you did in step 5, above.
Then, go to add-list.ts
](./scripts/add-list.ts) and run the script. This will
initialize the list in SQLite.
attio-slack-summaries/
├── webhook.ts # Main HTTP endpoint - receives Attio webhooks via Hono framework
├── config.ts # Configuration - workspace name & list IDs for different CRM lists
├── README.md # Documentation - setup instructions & file explanations
├── services/
│ ├── alert/
│ │ └── alert.ts # Cron job - processes recent events & sends Slack summaries
│ ├── attio/
│ │ ├── webhook.ts # Attio webhook management - creates/stores webhook configs
│ │ └── utils.ts # Attio API utilities & helpers
│ ├── auth.ts # HMAC signature verification for webhook security
│ └── webhook/
│ └── handle-webhook.ts # Webhook event processing logic
├── shared/
│ ├── slack.ts # Slack integration - message formatting & webhook sending
│ ├── format.ts # Message formatting utilities for human-readable text
│ ├── enrich-entry.ts # Data enrichment for CRM entries
│ └── initialize-entries.ts # Entry initialization logic
│
├── types/
│ ├── index.ts # Core application types
│ └── webhook.ts # Attio webhook payload type definitions
│
├── database/ # Data persistence layer
│ ├── schema.ts # SQLite table definitions (events, messages, entries)
│ └── sqlite.ts # Database operations - CRUD for webhook events & messages
│
└── scripts/
├── setup.ts # One-time setup - creates DB tables & Attio webhook
└── add-list.ts # Add new CRM list configuration