The Twilio Integration Keywords plugin provides powerful custom keywords to seamlessly integrate Twilio's messaging API into your Katalon Studio test automation.
This plugin eliminates the manual effort of validating SMS-based workflows, enabling you to retrieve messages, extract one-time passwords (OTPs), and verify SMS content programmatically during test execution. Whether you're testing two-factor authentication (2FA), phone number verification, or any SMS-triggered workflows, this plugin streamlines your testing process by providing direct access to Twilio messages with flexible filtering and search capabilities.
Key Benefits
Business Impact
Key Savings
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Message Retrieval Keywords:
* Get all messages from your Twilio account
* Retrieve the last incoming message
* Filter messages by sender/recipient phone numbers
* Query messages by specific dates or date ranges
* Get message counts with optional filters
OTP Extraction Keywords:
* Extract OTP from last incoming message using position-based parsing
* Get OTP from messages sent by specific phone numbers
* Handle various OTP message formats
Advanced Search & Filtering:
* Search messages containing specific keywords
* Filter by multiple criteria (To, From, DateSent, PageSize)
* Retrieve messages from or to specific phone numbers
* Get messages within custom date ranges
Requirements:
1. Katalon Studio version 6.1.0 or later
2. Active Twilio account with Account SID and Auth Token
Installation Steps:
1. Visit the Katalon Store online or click Plugin Store → Visit Plugin Store from Katalon Studio
2. Search for "Twilio Integration Keywords"
3. Click Install to add the plugin to your Katalon Studio
4. After installation, click Plugin Store → Reload Plugins to activate
Usage Examples
**Example 1: Extract OTP from Last Incoming Message**
groovy// Get OTP from the last incoming SMS (position 17 in message)
def accountSid = 'ACxxxxxxxxxxxxxxxxxxxxx'
def authToken = 'your_auth_token_here'
def otp = CustomKeywords.'twilio.TwilioKeywords.getIncomingLastOTP'(accountSid, authToken, 17)
if (otp != null) {
WebUI.setText(findTestObject('Page_Login/input_OTP'), otp)
println("OTP successfully extracted: " + otp)
} else {
println("No OTP found in recent messages")
}
**Example 2: Get Last Message from Specific Phone Number**
groovydef accountSid = 'ACxxxxxxxxxxxxxxxxxxxxx'
def authToken = 'your_auth_token_here'
def fromNumber = '+1234567890'
def lastMessage = CustomKeywords.'twilio.TwilioKeywords.getIncomingLastMessageFromNumber'(accountSid, authToken, fromNumber)
if (lastMessage != null) {
WebUI.verifyMatch(lastMessage, '.*verification code.*', true)
println("Verification message received: " + lastMessage)
}
**Example 3: Search Messages by Keyword**
groovydef accountSid = 'ACxxxxxxxxxxxxxxxxxxxxx'
def authToken = 'your_auth_token_here'
def matches = CustomKeywords.'twilio.TwilioKeywords.searchMessageByKeyword'(accountSid, authToken, 'verification')
for (msg in matches) {
println("Found at index ${msg.index}: ${msg.body}")
println("Message SID: ${msg.sid}")
}
**Example 4: Filter Messages by Date Range**
groovydef accountSid = 'ACxxxxxxxxxxxxxxxxxxxxx'
def authToken = 'your_auth_token_here'
def response = CustomKeywords.'twilio.TwilioKeywords.getMessagesByDateRange'(
accountSid,
authToken,
'2025-11-24', // dateSentBefore
'2025-11-01', // dateSentAfter
50 // pageSize
)
def count = CustomKeywords.'twilio.TwilioKeywords.getAllMessagesCount'(accountSid, authToken)
println("Total messages in date range: " + count)
**Example 5: Get OTP from Specific Sender**
groovydef accountSid = 'ACxxxxxxxxxxxxxxxxxxxxx'
def authToken = 'your_auth_token_here'
def fromNumber = '+1234567890'
// Extract OTP at position 15 from messages sent by specific number
def otp = CustomKeywords.'twilio.TwilioKeywords.getIncomingLastOTPFromNumber'(
accountSid,
authToken,
fromNumber,
15
)
if (otp != null) {
// Use the OTP in your test
WebUI.setText(findTestObject('input_VerificationCode'), otp)
}
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📌 getMessageResponse
📌 getIncomingLastMessage
📌 getIncomingLastOTP
📌 getIncomingLastMessageFromNumber
📌 getIncomingLastOTPFromNumber
📌 getIncomingLastMessageToNumber
📌 getIncomingLastOTPToNumber
📌 getFilteredMessages
📌 getMessagesFromNumber
📌 getMessagesToNumber
📌 getMessagesByDate
📌 getMessagesByDateRange
📌 getAllMessagesCount
📌 getMessageByIndex
📌 searchMessageByKeyword
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Configuration Notes
**Getting Your Twilio Credentials:**
1. Log into your Twilio Console at https://console.twilio.com
2. Find your Account SID and Auth Token on the dashboard
3. Use these credentials in your test scripts
**OTP Position Parameter:**
The position parameter in OTP extraction keywords refers to the word position when the message is split by spaces. For example:
Message: "Your verification code is 123456"
Position 5 would return: "123456"
Command Line Execution API keys are required for Katalon Studio command line execution. Generate your API key from your Katalon account settings.
Need Help? Visit the Katalon Forum for plugin-related discussions, questions, and support from the community.
Visit Katalon Forum for Plugin related discussions.