Extract Variable

How to Use the “Extract Variable” Function in Botassium
When your users send free-form text but you need to pull structured information from their message—like an email, phone number, or custom value—the “Extract Variable” function in Botassium makes it easy. It scans the incoming message for a specific data type and stores the matched result as a variable for use later in the automation.
This guide walks you through how to configure the extraction logic and handle both success and failure outcomes.
What is the “Extract Variable” Function?
The Extract Variable node is a function that searches a user’s message for a specific type of data, extracts it, and saves it to a variable you define.
It can be used to detect and extract:
Contact info
Dates or times
Numbers or currencies
Web links or addresses
Any custom pattern using regex
This is especially useful when users reply with mixed or natural language, and you need to isolate a value automatically.
How to Set It Up
Add the “Extract Variable” Node
Place this node directly after a message input or user reply step.Set the Variable Name
Define what you want to name the extracted value.
Example:user_email
,pickup_date
,website_link
,custom_id
Select the Variable Type
Choose from the following pre-defined types:Email address
Phone number
Geographical address
Boolean (e.g., yes/no, true/false)
Date
Time
Currency
Number
IP address
URL / Website link
Custom Regex
If selected, you’ll get a text field to enter your own regular expression (regex) pattern to match any custom format.
Handle Output Paths
On Success: When a value is successfully extracted and stored, the flow continues through this path.
On Failure: If no match is found, the flow continues through the failure path—where you can ask the user to try again or offer help.
Example Use Case
You're collecting emails in a flow where users are expected to type them freely:
User types: “My email is john.doe@gmail.com”
The Extract Variable node is set to:
Type: Email address
Variable name:
user_email
On Success: Send a message like “Thanks! We saved @user_email as your contact email.”
On Failure: Ask again with “Could you please provide a valid email address?”
The Extract Variable function works in all WhatsApp automation flows, and is ideal for data capture, form-free input processing, pre-validation, fallback logic, and advanced automation routing—especially when user replies are unstructured but contain extractable values.