Skip to Content
Uncodie Market Fit está disponible 🎉
Rest APIAgentsSalesLead Follow-up Command

Lead Follow-up Command

Creates a personalized follow-up sequence for sales leads using a two-phase process: first a Sales/CRM Specialist creates the content strategy, then a Content Creator & Copywriter refines the messaging for maximum impact.

Endpoint

POST /api/agents/sales/leadFollowUp

Request Body

ParameterTypeRequiredDescription
siteId or site_idstring (UUID)YesUUID of the website where the lead originated
leadId or lead_idstring (UUID)YesUUID of the lead to follow up with
userId or user_idstring (UUID)NoUUID of the sales representative responsible for the lead. If not provided, the system will search for an active sales agent for the site
agent_id or agentIdstring (UUID)NoUUID of the agent to handle the follow-up sequence. If not provided, the system will search for an active sales agent for the site
visitorId or visitor_idstring (UUID)NoUUID of the visitor associated with the lead
followUpTypestringNoType of follow-up (e.g., “email”, “call”, “meeting”)
leadStagestringNoCurrent stage of the lead in the sales pipeline
previousInteractionsarrayNoArray of previous interactions with the lead. Each interaction should have date, type, and summary or content fields
leadDataobjectNoAdditional data about the lead (e.g., name, company, position, email, phone, pain_points, budget_range). If not provided, the system will fetch it from the database
productInterestarrayNoArray of products or services the lead has shown interest in
followUpIntervalstringNoDesired interval for follow-ups (e.g., “3 days”, “1 week”)
phone_numberstringNoPhone number for WhatsApp communication. Must be a valid phone number with at least 7 digits if provided

Example Request

{ "siteId": "site_456", "leadId": "lead_789", "userId": "user_123", "agent_id": "agent_sales_123", "followUpType": "email", "leadStage": "qualified", "previousInteractions": [ { "date": "2024-04-15", "type": "email", "summary": "Initial contact with product information" }, { "date": "2024-04-20", "type": "call", "summary": "Discussed specific product features and pricing" } ], "leadData": { "name": "Jane Smith", "company": "Acme Inc.", "email": "jane@acme.com", "phone": "+1234567890", "position": "Marketing Director", "pain_points": ["time-consuming content creation", "measuring ROI"], "budget_range": "$5000-$10000" }, "productInterest": ["content automation", "analytics dashboard"], "followUpInterval": "3 days" }

Try It

Lead Follow-up API Tester

Use this tester to generate lead follow-up sequences with different parameters and see the results.

You can test this API directly using our API Tester interface. The Sales API tester allows you to generate lead follow-up sequences with different parameters and see the results.

Required fields:

  • Site ID: The UUID of the website where the lead originated
  • Lead ID: The UUID of the lead to follow up with

Optional fields:

  • User ID: The UUID of the sales representative responsible for the lead. If not provided, the system will search for an active sales agent for the site
  • Agent ID: The UUID of the agent to handle the follow-up sequence. If not provided, the system will search for an active sales agent for the site
  • Visitor ID: The UUID of the visitor associated with the lead
  • Follow-up Type: Type of follow-up desired (email, call, meeting)
  • Lead Stage: Current stage of the lead in the sales pipeline
  • Previous Interactions: Array of previous interactions with the lead (JSON format)
  • Lead Data: Additional data about the lead including contact information (JSON format). If not provided, the system will fetch it from the database
  • Product Interest: Array of products or services the lead has shown interest in (JSON format)
  • Follow-up Interval: Desired interval for follow-ups (e.g., “3 days”, “1 week”)
  • Phone Number: Phone number for WhatsApp communication. Must be valid with at least 7 digits if provided

Note: The API accepts both camelCase (siteId, leadId, userId, agentId, visitorId) and snake_case (site_id, lead_id, user_id, agent_id, visitor_id) parameter names for compatibility.

