You will first need a Woodpecker account, and your API key. See the Woodpecker API docs here. http://help.woodpecker.co/article/16-api-docs.
npm i woodpecker-api
The API uses Promises for all interaction.
const Woodpecker = require('woodpecker-api')('KEY')
Woodpecker.prospects()
.find({
firstName: 'd',
$limit: 1
})
.then(d => {
console.log(d)
})
.catch(e => {
console.log(e)
})
- id: Find by id
- ids: Find by an array of ids
- campaign: Find by a specific
campaign_id
- campaigns: Find by an array of
campaign_id
s - status: Find by prospect status. Valid values:
ACTIVE
|BLACKLIST
|AUTOREPLIED
|TO-CHECK
|TO-REVIEW
|BOUNCED
|INVALID
|REPLIED
- activity: Find by prospect action. Valid values:
OPENED
|NOT-OPENED
|CLICKED
|NOT-CLICKED
- interest: Find by prospect interest. Valid values:
INTERESTED
|NOT-INTERESTED
|MAYBE-LATER
|NOT-MARKED
- updated: Find where dates are greater then or less than an updated date. Accepts a diff object
{op: '<', date: new Date}
or a string>2017-01-01
. - opened: Find where dates are greater then or less than an opened date. Accepts a diff object
{op: '<', date: new Date}
or a string>2017-01-01
. - clicked: Find where dates are greater then or less than a clicked date. Accepts a diff object
{op: '<', date: new Date}
or a string>2017-01-01
. - contacted: If the user has been contacted or not.
true
orfalse
- firstName: Search within the prospects
first_name
- lastName: Search within the prospects
last_name
. note that the Woodpecker docs are incorrect.second_name
is invalid. - email: Search within the prospects
email
- company: Search within the prospects
company
- industry: Search within the prospects
industry
- website: Search within the prospects
website
- tags: Search within the prospects
tags
- title: Search within the prospects
title
- phone: Search within the prospects
phone
- address: Search within the prospects
address
- city: Search within the prospects
city
- state: Search within the prospects
state
- country: Search within the prospects
country
- snippet1: Search within the prospects
snippet1
. Can usesnippet1
up tosnippet15
- $limit: Sets the maximum results per page. Defaults to
100
, max of500
- $page: The page to display
- $skip: Amount of results to skip. To be used with
$limit
instead of$page
- $sort: Sort order object. Can be
1
,ASC
|true
|+
, or-1
,DESC
|false
|-
. Defaults toASC
. Available fields:id
,firstName
,lastName
,replied
,status
,updated
,email
,company
,industry
,website
,tags
,title
,phone
,address
,city
,state
,country
,opened
(requires activity.OPENED),clicked
(requires activity.CLICKED)
- 100 newest prospects
- 100 latest prospects who replied to the email
- 100 latest prospects who opened the email
- 100 latest prospects who clicked on the email`
- 100 latest prospects marked as not contacted
- Accepts either a single prospect or an array of prospects. Available fields:
firstName
,lastName
,email
,company
,industry
,website
,tags
,title
,phone
,address
,city
,state
,country
,snippet[1-15]
- Same as add, but will perform an update if they items exist. Requires
id
for each prospect. All fields mentioned in the request will be updated.
- Deletes a prospect by id or email
- Blacklists a prospect by id or email
- id: Find by id
- ids: Find by an array of ids
- status: Find by specific status. Valid values:
RUNNING
|PAUSED
|COMPLETED
|DRAFT
|EDITED
|STOPPED
- Subscribes to an event for the given
URL
andEVENT
. Valid event values:REPLIED
,CLICKED
,OPENED
,BOUNCED
,INVALID
,INTERESTED
,MAYBE-LATER
,NOT-INTERESTED
,AUTOREPLIED
,FOLLOWUP
- Same as above, but unsubscribes
Woodpecker.prospects().find()
Woodpecker.prospects()
.find({
campaign: 1
})
Woodpecker.prospects()
.find({
campaigns: [1,2,3]
})
Woodpecker.prospects()
.find({
status: Woodpecker.prospectStatus.REPLIED
})
Woodpecker.prospects()
.find({
campaign: 22,
status: Woodpecker.prospectStatus['TO-CHECK']
})
Woodpecker.prospects()
.find({
activity: Woodpecker.activity.OPENED
})
Woodpecker.prospects()
.find({
activity: Woodpecker.activity.OPENED,
status: Woodpecker.status.REPLIED
})
Woodpecker.prospects()
.find({
campaign: 10074,
interest: Woodpecker.interest.INTERESTED
})
Woodpecker.prospects()
.find({
contacted: false
})
Woodpecker.prospects()
.find({
firstName: 'devin',
lastName: 'smith',
email: '',
company: '',
industry: '',
website: '',
tags: '',
title: '',
phone: '',
address: '',
city: '',
state: '',
country: ''
})
Woodpecker.prospects()
.find({
id: 2225
})
Woodpecker.prospects()
.find({
$page: 2
})
Woodpecker.prospects()
.find({
$limit: 20
})
Woodpecker.prospects()
.find({
$skip: 100
})
Woodpecker.prospects()
.find({
$page: 2,
$limit: 20,
status: Woodpecker.prospectStatus.REPLIED
})
Woodpecker.prospects()
.find({
firstName: 'devin',
sort: '+first_name,+id,+country',
})
Woodpecker.prospects()
.find({
firstName: 'devin',
$sort: {
id: 1,
firstName: -1,
lastName: -1
}
})
Woodpecker.prospects()
.find({
updated: {
op: '>',
date: new Date
}
})
Woodpecker.prospects()
.find({
opened: '>2017-01-01'
})
Woodpecker.prospects().newest()
Woodpecker.prospects().replied()
Woodpecker.prospects().opened()
Woodpecker.prospects().clicked()
Woodpecker.prospects().notContacted()
Woodpecker.campaigns().find()
Woodpecker.campaigns()
.find({
status: Woodpecker.campaignStatus.RUNNING
})
Woodpecker.campaigns()
.find({
id: 1
})
Woodpecker.campaigns()
.find({
ids: [1,2]
})
Woodpecker.prospects().add({
firstName: 'mr',
lastName: 'mr test',
email: 'mrtest@somedomain.com'
}, 2034)
Woodpecker.prospects().add([{
firstName: 'mr',
lastName: 'mr test',
email: 'mrtest@somedomain.com'
},{
firstName: 'mrs',
lastName: 'mrs test',
email: 'mrstest@somedomain.com'
}])
Woodpecker.prospects().edit({
firstName: 'mr',
lastName: 'mr test',
email: 'mrtest@somedomain.com'
})
Woodpecker.prospects().delete('mrtest@somedomain.com')
Woodpecker.prospects().delete('mrtest@somedomain.com', 2034)
Woodpecker.prospects().blacklist('mrtest@somedomain.com')
Woodpecker.webhooks().subscribe('https://domain/page', Woodpecker.webhookEvent.REPLIED)