Skip to main content
Each project can have a SQLite database hosted on Cloudflare D1. Store user profiles, conversation history, leads, or any data your WhatsApp application needs.

Enable database

  1. Go to project settings → Database
  2. Click “Enable database”
  3. Database provisions automatically via Cloudflare D1

Dashboard features

  • Spreadsheet view - Click cells to select, double-click to edit
  • Table management - Create tables, add/rename/drop columns
  • SQL editor - Run raw queries
  • CSV import/export - Bulk data operations
  • Pagination - 25/50/100/200 rows per page

Column types

TypeDescription
textString values
integerWhole numbers
numberDecimal numbers
booleantrue/false
dateDate without time
datetimeDate with time
jsonJSON objects
arrayJSON arrays
file_urlURL to file
referenceForeign key

Using the database

Platform API

Query and modify data from your backend via REST endpoints. See Database API. Agent steps can access the database by adding a webhook tool that calls these endpoints.

Functions

Access D1 directly via env.DB in your function code:
// Query
const { results } = await env.DB.prepare(
  "SELECT * FROM customers WHERE phone = ?"
).bind(vars.phone).all()

// Insert
await env.DB.prepare(
  "INSERT INTO customers (phone, name) VALUES (?, ?)"
).bind(vars.phone, vars.name).run()
Agent steps can invoke functions via webhook tools to access the database indirectly.