0.0.2 • Published 7 years ago

sendinblue-v3-node-client v0.0.2

Weekly downloads
17
License
MIT
Repository
github
Last release
7 years ago

sendinblue-v3-node-client

The Best Unofficial SendinBlue V3 API Node.js Client

sendinblue-v3-node-client exposes the entire SendinBlue API. Please refer to the full official documentation to learn more.

This is an unofficial wrapper for the API. It implements all the features of the API v3. It supports promises and callbacks.

Installation

If you are unfamiliar with npm, see the npm docs.

npm i -S sendinblue-v3-node-client

Getting Started

Please follow the installation instruction and execute the following JS code:

let sib = require('sendinblue-v3-node-client')("YOUR_API_KEY")

sib.account.get(function(error, account) {
  if(error) console.log("Error: ", error)
  else console.log("Your Account Object: ", account)
})

// OR 

sib.account.get().then(function(account) {
  console.log("Your Account Object: ", account)
}).catch(function(error) {
  console.log("Error: ", error)
})

Documentation for API Endpoints

All URIs are relative to https://api.sendinblue.com/v3

MethodHTTP requestDescription
account.getGET /accountGet your account informations, plans and credits details
resellers.children.allGET /resellerGets the list of all reseller's children accounts
resellers.children.createPOST /resellerCreates a reseller child
resellers.children.getGET /resellerGets the info about a specific child account
resellers.children.updatePUT /resellerUpdates infos of reseller's child based on the childAuthKey supplied
resellers.children.deleteDELETE /resellerDeletes a single reseller child based on the childAuthKey supplied
resellers.children.ips.associatePOST /resellerAssociate a dedicated IP to the child
resellers.children.ips.dissociatePOST /resellerDissociate a dedicated IP to the child
resellers.children.credits.addPOST /resellerAdd Email and/or SMS credits to a specific child account
resellers.children.credits.removePOST /resellerRemove Email and/or SMS credits from a specific child account
senders.allGET /sendersReturn all the dedicated IPs for your account
senders.createPOST /sendersCreate a new sender
senders.updatePUT /sendersUpdate a sender
senders.deleteDELETE /sendersDelete a sender
senders.ips.getGET /sendersReturn all the dedicated IPs for a sender
senders.ips.allGET /sendersGet the list of all your senders
processes.allGET /processesReturn all the processes for your account
processes.getGET /processesReturn the informations for a process
campaigns.allGET /emailCampaignsReturn all your created campaigns
campaigns.getGET /emailCampaignsGet campaign informations
campaigns.createPOST /emailCampaignsCreate an email campaign
campaigns.updatePUT /emailCampaignsUpdate a campaign
campaigns.deleteDELETE /emailCampaignsDelete an email campaign
campaigns.sendPOST /emailCampaignsSend an email campaign id of the campaign immediately
campaigns.testPOST /emailCampaignsSend an email campaign to your test list
campaigns.exportPOST /emailCampaignsExport the recipients of a campaign
campaigns.reportPOST /emailCampaignsSend the report of a campaigns
campaigns.statusPUT /emailCampaignsUpdate a campaign status
smtp.activity.dayGET /smtpGet your SMTP activity aggregated per day
smtp.activity.customGET /smtpGet your SMTP activity aggregated over a period of time
smtp.activity.allGET /smtpGet all your SMTP activity (unaggregated events)
smtp.templates.allGET /smtpGet the list of SMTP templates
smtp.templates.createPOST /smtpCreate an smtp template
smtp.templates.getGET /smtpReturns the template informations
smtp.templates.updatePUT /smtpUpdates an smtp templates
smtp.templates.deleteDELETE /smtpDelete an inactive smtp template
smtp.templates.testPOST /smtpSend a template to your test list
smtp.templates.sendPOST /smtpSend a template
smtp.transactionals.sendPOST /smtpSend a transactional email
smtp.hardbounces.deletePOST /smtpDelete hardbounces
webhooks.allGET /webhooksGet all webhooks
webhooks.createPOST /webhooksCreate a webhook
webhooks.getGET /webhooksGet a webhook details
webhooks.updatePUT /webhooksUpdate a webhook
webhooks.deleteDELETE /webhooksDelete a webhook
contacts.allGET /contactsGet all the contacts
contacts.createPOST /contactsCreate a contact
contacts.getGET /contactsRetrieves contact informations
contacts.updatePUT /contactsUpdates a contact
contacts.deleteDELETE /contactsDeletes a contact
contacts.statisticsGET /contactsGet the campaigns statistics for a contact
contacts.attributes.allGET /contactsLists all attributes
contacts.attributes.createPOST /contactsCreates contact attribute
contacts.attributes.updatePUT /contactsUpdates contact attribute
contacts.attributes.deleteDELETE /contactsDeletes an attribute
contacts.folders.allGET /contactsGet all the folders
contacts.folders.createPOST /contactsCreate a folder
contacts.folders.getGET /contactsReturns folder details
contacts.folders.updatePUT /contactsUpdate a contact folder
contacts.folders.deleteDELETE /contactsDelete a folder (and all its lists)
contacts.folders.listsGET /contactsGet the lists in a folder
contacts.lists.allGET /contactsGet all the lists
contacts.lists.createPOST /contactsCreate a list
contacts.lists.getGET /contactsGet the details of a list
contacts.lists.updatePUT /contactsUpdate a list
contacts.lists.deleteDELETE /contactsDelete a list
contacts.lists.contacts.getGET /contactsGet the contacts in a list
contacts.lists.contacts.addPOST /contactsAdd existing contacts to a list
contacts.lists.contacts.removePOST /contactsRemove existing contacts from a list
contacts.exportPOST /contactsExport contacts
contacts.importPOST /contactsImport contacts
sms.sendPOST /transactionalSMSSend the SMS campaign to the specified mobile number
sms.allGET /transactionalSMSGet all the SMS activity (unaggregated events)
sms.customGET /transactionalSMSGet your SMS activity aggregated over a period of time
sms.dayGET /transactionalSMSGet your SMS activity aggregated per day

Advanced

Using path, query, and body parameters.

// sib.path.to.endpoint([path_params],[query_params],[body_params],[callback])

// Get all contacts
sib.contacts.all({
  limit: 50,  // query_param
  offset: 0   // query_param
}, function(error, contacts) {
  if(error) console.log("Error: ", error)
  else console.log("All Contacts: ", JSON.stringify(contacts, null, 2))
})

// Create new contact
sib.contacts.create({
  email: "johndoe@gmail.com", // body_param
}, function(error, newContact) {
  if(error) console.log("Error: ", error)
  else console.log("New Contact: ", JSON.stringify(newContact, null, 2))
})

// Updates a contact
sib.contacts.update("johndoe%40gmail.com", {
  emailBlacklisted: true
}, function(error, newContact) {
  if(error) console.log("Error: ", error)
  else console.log("Updated Contact: ", JSON.stringify(newContact, null, 2))
})

Support and Feedback

Be sure to visit the SendinBlue official documentation website for additional information about the official API.

If you find a bug, please post the issue on Github.

If you have any questions or comments, feel free to drop us a note here.