Twilio Integration FREE

Streamline SMS verification testing with Twilio integration. Retrieve messages, extract OTPs, and validate SMS-based authentication flows directly within your Katalon test automation.

4

Purpose

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

  • Accelerate SMS Testing: Automate OTP retrieval and SMS validation without manual intervention
  • Flexible Message Filtering: Search messages by phone number, date range, direction, and custom criteria
  • Robust OTP Extraction: Intelligently extract verification codes from message content using position-based parsing
  • Comprehensive Coverage: Access up to 50 recent messages per query with support for pagination
  • Production-Ready: Built with proper error handling and supports both individual and batch message operations

Business Impact

  • Reduce Testing Costs by Up to 90%
  • Automate SMS verification and OTP retrieval to eliminate manual testing bottlenecks. Save 5-8 hours per week of manual effort, reduce test execution time by 90%, and enable overnight test runs without human intervention. Typical ROI of $15,000-$25,000 annually per QA team with payback in just 2-4 weeks.

Key Savings

  • ⏱️ 90% faster test execution
  • 💰 $15K-$25K annual cost reduction per team
  • 👥 5-8 hours saved per week per tester
  • 🔄 10x more test iterations possible
  • 📱 Eliminate physical test device requirements

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Main Features

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

Installing the Plugin

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)
    }

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Available Keywords Reference

📌 getMessageResponse

  • Description: Get all messages from Twilio account
  • Parameters: AccountSid, Password
  • Returns: Response Object

📌 getIncomingLastMessage

  • Description: Get body of last incoming message
  • Parameters: AccountSid, Password
  • Returns: String (message body) or null

📌 getIncomingLastOTP

  • Description: Extract OTP from last incoming message using position-based parsing
  • Parameters: AccountSid, Password, Position (Integer, 1-based index)
  • Returns: String (OTP) or null

📌 getIncomingLastMessageFromNumber

  • Description: Get last incoming message from specific phone number
  • Parameters: AccountSid, Password, fromNumber (format: +1234567890)
  • Returns: String (message body) or null

📌 getIncomingLastOTPFromNumber

  • Description: Get OTP from last incoming message from specific phone number
  • Parameters: AccountSid, Password, fromNumber, Position
  • Returns: String (OTP) or null

📌 getIncomingLastMessageToNumber

  • Description: Get last incoming message to specific phone number
  • Parameters: AccountSid, Password, toNumber (format: +1234567890)
  • Returns: String (message body) or null

📌 getIncomingLastOTPToNumber

  • Description: Get OTP from last incoming message to specific phone number
  • Parameters: AccountSid, Password, toNumber, Position
  • Returns: String (OTP) or null

📌 getFilteredMessages

  • Description: Get messages with multiple filter criteria
  • Parameters: AccountSid, Password, filters (Map: To, From, DateSent, PageSize)
  • Returns: Response Object

📌 getMessagesFromNumber

  • Description: Get all messages from specific sender
  • Parameters: AccountSid, Password, fromNumber, pageSize (default: 20)
  • Returns: Response Object

📌 getMessagesToNumber

  • Description: Get all messages to specific recipient
  • Parameters: AccountSid, Password, toNumber, pageSize (default: 20)
  • Returns: Response Object

📌 getMessagesByDate

  • Description: Get messages sent on specific date
  • Parameters: AccountSid, Password, dateSent (YYYY-MM-DD), pageSize
  • Returns: Response Object

📌 getMessagesByDateRange

  • Description: Get messages within date range
  • Parameters: AccountSid, Password, dateSentBefore, dateSentAfter, pageSize
  • Returns: Response Object

📌 getAllMessagesCount

  • Description: Count total messages with optional filters
  • Parameters: AccountSid, Password, filters (Map, optional)
  • Returns: Integer (count)

📌 getMessageByIndex

  • Description: Get message at specific index from filtered messages
  • Parameters: AccountSid, Password, index (0-based), filters (optional)
  • Returns: String (message body) or null

📌 searchMessageByKeyword

  • Description: Search messages containing specific keyword
  • Parameters: AccountSid, Password, keyword, filters (optional)
  • Returns: List of Maps (index, body, sid)

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

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.

Compatible with:

  • Katalon Studio 10.0.0+
  • Plugin Type: Custom Keywords Plugin
  • Category: Integration

Visit Katalon Forum for Plugin related discussions.

API keys are required in Katalon Studio Commandline Execution. Generate Key
Information
Project details
Version
1.0.0
Type
Custom Keywords Plugin
Last updated
November 24, 2025 3:29 pm
Publisher
Privacy and License Agreement