Workflows Documentation
Introduction
Workflows are automated processes that help you streamline your business operations by connecting different events and actions in your CaptainBook system. With workflows, you can automate repetitive tasks, send notifications, update data, and integrate with external systems, all without writing code.
What Can Workflows Do?
Automate responses to events like booking confirmations, cancellations, or customer creation
Send notifications via email, SMS, or webhooks
Update bookings, customers, and availability automatically
Process data with conditions, loops, and variables
Integrate with external systems through webhooks
Schedule tasks to run at specific times
Analyze sentiment in customer communications
Key Benefits
Save time by automating repetitive tasks
Reduce errors with consistent, automated processes
Improve customer experience with timely, personalized communications
Scale operations without scaling your team
Maintain consistency across all business processes
Getting Started
Creating Your First Workflow
Note: Workflows are available to our customers on the extended, ultra and corporate plans
Navigate to the Workflows section in your CaptainBook dashboard
Click New Workflow to create a blank workflow
Give your workflow a descriptive name (e.g., "Welcome New Customers")
Start building by adding a trigger (see Triggers section)
Workflow Status
Workflows can be in one of three states:
Draft: Workflow is being created or edited. Draft workflows do not run.
Active: Workflow is live and will execute when triggered.
Paused: Workflow is temporarily disabled but can be reactivated.
Note: Only Active workflows will execute. Make sure to activate your workflow when you're ready to use it.
Workflow Concepts
Understanding the Workflow Builder
The workflow builder uses a visual, node-based interface where you connect different components:
Trigger Node: The starting point that defines when the workflow runs
Action Nodes: Steps that perform specific tasks
Condition Nodes: Decision points that branch the workflow
Loop Nodes: Iterate over collections of data
Workflow Structure
A workflow consists of:
One Trigger: Defines when the workflow starts
Multiple Actions: Steps that execute in sequence
Optional Conditions: Add logic and branching
Optional Loops: Process multiple items
Execution Flow
Workflows execute from top to bottom, following the connections between nodes. When a condition is encountered, the workflow branches based on the condition result. Loops repeat their child steps for each item in a collection.
Triggers
Triggers define when your workflow starts. Each workflow must have exactly one trigger.
Available Triggers
Note: We will release more triggers. Need something you don't see ? Contact us! We'd love to hear your use case.
Booking Triggers
Booking Confirmed: Runs when a booking is confirmed
Booking Cancelled: Runs when a booking is cancelled
Booking Changed: Runs when booking details are modified
Booking Transaction Processed: Runs when a payment transaction is processed
Customer Triggers
Customer Created: Runs when a new customer is added to your system
Document Triggers
Documents Signed Complete: Runs when all required documents are signed
Time-Based Triggers
Scheduled Time: Runs at a specific time (daily, weekly, or custom schedule)
Integration Triggers
Webhook: Runs when an external system sends a request to your webhook URL
Trigger Configuration
Each trigger type has specific configuration options:
Scheduled triggers: Configure the time and frequency
Webhook triggers: Receive a unique URL that external systems can call
Trigger Data
When a workflow is triggered, the trigger provides initial data (context) that flows through the workflow. For example:
Booking triggers provide booking data
Customer triggers provide customer data
Webhook triggers provide the data sent in the webhook request
Actions
Actions are the steps that perform work in your workflow. Actions execute in sequence, and each action can use data from previous steps.
Note: We will release more actions. Need something you don't see ? Contact us!
We'd love to hear your use case.
Booking Actions
Get Booking
Retrieve a booking by ID or reference. Use this to fetch booking details.
Update Booking
Modify booking properties such as status, notes, or custom fields.
Find Bookings
Search for bookings matching specific criteria. Returns a collection of bookings.
Create Booking
Create a new booking programmatically.
Customer Actions
Get Customer
Retrieve a customer by ID or email. Use this to fetch customer details.
Update Customer
Modify customer information such as name, email, phone, or custom fields.
Find Customers
Search for customers matching specific criteria. Returns a collection of customers.
Availability Actions
Get Availability
Retrieve availability information for a specific product or time slot.
Create Availability
Create new availability slots. More information here.
Update Availability
Modify existing availability.
Find Availabilities
Search for availabilities matching specific criteria.
Update Pricing
Modify pricing for products or availability.
Communication Actions
Send Notification
Send an email or SMS notification. Supports variables for personalization.
Send Webhook
Send data to an external system via HTTP POST request.
Data Actions
Set Variable
Store a value in a variable for use in later steps. Supports calculations and functions.
Delay Actions
Delay
Pause the workflow for a specified amount of time (e.g., 5 minutes, 2 hours).
Delay Until
Pause the workflow until a specific date and time.
Note: Delays pause the workflow execution. The workflow will resume automatically when the delay period ends.
Analysis Actions
Analyze Sentiment
Analyze the sentiment of text (e.g., customer feedback, reviews). More information here.
Gift Certificate Actions
Create Gift Certificate
Generate a new gift certificate.
Conditions and Logic
Conditions allow you to add decision-making logic to your workflows, creating different paths based on data values.
Condition Types
Value Check (If/Else)
Compare a value against a condition (equals, contains, greater than, etc.). Creates two branches:
True branch: Executes if the condition is met
False branch: Executes if the condition is not met
Filter
Acts as a gate: if the condition passes, execution continues; if it fails, the workflow stops at that point.
Condition Operators
Common operators include:
Equals: Exact match
Contains: Text contains substring
Greater than / Less than: Numeric comparisons
Is empty / Is not empty: Check for presence of data
In list: Value exists in a list
Using Conditions
Add a condition node to your workflow
Select the condition type (Value Check or Filter)
Configure what to check (e.g.,
booking.statusequals "confirmed")Add actions to the True and/or False branches
The workflow will follow the appropriate branch based on the result
Example Use Cases
Send different notifications based on booking value
Only process bookings from specific sources
Handle errors differently based on error type
Skip steps for certain customer types
Loops
Loops allow you to repeat actions for each item in a collection (e.g., a list of bookings or customers).
How Loops Work
Collection Variable: Specify which variable contains the collection to loop over
Item Variable: Each iteration provides the current item in a variable (default:
current_item)Loop Body: Actions inside the loop execute once for each item
Loop Configuration
Collection Variable: The variable containing the array/collection (e.g.,
found_bookings)Item Variable Name: Name for the current item variable (default:
current_item)
Using Loops
First, use an action that returns a collection (e.g., "Find Bookings")
Add a Loop node after that action
Configure the loop to use the collection from the previous step
Add actions inside the loop that use
current_itemor your custom item variable nameActions inside the loop will execute for each item
Example Use Cases
Send confirmation emails to all customers in a group
Update multiple availability at once
Process a batch of transactions
Update prices for availabilities
Important Notes
Loops process items sequentially
Variables set inside a loop are scoped to that iteration
Delays within loops are not available.
Variables
Variables allow you to store and use data throughout your workflow. They're essential for passing information between steps and personalizing actions.
Variable Syntax
Variables use curly braces: {variable_name}
Types of Variables
Trigger Variables
Data provided by the trigger (e.g., {booking}, {customer}, {webhook_data})
Action Output Variables
Data returned by actions (e.g., {found_customers}, {created_booking})
Custom Variables
Variables you create using the "Set Variable" action
Nested Variables
Access properties using dot notation:
{booking.customer.name}{customer.email}{current_item.id}
Variable Features
Fallback Values
Use || to provide a default if a variable is empty:
{customer.phone||No phone number}Random Selection
Use | to randomly select from options:
{Hello|Hi|Greetings} {customer.name}Functions
Use functions to transform data:
{upper(customer.name)}- Convert to uppercase{sum(booking.price, booking.tax)}- Calculate sum{formatDate(booking.date, 'Y-m-d')}- Format dates{substring(text, 0, 50)}- Extract substring
Available Functions
Text Functions
upper(text)- Uppercaselower(text)- Lowercasesubstring(text, start, length)- Extract substringreplace(text, search, replace)- Replace texttrim(text)- Remove whitespace
Math Functions
sum(a, b, ...)- Add numberssubtract(a, b)- Subtractmultiply(a, b)- Multiplydivide(a, b)- Divideround(number, decimals)- Round number
Date Functions
formatDate(date, format)- Format dateaddDays(date, days)- Add daysnow()- Current date/timedateDiff(date1, date2)- Difference between dates
Using Variables
Variables can be used in:
Action configurations (e.g., notification content, webhook payloads)
Condition checks
Variable values (for calculations)
Example
Hello {customer.name}, Your booking for {product.name} on {formatDate(booking.date, 'F j, Y')} has been confirmed. Total: ${sum(booking.price, booking.tax)}. {customer.phone||Contact us if you have questions}Testing Workflows
Before activating a workflow, it's important to test it to ensure it works as expected.
Test Mode
Open your workflow in the builder
Click the Test button (available when a trigger is configured)
Configure test data that simulates the trigger
Run the test
Review the execution to see what happened
CAUTION: the workflow will be executed. If it's setup to send emails, it will send real emails.
What Testing Shows
Which steps executed
What data was used at each step
Any errors that occurred
The final output
Testing Tips
Test with realistic data
Test different scenarios (e.g., different booking statuses)
Check that variables resolve correctly
Verify conditions branch correctly
Ensure loops process all items
Managing Workflows
Workflow Settings
Name and Description
Name: A clear, descriptive name for your workflow
Description: Explain what the workflow does (helpful for team members). Automatically generated
Status Management
Draft: Save work in progress
Active: Enable the workflow
Paused: Temporarily disable without deleting
Credit Limits
Max Credits Per Run: Set a limit on how many credits a single workflow execution can consume
Helps prevent runaway workflows from consuming too many credits
Workflow will stop if the limit is reached
Failure Notifications
Notify on Fail: Receive notifications when a workflow execution fails
Helps you quickly identify and fix issues
Workflow Organization
Organize workflows by purpose (e.g., "Customer Onboarding", "Booking Management")
Use descriptive names that indicate what triggers them
Importing and Exporting
Export: Download a workflow as JSON for backup or sharing
Import: Import a previously exported workflow
Useful for:
Backing up workflows
Sharing workflows between accounts
Creating workflow templates
Deleting Workflows
Only delete workflows you no longer need
Deleted workflows cannot be recovered
Consider pausing instead of deleting if you might need it later
Workflow Executions
Every time a workflow runs, an execution record is created that tracks the entire process.
Viewing Executions
Navigate to your workflow
Click on Runs or Executions to see all executions
Click on an execution to see details
Execution Status
Pending: Waiting to start
Running: Currently executing
Completed: Finished successfully
Failed: Encountered an error
Execution Details
For each execution, you can see:
Trigger Data: What started the workflow
Step Logs: Each step that executed, including:
Input data
Output data
Execution time
Status (completed/failed)
Total Duration: How long the workflow took
Credits Used: How many credits were consumed
Understanding Step Logs
Step logs show:
Input: Data the step received
Output: Data the step produced
Status: Whether the step succeeded or failed
Timestamp: When the step executed
Use step logs to:
Debug issues
Understand data flow
Verify calculations
Track performance
Failed Executions
If a workflow fails:
Check the execution details to see which step failed
Review the error message
Fix the issue in the workflow
The workflow will continue to run for new triggers (unless paused)
Best Practices
Planning Your Workflow
Define the goal: What should the workflow accomplish?
Identify the trigger: What event should start it?
Map the steps: What actions need to happen?
Consider edge cases: What if data is missing or conditions aren't met?
Test thoroughly: Verify it works before activating
Naming Conventions
Use descriptive names: "Send Welcome Email to New Customers"
Include the trigger in the name: "Booking Confirmed - Send Confirmation"
Avoid generic names: "Workflow 1", "Test Workflow"
Error Handling
Use conditions to check for required data
Provide fallback values for variables
Set credit limits to prevent runaway executions
Enable failure notifications to catch issues quickly
Performance
Keep workflows focused and efficient
Avoid unnecessary delays
Use filters to skip processing when not needed
Monitor credit usage
Maintenance
Review workflows regularly
Update workflows when business processes change
Document complex workflows in the description
Archive or delete unused workflows
Security
Be careful with webhook triggers, validate incoming data
Don't expose sensitive data in webhook payloads
Use conditions to restrict when workflows run
Review execution logs for suspicious activity
Troubleshooting
Common Issues
Workflow Not Running
Possible causes:
Workflow is in Draft or Paused status (must be Active)
Trigger conditions not met
Plan doesn't include workflows feature (if you've been downgraded)
Solutions:
Check workflow status
Verify trigger configuration
Review trigger filters
Check your plan includes workflows
Variables Not Resolving
Possible causes:
Variable name is misspelled
Variable doesn't exist in context
Nested property path is incorrect
Solutions:
Check variable names match exactly (case-sensitive)
Review step logs to see available variables
Use fallback values:
{variable||default}Verify the previous step produced the expected output
Condition Not Working
Possible causes:
Condition operator doesn't match data type
Variable is empty or null
Comparison value format is incorrect
Solutions:
Check data types match (string vs number)
Use "Is empty" / "Is not empty" to check for data
Review step logs to see actual values
Test with different data
Loop Not Processing Items
Possible causes:
Collection variable is empty
Collection variable name is incorrect
Collection is not an array
Solutions:
Verify the previous step returned a collection
Check the collection variable name matches
Review step logs to see the collection structure
Ensure the action before the loop returns an array
Workflow Failing
Possible causes:
Invalid configuration in an action
Missing required data
External service unavailable (webhooks, etc.)
Credit limit exceeded
Solutions:
Check execution logs for error messages
Verify all required fields are configured
Test external integrations separately
Increase credit limit if needed
Enable failure notifications to catch issues
Getting Help
Execution Logs: Review detailed logs for each step
Test Mode: Use test mode to debug issues
Support: Contact support if you need assistance
Documentation: Refer to this guide and other documentation
Debugging Tips
Start simple: Build workflows step by step, testing as you go
Use test mode: Test before activating
Check step logs: Review input/output for each step
Verify variables: Use test mode to see available variables
Isolate issues: Temporarily remove steps to find the problem
Check data types: Ensure you're comparing/using the right data types
Conclusion
Workflows are an extremely powerful way to automate your business processes. Start with simple workflows and gradually build more complex automations as you become comfortable with the system.
Remember:
Test before activating
Monitor executions regularly
Keep workflows organized and documented
Don't hesitate to ask for help
Happy automating!
