Syncing Actions
The pillar-sync CLI syncs your action definitions to Pillar's backend, enabling the AI to discover and suggest actions to users. Run this command in your CI/CD pipeline after building your app.
Prerequisites
Before syncing, you need:
- A Help Center Slug — Your unique identifier (e.g.,
acme-corp) - A Secret Token — For authenticating sync requests
Get both from the Pillar admin dashboard: Actions → Configure Sync
Quick Start
# Set your credentialsexport PILLAR_SLUG="your-help-center-slug"export PILLAR_SECRET="your-secret-token"# Sync your actionsnpx pillar-sync --actions ./lib/pillar/actions.ts
Installation
The CLI is included with the SDK:
npm install @pillar-ai/sdk# orpnpm add @pillar-ai/sdk# oryarn add @pillar-ai/sdk
Action File Structure
Create a file that exports your action definitions:
// lib/pillar/actions.tsimport type { SyncActionDefinitions } from '@pillar-ai/sdk';export const actions = {open_settings: {description: 'Navigate to the settings page',type: 'navigate' as const,path: '/settings',autoRun: true,autoComplete: true,},invite_member: {description: 'Open the invite team member modal',examples: ['invite someone to my team','add a new user','how do I invite people?',],type: 'trigger_action' as const,},export_data: {description: 'Export current data to CSV',type: 'trigger_action' as const,dataSchema: {type: 'object',properties: {format: {type: 'string',enum: ['csv', 'json', 'xlsx'],description: 'Export format',},includeArchived: {type: 'boolean',description: 'Include archived records',},},required: ['format'],},},admin_dashboard: {description: 'Open the admin dashboard',type: 'navigate' as const,path: '/admin',requiredContext: {userRole: 'admin',},},} as const satisfies SyncActionDefinitions;export default actions;
The sync command supports .ts, .tsx, .js, and .mjs files.
Environment Variables
Required
| Variable | Description |
|---|---|
PILLAR_SLUG | Your help center slug (e.g., acme-corp) |
PILLAR_SECRET | Secret token for authentication |
Optional
| Variable | Default | Description |
|---|---|---|
PILLAR_API_URL | https://help-api.trypillar.com | API URL (override for custom deployments) |
PILLAR_PLATFORM | web | Platform: web, ios, android, desktop |
PILLAR_VERSION | From package.json | App version (semver or git SHA) |
GIT_SHA | Auto-detected | Git commit SHA for traceability |
CLI Arguments
| Argument | Description |
|---|---|
--actions <path> | Path to your actions definition file (required) |
--local | Use localhost:8003 as the API URL |
--help | Show help message |
Local Development
Use the --local flag to sync against a local Pillar backend:
# Sync against local Pillar backend (localhost:8003)PILLAR_SLUG=my-app PILLAR_SECRET=dev-secret \npx pillar-sync --actions ./lib/pillar/actions.ts --local
CI/CD Integration
GitHub Actions
# .github/workflows/deploy.yml
name: Deploy
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
- name: Sync Pillar actions
env:
PILLAR_SLUG: ${{ secrets.PILLAR_SLUG }}
PILLAR_SECRET: ${{ secrets.PILLAR_SECRET }}
GIT_SHA: ${{ github.sha }}
run: npx pillar-sync --actions ./lib/pillar/actions.ts
- name: Deploy
run: npm run deploy
Store PILLAR_SLUG and PILLAR_SECRET as GitHub repository secrets.
GitLab CI
# .gitlab-ci.yml
stages:
- build
- sync
- deploy
build:
stage: build
script:
- npm ci
- npm run build
sync-pillar:
stage: sync
script:
- npx pillar-sync --actions ./lib/pillar/actions.ts
variables:
PILLAR_SLUG: $PILLAR_SLUG
PILLAR_SECRET: $PILLAR_SECRET
GIT_SHA: $CI_COMMIT_SHA
deploy:
stage: deploy
script:
- npm run deploy
Generic CI
#!/bin/bashset -e# Build your appnpm cinpm run build# Sync actions to Pillarexport PILLAR_SLUG="${PILLAR_SLUG}"export PILLAR_SECRET="${PILLAR_SECRET}"export GIT_SHA="${CI_COMMIT_SHA:-$(git rev-parse HEAD)}"npx pillar-sync --actions ./lib/pillar/actions.ts# Deploy your appnpm run deploy
How Sync Works
- Load Actions — The CLI reads and evaluates your actions file
- Build Manifest — Creates a versioned manifest with platform info
- Upload — Sends the manifest to Pillar's API
- Process — Backend processes actions asynchronously (creates, updates, deletes)
- Complete — CLI polls for completion and reports results
Response Statuses
| Status | Description |
|---|---|
unchanged | Manifest matches existing deployment (no-op) |
accepted | Job queued for processing |
created | Deployment created (synchronous mode) |
Debugging
Enable debug mode to write the manifest to disk:
# Enable debug mode to write manifest to diskPILLAR_DEBUG=1 PILLAR_SLUG=my-app PILLAR_SECRET=xxx \npx pillar-sync --actions ./lib/pillar/actions.ts# Check the generated manifestcat actions-manifest.json
This creates actions-manifest.json in your project root.
Version Tracking
Each sync creates a versioned deployment. The CLI tracks:
- Version — From
PILLAR_VERSIONorpackage.json - Git SHA — From
GIT_SHAor auto-detected from git - Platform — From
PILLAR_PLATFORM - Timestamp — When the sync occurred
This enables rollback and audit tracking in the Pillar dashboard.
Best Practices
Sync on Deploy
Always sync actions as part of your deployment pipeline to keep actions in sync with your app:
#!/bin/bash# deploy.sh - Run as part of your deployment# Build the appnpm run build# Sync actions before deployingnpx pillar-sync --actions ./lib/pillar/actions.ts# Deploy (e.g., to Vercel, AWS, etc.)vercel deploy --prod
Use Environment-Specific Slugs
For staging/production environments, use different help center slugs:
# Staging environmentPILLAR_SLUG=myapp-staging PILLAR_SECRET=$STAGING_SECRET \npx pillar-sync --actions ./lib/pillar/actions.ts# Production environmentPILLAR_SLUG=myapp-production PILLAR_SECRET=$PROD_SECRET \npx pillar-sync --actions ./lib/pillar/actions.ts
Next Steps
- Learn how to define actions with full TypeScript support
- Set up context to enable action filtering
- View sync history in the Pillar admin dashboard