// Headers
const headers = {
  authorization: "YOUR-API-KEY-HERE",
};

// Data
const data = {
  base_prompt:
    "You are calling {{business}} to renew their subscription to {{service}} before it expires on {{date}}.",
  call_data: [
    {
      phone_number: "1234567890",
      business: "ABC co.",
      service: "Netflix",
      date: "September 4th",
    },
    {
      phone_number: "32176540987",
      business: "XYZ inc.",
      service: "Window Cleaning",
      date: "December 20th",
    },
  ],
  label: "Renewal Reminder - Wednesday Afternoon with female voice",
  voice_id: 0,
  max_duration: 10,
  reduce_latency: true,
  wait_for_greeting: true,
};

// API request
await axios.post("https://api.luly.ai/v1/batches", data, { headers });

// Headers
const headers = {
  authorization: "YOUR-API-KEY-HERE",
};

// Data
const data = {
  base_prompt:
    "You are calling {{business}} to renew their subscription to {{service}} before it expires on {{date}}.",
  call_data: [
    {
      phone_number: "1234567890",
      business: "ABC co.",
      service: "Netflix",
      date: "September 4th",
    },
    {
      phone_number: "32176540987",
      business: "XYZ inc.",
      service: "Window Cleaning",
      date: "December 20th",
    },
  ],
  label: "Renewal Reminder - Wednesday Afternoon with female voice",
  voice_id: 0,
  max_duration: 10,
  reduce_latency: true,
  wait_for_greeting: true,
};

// API request
await axios.post("https://api.luly.ai/v1/batches", data, { headers });

Step 1: Setup Your Authorization

To initiate a batch call, you must first authenticate your request. Ensure you have your API key from signing up on the developer portal.

Step 2: Prepare the Call Data

Craft a base prompt that will be common across all calls in the batch. Use placeholders {{curly_braces}} for dynamic content.

Example:

"You are calling {{business}} to renew their subscription to {{service}} before it expires on {{date}}.";

Step 3: Define the Call Data

Specify the list of calls in the call_data array. Each call must have a phone_numberand can include other properties corresponding to placeholders in your base prompt.

Example

[
  {
    phone_number: "1234567890",
    business: "ABC co.",
    service: "Netflix",
    date: "September 4th",
  },
  {
    phone_number: "32176540987",
    business: "XYZ inc.",
    service: "Window Cleaning",
    date: "December 20th",
  },
];

Step 4: Additional Configuration

  • label : Assign a label to your batch for easy tracking.
  • campaign_id : Organize related batches under a campaign.
  • test_mode : Set to true for testing with the first call only.
  • batch_id : Manually set or auto-generated for tracking.
  • voice_id : Select a voice for the batch.
  • reduce_latency : Reduce latency for faster processing.
  • Language : Select a language for the batch.
  • request_data : Assign a label to your batch for easy tracking.
  • Voice and Language Settings: Select voice_id,reduce_latency, and Language

Step 5: Send the API Request

Use the provided JavaScript or Python code snippet to make the API request.

Step 6: Handle the Response

After sending the batch request, you’ll receive a response with a message and the batch_id. Monitor the progress of your calls and any responses via your specified webhook.

Here’s what an example response might look like:

{
  "message": "success",
  "batch_id": "3p$7rQ3p9sT5bzmF-gen-batch"
}

Step 7: Monitoring and Analytics

Track the performance and outcomes of your batch calls through the provided batch_id and campaign analytics. Adjust future batches based on the insights gained.