Giter Site home page Giter Site logo

nodejs-sendgrid-contacts-export's Introduction

SendGrid Contacts Export for Node.js

Main repo: https://github.com/huned/nodejs-sendgrid-contacts-export

The simplest way to get all your SendGrid contacts as JSON.

Installation

npm install sendgrid-contacts-export

Usage

Use it like this:

const SendGrid = require(./lib/sendgrid)
const sg = new SendGrid('MY API KEY')
const contacts = await sg.getContacts()
console.log(contacts)

Optionally, specify options using SendGrid's Contacts Export API options. E.g.,

// See SendGrid's Marketing > Contacts > Exports API doc for details.
// https://sendgrid.com/docs/API_Reference/api_v3.html
const opts = {
  "list_ids": [ "string" ],
  "segment_ids": [ "string" ],
  "notifications": {
    "email": "boolean (optional)"
  },
  "file_type": "csv",
  "max_file_size": 5000
}
await sg.getContacts(opts)

Command Line Usage

Clone this repo, then:

SENDGRID_API_KEY=<your api key> npm start

And it will print all your contacts as JSON to stdout.

You can also set SENDGRID_LIST_IDS and SENDGRID_SEGMENT_IDS to comma separated list/segment ids. E.g.,

SENDGRID_API_KEY=<your api key> SENDGRID_LIST_IDS=<list1 id>,<list2 id> npm start

You can also define each of these environment in a ./.env file instead of at the command line, if you wish.

Known Issues

  • No tests yet (maybe you can submit a PR?!)

Author

Huned Botee

License

MIT

nodejs-sendgrid-contacts-export's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.