Prerequisites
Before you begin, make sure you have:
Execution
Step 1: Get Existing Contact Lists
First, retrieve a list of your existing contact lists:
const options = {method: 'GET', headers: {'X-API-KEY': 'your-api-key-here'}};
fetch('https://prod-api.ringg.ai/ca/api/v0/workspace/lists', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
Step 2: Prepare a New Contact List
Create a CSV file with the following structure:
name,mobile_number,custom_variable_1,custom_variable_2
John Doe,+1234567890,value1,value2
Jane Smith,+0987654321,value3,value4
Make sure to include all custom variables required by your assistant.
Step 3: Upload the Contact List
Upload your contact list to Ringg AI:
const formData = new FormData();
formData.append('variables_map', JSON.stringify({
"name": "name",
"mobile_number": "mobile_number",
"custom_variable_1": "custom_variable_1",
"custom_variable_2": "custom_variable_2"
}));
formData.append('agent_id', 'your-assistant-id');
formData.append('call_config', JSON.stringify({
"max_concurrent_calls": 5,
"retry_count": 1
}));
formData.append('country_code', '+1');
formData.append('file', yourCsvFile);
const options = {
method: 'POST',
headers: {'X-API-KEY': 'your-api-key-here'},
body: formData
};
fetch('https://prod-api.ringg.ai/ca/api/v0/calling/contact/list', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
Step 4: Delete a Contact List
If you need to delete a contact list:
const options = {method: 'DELETE', headers: {'X-API-KEY': 'your-api-key-here'}};
fetch('https://prod-api.ringg.ai/ca/api/v0/calling/contact/your-list-id', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
Step 5: Use Contact Lists for Bulk Calls
Once your contact list is uploaded, you can use it for bulk calling campaigns:
const options = {
method: 'POST',
headers: {
'X-API-KEY': 'your-api-key-here',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"agent_id": "your-assistant-id",
"list_id": "your-list-id",
"from_numbers": [
"phone-number-id-1",
"phone-number-id-2"
]
})
};
fetch('https://prod-api.ringg.ai/ca/api/v0/calling/outbound/bulk', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));