Slack CRM Agent

An ad-hoc CRM agent that lives on Slack, maintains a SQLite database in a persistent Space via bash, and lets team members manage contacts, deals, tasks, and notes through natural conversation - no separate CRM app required.

slack
crm
sqlite
1597

The Slack CRM Agent blueprint demonstrates one of the most practical applications of the platform: a conversational CRM that lives entirely inside Slack. Instead of forcing teams to switch between a dedicated CRM application and their daily communication tool, this agent brings the CRM to where the work already happens.

The Problem

Most small-to-medium teams either use an overweight CRM they barely touch, or they track customer relationships in spreadsheets, sticky notes, and memory. The friction of switching to a separate tool means data never gets entered, and the CRM becomes stale within weeks. What teams actually need is something they can talk to where they already work - Slack.

How It Works

The agent combines three powerful capabilities:

  • Slack integration - The agent lives on Slack and can be messaged directly or mentioned in channels. Team members interact with it using natural language: "add a contact John Smith from Acme Corp", "update the deal with Acme to negotiation stage", "show me all deals closing this month".

  • SQLite via bash - The agent has a shell ability bound to a persistent Space. It uses SQLite3 to maintain a proper relational database with tables for contacts, companies, deals, activities, and tasks. This gives it real query power - filtering, sorting, joins, aggregations - far beyond what file-based storage can offer.

  • Self-bootstrapping - On first run (or if the database is missing), the agent reads the bootstrap file which contains the complete database schema and setup instructions. It then creates and initialises the SQLite database automatically - no manual setup required.

The Bootstrap File

The bootstrap file is a standalone file resource (outside the Space) that the agent reads at the start of every session. It contains:

  • The full SQLite schema (contacts, companies, deals, activities, tasks)
  • Instructions for checking whether the database exists
  • The exact SQL commands to create all tables and indices
  • Usage guidelines for how to query and update the CRM
  • Data conventions (date formats, status values, stage names)

Because the bootstrap file is a file resource rather than part of the Space, it acts as immutable configuration - the agent reads it but never modifies it. The Space is where all mutable data lives (the SQLite database file itself).

Why SQLite in a Space?

Spaces provide a persistent file system. SQLite stores its entire database in a single file. Together, they give the agent a fully relational database that survives across sessions. The agent can run arbitrary SQL queries, create views, add indices, and even evolve the schema over time as needs change. This is far more powerful than key-value or document storage for CRM data where relationships matter (a contact belongs to a company, a deal has multiple contacts, an activity is linked to both a deal and a contact).

What You Can Do

Through natural conversation on Slack, team members can:

  • Add and update contacts and companies
  • Create and move deals through pipeline stages
  • Log activities (calls, emails, meetings) against contacts and deals
  • Create and assign follow-up tasks with due dates
  • Query the pipeline ("show me all open deals over $10K")
  • Get summaries ("what happened with Acme Corp this week?")
  • Track performance ("how many deals did we close this month?")

Getting Started

  1. Deploy the blueprint and configure the Slack integration with your workspace bot token and signing secret.
  2. Message the agent on Slack. On first interaction, it will read the bootstrap file and create the CRM database automatically.
  3. Start managing your contacts, deals, and pipeline through conversation.
  4. The database persists in the Space - browse it to see the SQLite file and any exports the agent creates.

Backstory

Common information about the bot's experience, skills and personality. For more information, see the Backstory documentation.

You are the Slack CRM Agent - a conversational customer relationship management system that lives in Slack. ## YOUR ROLE You are the team's CRM. Team members interact with you on Slack to manage contacts, companies, deals, activities, and tasks. You maintain all data in a SQLite database stored in your workspace. ## BOOTSTRAP At the start of every session: 1. **Read the bootstrap file** - Use the file read ability to load the bootstrap instructions file. This contains the full database schema and setup instructions. 2. **Check if the database exists** - Run `ls -la /data/crm.db` in the workspace. If the file does not exist, you need to bootstrap. 3. **Bootstrap if needed** - If the database is missing, run the SQL commands from the bootstrap file to create all tables and indices. Use `sqlite3 /data/crm.db` to execute the schema. 4. **Verify** - After bootstrap, run a quick check: `sqlite3 /data/crm.db ".tables"` to confirm all tables were created. ## CRM OPERATIONS All database operations use `sqlite3 /data/crm.db` via bash. Common operations: **Contacts & Companies** - Add contacts: INSERT into contacts table with name, email, phone, company_id, role, notes - Add companies: INSERT into companies table with name, domain, industry, size, notes - Look up: SELECT with WHERE clauses, JOIN contacts to companies - Update: UPDATE statements for any field **Deals & Pipeline** - Create deals: INSERT into deals with title, value, stage, contact_id, company_id, expected_close_date - Move stages: UPDATE deals SET stage = 'negotiation' - Pipeline view: SELECT with GROUP BY stage, SUM(value) - Forecast: SELECT deals WHERE stage != 'closed-lost' with time filters **Activities & Tasks** - Log activities: INSERT into activities with type (call, email, meeting, note), contact_id, deal_id, summary, date - Create tasks: INSERT into tasks with title, assignee, due_date, contact_id, deal_id, status - Due tasks: SELECT tasks WHERE due_date <= date('now') AND status != 'done' **Queries & Reports** - Use SQL aggregations for summaries and reports - JOIN tables to answer relationship questions - Use date functions for time-based filtering - Format results as readable Slack messages with tables or bullet points ## RESPONDING TO SLACK When a team member messages you: 1. Understand their intent (add, update, query, report) 2. Translate to the appropriate SQL operation 3. Execute via bash 4. Format the result in a clear, readable way 5. If the request is ambiguous, ask for clarification ## RULES - Always read the bootstrap file at session start. - Always check if the database exists before operations. - Use parameterised-style queries when constructing SQL from user input - escape single quotes properly. - Never drop tables or delete the database file. - Format monetary values with currency symbols. - Use ISO date format (YYYY-MM-DD) consistently. - When showing pipeline data, order by stage progression. - Keep Slack responses concise - use bullet points and tables. - If a query returns no results, say so clearly. - The current date is ${EARTH_DATE}

Skillset

This example uses a dedicated Skillset. Skillsets are collections of abilities that can be used to create a bot with a specific set of functions and features it can perform.

  • Start Slack Conversation

    Start a new Slack conversation with a specific user by sending them a direct message. Use this to proactively reach out to team members about deals, tasks, or follow-ups.
  • Bash

    Execute shell commands in the CRM workspace. Use this to run sqlite3 commands against the CRM database, check file existence, and perform any command-line operations.
  • Read/Write Workspace File

    Read or write files in the CRM workspace. Use for reading and writing reports, exports, or other non-database files.
  • 🏢

    List Workspace Files

    List files and directories in the CRM workspace.
  • 🇷🇺

    Read Bootstrap File

    Read the CRM Bootstrap file to get the database schema and setup instructions. Use this at the start of every session.

Terraform Code

This blueprint can be deployed using Terraform, enabling infrastructure-as-code management of your ChatBotKit resources. Use the code below to recreate this example in your own environment.

Copy this Terraform configuration to deploy the blueprint resources:

Next steps:

  1. Save the code above to a file named main.tf
  2. Set your API key: export CHATBOTKIT_API_KEY=your-api-key
  3. Run terraform init to initialize
  4. Run terraform plan to preview changes
  5. Run terraform apply to deploy

Learn more about the Terraform provider

A dedicated team of experts is available to help you create your perfect chatbot. Reach out via or chat for more information.