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

Lead Follow-up Command

Creates a command object to generate and manage follow-up actions for sales leads, helping sales teams maintain engagement and move leads through the sales pipeline.

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.", "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 (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.

Generated Command Structure

The system generates a command object with the following structure to control the lead follow-up process:

{ "targets": [ { "follow_ups": [ { "type": "email", "subject": "Following up on our conversation about content automation", "content": "Hello Jane,\n\nI hope this email finds you well. I wanted to follow up on our conversation last week about the content automation solutions we discussed. I remember you mentioned that your team is spending too much time on content creation, and I think our platform could help significantly reduce that time.\n\nWould you be available for a quick 15-minute demo this week to see how our solution specifically addresses your content creation challenges? I'd be happy to focus specifically on the time-saving aspects you were most interested in.\n\nBest regards,\nSales Representative", "scheduled_for": "2024-04-23T10:00:00Z", "next_steps": [ "If no response in 3 days, follow up with a phone call", "If responded positively, schedule demo", "If responded with concerns, address specific issues" ] }, { "type": "call", "script": "Hello Jane, this is [Sales Rep] from [Company]. I'm calling to follow up on the email I sent about our content automation solutions. I understand your team is looking for ways to streamline content creation and better measure ROI. Do you have a few minutes to discuss how our platform might help with these challenges?", "scheduled_for": "2024-04-26T14:00:00Z", "next_steps": [ "If call successful, send calendar invite for demo", "If voicemail, leave message and follow up with another email", "If requested more information, send case studies relevant to marketing directors" ] }, { "type": "email", "subject": "Resources for measuring content marketing ROI", "content": "Hello Jane,\n\nBased on our conversations, I understand that measuring ROI is one of your key challenges. I've attached a case study that shows how companies similar to Acme Inc. have used our analytics dashboard to measure and improve their content marketing ROI.\n\nAdditionally, I've included a guide on how our platform can help with:\n\n1. Setting up custom KPIs specific to your marketing goals\n2. Tracking conversion paths from content to customer\n3. Generating automated reports for stakeholders\n\nWould you like to schedule a specific demo focused on our analytics capabilities?\n\nBest regards,\nSales Representative", "scheduled_for": "2024-04-29T10:00:00Z", "next_steps": [ "If interested in analytics, schedule specialized demo with product expert", "If no response in 4 days, try reaching out on LinkedIn", "If responded but not ready, add to nurture campaign" ] } ] } ], "context": "Lead came from website demo request form, showing interest in content automation and analytics tools", "supervisors": [ { "agent_role": "sales_manager", "status": "not_initialized" }, { "agent_role": "customer_success", "status": "not_initialized" } ], "task": "create lead follow-up sequence", "description": "Generate a personalized follow-up sequence for a qualified lead interested in content automation and analytics, focusing on addressing their pain points of time-consuming content creation and measuring ROI, with appropriate timing between touchpoints." }

Response

Success Response

{ "success": true, "data": { "command_id": "cmd_123456", "siteId": "site_456", "leadId": "lead_789", "follow_ups": [ { "id": "followup_abc123", "type": "email", "subject": "Following up on our conversation about content automation", "content": "Hello Jane,\n\nI hope this email finds you well...", "scheduled_for": "2024-04-23T10:00:00Z", "status": "scheduled", "site_id": "site_456", "lead_id": "lead_789", "user_id": "user_123", "metadata": { "next_steps": ["If no response in 3 days, follow up with a phone call"], "lead_stage": "qualified", "sequence_position": 1, "template_used": "qualified_lead_initial_followup" } } ], "saved_to_database": true } }

Error Response

{ "success": false, "error": { "code": "INVALID_REQUEST", "message": "Invalid request parameters" } }

Error Codes

CodeDescription
INVALID_REQUESTThe request parameters are invalid
SITE_NOT_FOUNDThe specified site does not exist
LEAD_NOT_FOUNDThe specified lead does not exist
USER_NOT_FOUNDThe specified user does not exist
INVALID_FOLLOW_UP_TYPEThe specified follow-up type is not supported
SYSTEM_ERRORInternal system error occurred

Notes

  • The command executes asynchronously
  • The system automatically integrates with your CRM if connected
  • The generated command controls the follow-up process with:
    • targets: An array of objects defining expected follow-up actions with type, content, scheduling, and next steps
    • context: Provides information about the lead’s origin and interests
    • supervisors: Defines which agent roles can provide additional input
    • task: Specifies the high-level objective for the agent
    • description: Contains the detailed prompt instructions for the agent
  • All generated follow-up items are automatically saved to the database and can be scheduled for execution
  • Follow-up types can include: email, call, meeting, LinkedIn message, video message, etc.
  • The system can automatically update your CRM with follow-up history and lead status changes
  • The follow-up sequence adapts based on lead responses and engagement
Last updated on