Powered by RealGreatDevs
This package provides a convenient way to access the Instantly.ai API.
To install the package, you can use the following command in your terminal:
npm install instantly-api
Make sure the INSTANTLY_API_KEY
env variable is defined in your environment to authenticate requests.
import instantly from 'instantly-api';
Ping the instantly API to verify connectivity and authentication.
const result = await instantly.ping();
Retrieve a list of all campaigns. NOTE: Currently this is bugged in instantly itself so always returns an empty array. Once they fix it this will work.
const result = await instantly.campaigns.list();
Get the name of a specific campaign by its ID.
const campaignId = '00000000-0000-0000-0000-000000000000';
const result = await instantly.campaigns.getName(campaignId);
Fetch the status of a specific campaign.
const campaignId = '00000000-0000-0000-0000-000000000000';
const result = await instantly.campaigns.getStatus(campaignId);
Retrieve accounts associated with a specific campaign.
const campaignId = '00000000-0000-0000-0000-000000000000';
const result = await instantly.campaigns.getAccounts(campaignId);
Provide a summary of a specific campaign, including lead statuses.
const campaignId = '00000000-0000-0000-0000-000000000000';
const result = await instantly.campaigns.getSummary(campaignId);
Add leads to a specific campaign, with an option to skip if already in the workspace.
const campaignId = '00000000-0000-0000-0000-000000000000';
const leads = [[
{
"email": "john@abc.com",
"first_name": "John",
"last_name": "Doe",
"company_name": "Instantly",
"personalization": "Loved your latest post",
"phone": "123456789",
"website": "instantly.ai",
"custom_variables": {
"favorite_restaurant": "Mi Cancun",
"language": "English"
}
}
];
const options = {
skipIfInWorkspace: true
};
const result = await instantly.leads.addToCampaign(campaignId, leads, options);
Defines the structure for a lead object.
import type { InstantlyLead } from 'instantly-api';