The API Tester makes it easy to see example requests in various programming languages and test the endpoint directly.

How It Works

The system uses a two-phase process to create high-quality follow-up content:

Phase 1: Sales Strategy

  • Sales/CRM Specialist Agent analyzes the lead information
  • Creates initial follow-up content with sales strategy
  • Focuses on lead qualification and conversion objectives

Phase 2: Content Refinement (Optional)

  • Content Creator & Copywriter Agent refines the messaging
  • Improves copy, tone, and persuasion techniques
  • Enhances engagement while maintaining sales objectives

Available Channels

The system automatically generates content for available channels based on lead data:

  • Email: Generated if lead has email address
  • WhatsApp: Generated if lead has phone number
  • Notification: In-app notifications (always available)
  • Web: Website popups/banners (always available)

Response Structure

Success Response

{ "success": true, "data": { "messages": { "email": { "title": "Following up on your content automation interest", "message": "Hi Jane,\n\nI hope this email finds you well. I wanted to follow up on your interest in content automation solutions...", "strategy": "comprehensive sale strategy" }, "whatsapp": { "title": "Quick follow-up about Acme Inc's automation needs", "message": "Hi Jane! Following up on our conversation about content automation. Are you available for a quick chat this week?", "strategy": "comprehensive sale strategy" }, "notification": { "title": "New content automation insights for Acme Inc", "message": "We've prepared a personalized demo showing how our platform can save your team 15+ hours per week on content creation.", "strategy": "comprehensive sale strategy" }, "web": { "title": "Exclusive Demo for Marketing Directors", "message": "See how companies like Acme Inc are automating their content workflows and measuring ROI more effectively.", "strategy": "comprehensive sale strategy" } }, "lead": { "name": "Jane Smith", "company": "Acme Inc.", "email": "jane@acme.com", "phone": "+1234567890", "position": "Marketing Director", "pain_points": ["time-consuming content creation", "measuring ROI"], "budget_range": "$5000-$10000", "sites": { "name": "Acme Website", "url": "https://acme.com" } }, "command_ids": { "sales": "cmd_sales_123456", "copywriter": "cmd_copywriter_789012" } } }

Error Response

{ "success": false, "error": { "code": "INVALID_REQUEST", "message": "siteId is required" } }

Response Fields

Messages Object

Each channel contains:

  • title: Subject line or headline for the message
  • message: The main content body
  • strategy: The sales strategy applied

Lead Object

Contains all available lead information:

  • Basic info: name, company, email, phone, position
  • Sales data: pain_points, budget_range, lead_stage
  • Site information: sites object with website details
  • Interaction history and preferences

Command IDs Object

  • sales: ID of the Sales/CRM Specialist command
  • copywriter: ID of the Copywriter command (null if not executed)

Error Codes

CodeDescription
INVALID_REQUESTRequired parameters missing (siteId or leadId) or invalid request format
INVALID_INPUTInvalid UUID format for siteId or leadId
INVALID_PHONE_NUMBERPhone number is invalid (must have at least 7 digits, empty strings not allowed)
AGENT_NOT_FOUNDSpecified agent was not found
NO_CHANNELS_CONFIGUREDSite has no communication channels configured (email or WhatsApp)
NO_VALID_CHANNELS_FOR_LEADNo valid configured channel matches this lead contact info
SALES_COMMAND_FAILEDSales command did not complete successfully
NO_CONTENT_GENERATEDThe AI command did not generate any follow-up content
NO_VALID_CHANNELSNo valid communication channels available for this message
SYSTEM_ERRORInternal system error occurred

Notes

  • The system automatically finds active Sales/CRM Specialist and Content Creator & Copywriter agents for the site
  • If no copywriter is found, only the sales phase executes
  • Content is personalized based on lead data and previous interactions
  • Messages are ready-to-send without placeholders or variables
  • All content is generated with the actual lead information, not templates
Last updated on