Twilio SMS Agent with RecallSync

This document provides a guide to setting up and testing a Twilio SMS Agent within the RecallSync platform. This agent utilizes Twilio for SMS communication and the RecallSync agent builder to handle conversations, especially for creating new leads from unknown senders.

Written By ReCallSyncAI

Last updated 5 months ago

Step by step guide to setting up and testing a Twilio SMS Agent within the RecallSync platform. This agent utilizes Twilio for SMS communication and the RecallSync agent builder to handle conversations, optionally using smart trigger for new contact creation + agent replies. Just enable smart trigger and every new sender will be added as a lead and the Twilio conversation agent will be assigned.

Prerequisites

  • A RecallSync Account with access to the Dashboard and Agents tab.

  • A Twilio Account with an active phone number.

  • Your RecallSync API Key (available in the "API Keys" tab in the left sidebar).

  • The RecallSync webhook URL structure for messaging: https://app.recallsync.com/api/agent/message?api_key=<recallsync-api-key>

1. Configure the Twilio SMS Agent in RecallSync

Follow these steps to ensure the agent is correctly set up on the RecallSync platform.

  1. Navigate to Agents: From the RecallSync Dashboard, click on the Agents tab in the left sidebar (0:07).

  2. Edit the Agent: Locate or create your Twilio SMS Agent (e.g., "Twilio SMS") and click to edit its configuration (0:12).

  3. Verify Agent Details: Ensure the following fields are set correctly:

    • Agent Type: Integrated (0:16)

    • Channel: SMS (0:19)

    • Provider: TWILIO (0:22)

    • Twilio Phone Number: The active Twilio number the agent will use (0:24)

  4. Enable Smart Trigger: Turn on the Smart Trigger option (0:29).

    • Function: When a message is received from an unknown contact (a number not currently a lead), Smart Trigger will automatically create a new lead and send a response using the agent's logic.

  5. Save Changes: Click Save changes to update the agent (0:30).

  6. Agent Logic: The agent's conversation flow is defined in the agent builder (0:46). The video demonstrates using a simple two-milestone-based flow for testing.

2. Configure the Webhook in Twilio

The Twilio phone number must be configured to forward incoming SMS messages to the RecallSync platform via a webhook.

  1. Navigate to Twilio: Go to your Twilio console and navigate to Phone Numbers > Manage > Active Numbers (1:04).

  2. Select Agent Number: Click on the Twilio phone number that corresponds to the one configured in the RecallSync agent (0:56, 1:13).

  3. Access Messaging Configuration: Scroll down to the Messaging Configuration section (1:15).

  4. Set Webhook URL: Under the "A message comes in" field (Webhook), set the RecallSync URL:

    • Webhook URL: https://app.recallsync.com/api/agent/message?api_key=<recallsync-api-key> (1:20-1:22)

    • Method: HTTP POST (1:22)

    • Important: Remember to replace <recallsync-api-key> with your actual API key from the RecallSync "API Keys" tab.

  5. Save Twilio Configuration: Ensure you save any changes in the Twilio console.

3. Test the SMS Agent Functionality

Test the agent by sending a message from a number that is not currently a lead in RecallSync.

  1. Send a Test Message: Use the Twilio Dev Phone or a separate mobile device to send an SMS to the configured Twilio Agent number (1:41).

    • Example Message: "Hi can i use recallsync to run sms campaigns with a defined follow up sequence?" (1:48)

  2. Observe Lead Creation:

    • Since the number is unknown, the Smart Trigger is activated.

    • A new lead will be automatically created in the Leads tab of RecallSync (2:01-2:12), typically with a status like "Unknown" or "Cold" (2:06).

  3. Check Conversation Flow:

    • Navigate to the Conversations tab in RecallSync (2:13).

    • Find the new conversation with the "Unknown" sender. You will see the incoming message (2:17).

    • After a short buffer period (e.g., 15 seconds), the agent's initial reply will be sent out, and it will appear in the conversation thread and be received by the sender (2:31-2:35).

  4. Continue the Conversation: Send another message from the user's side (e.g., "yes sure") (2:42). The agent will respond, continuing the conversation as defined by your agent logic (2:48, 2:56).

All conversation history and the agent's responses will be tracked under the Conversations tab in RecallSync (3:17). This confirms the Twilio SMS agent is correctly integrated and functioning for inbound messages from new leads.