This is version 2 of the campaigns API, and the one to build on. Integrations built on version 1 keep working.
Endpoints
Every path is underhttps://api.verbeo.ai/v2.
The workspace comes from your API key, so no endpoint asks you for a workspace id.
The two lists are
POSTs because a list query is a document: page, size and filters arrive typed as themselves rather than coerced from a query string. They read, and change nothing.How it works
1
Write the contacts file
One JSON object a line, each with the number to call in +E.164. See The contacts file.
contacts.ndjson
2
Reserve an upload
Send the file’s name and its size in bytes, which The answer’s
wc -c < contacts.ndjson prints (Reserve an upload):import.id names the upload, and upload.signed_url is where the file goes. The link works for 2 hours.3
Upload the file
One The link goes to Verbeo’s file storage, not to
PUT of the whole file to upload.signed_url, exactly as the answer gave it:api.verbeo.ai, and takes no API key. Use --data-binary: curl’s -d strips the newlines between the contacts.4
Create the campaign
Name the upload, the assistant and the number to call from (Create campaign):The campaign is a
draft, and its import is queued.5
Wait for the import
Read the campaign every few seconds (Get campaign) until
import.status is done:import.lines_read of import.total_lines is how far it has got, and import.skipped lists the lines it passed over, with why. If the import is failed, import.error_message says why, and Retry import runs it again from where it stopped.6
Start it
scheduled_at needs no start: it becomes scheduled when its import is done, and starts at that time. Follow the calls with List contacts and Contact counts.The contacts file
NDJSON: one JSON object a line, in UTF-8, each line ending in\n or \r\n. Upload it with Content-Type: application/x-ndjson.
contacts.ndjson
Any other key on a line is ignored. The numbers must already be in +E.164: the import does not read a number without a country code.
How the lines are read:
- A blank line (empty, or only whitespace) is passed over. It is neither a contact nor a skipped line.
- A line that breaks a rule is skipped with its reason, and the import goes on.
rows_skippedcounts every skipped line;skippedkeeps the first 100 with their line numbers (line 1 is the file’s first). - A number on two lines is called twice. Duplicates are kept.
Limits
The campaign object
Every route that returns a campaign returns this. List campaigns returns it with a shorterimport.
The assistant that places the calls.
null only on a finished campaign whose assistant has since been deleted.The number the calls come from: the caller ID.
null only on a finished campaign whose number has since been deleted.See Campaign statuses.
Minutes to wait before each retry, the first retry first. A retry with no interval of its own waits 5 minutes.
When calls may be placed, as Create campaign takes it.
null: any time.Its contacts file and how far its import has got: the import object.
null for a campaign made without one, before version 2 or through version 1.The import object
See Import statuses.
The lines saved so far: contacts, skipped and blank lines alike. A retry resumes after them.
Runs started. More than 1 when a run was cut off and resumed; the import fails after 5 runs that did not finish.
import carries id, status, expected_count, total_lines, lines_read, contacts_added, rows_skipped and error_message.
Import statuses
Why an import fails, in
error_message:
Campaign statuses
Who may do what
An API key acts as its workspace’s owner, so it may call every route. The same routes serve the dashboard, where each member’s role decides:
A member without the role gets
403 FORBIDDEN, naming the roles that would have worked.
Campaigns are a Pro feature. The workspace’s latest subscription must be on a plan with campaigns, and active, trialing or past due. Without it, reserving, creating, starting, resuming and giving a draft a time to start are refused with 402 PAYMENT_REQUIRED: Campaigns are a Pro feature. Upgrade this workspace to the Pro plan to create or start a campaign. Pausing and cancelling are never refused for it.
Good to know
- The upload link expires 2 hours after the reserve (
upload.expires_at). After that, creating with it is refused (409) and the upload is removed: reserve again and upload again. - A campaign cannot start until its import is done. It is a draft meanwhile, and starting it is refused with
409; so is starting one with no contacts. - Start and resume need the Pro plan (
402), and so does an update that gives a draft a time to start, since a scheduled campaign starts by itself. Pause and cancel do not. - Only a campaign that never started can be deleted. One that has started keeps its history: deleting it is refused with
409. Cancel it instead. - Contacts saved in the same batch come back in no set order. The import saves the file 5,000 lines that are not blank at a time (fewer when the lines are long). List contacts returns the batches in order, but not each batch in file order. To match a contact to your own record, put your id in its
custom_data. - A failed import resumes where it stopped. Retry import carries on after the last line saved, so no contact is added twice.
- Cancelling or deleting a campaign while its contacts import stops the import.
- The dashboard uploads the same file another way. It sends it in pieces through the resumable (TUS) link the reserve also answers with. An integration can use the plain
PUTtoupload.signed_url.
Errors every route can give
The error envelope is on the Errors page.