https://github.com/sendgrid/sendgrid-cli
The SendGrid CLI (Command Line Interface) is a tool that helps you to interact with SendGrid services from the command line.
https://github.com/sendgrid/sendgrid-cli
Last synced: 7 months ago
JSON representation
The SendGrid CLI (Command Line Interface) is a tool that helps you to interact with SendGrid services from the command line.
- Host: GitHub
- URL: https://github.com/sendgrid/sendgrid-cli
- Owner: sendgrid
- License: mit
- Created: 2018-11-27T20:24:27.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2024-11-07T21:46:42.000Z (over 1 year ago)
- Last Synced: 2025-06-27T11:41:28.451Z (9 months ago)
- Language: JavaScript
- Homepage:
- Size: 637 KB
- Stars: 25
- Watchers: 88
- Forks: 4
- Open Issues: 14
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# SendGrid CLI
The SendGrid CLI (Command Line Interface) is a tool that helps you to interact with SendGrid services from the command line. It is helpful for automating routine tasks. The SendGrid CLI removes the need to write code to perform common management activites of the SendGrid platform like uploading a CSV file and enabling/disabling webhooks.

# Prerequisites
* SendGrid Account
* Tested with NodeJS v8.12.0
# Installation
* Clone this project
* `cd sendgrid-cli`
* `npm install`
* Rename `.env_sample` to `.env` and update the values
## A Note on API Key and API Token
In the `.env_sample`, you will notice two environment variables, `SENDGRID_API_KEY` and `SENDGRID_TOKEN`. For certain commands, you will need to use `SENDGRID_TOKEN`. To learn how to retrieve this token [here](RETRIEVE_TOKEN.md).
# Usage
This command line interface implements a limited set of commands.
* `./sg list-apikeys`: List API keys
* `./sg subuser-admins`: Iterate over all subusers and list all teammates (including role) for each subuser (requires `SENDGRID_TOKEN` see note above)
* `./sg contacts upload`: Upload contacts from a CSV file (fields: email, first_name, last_name)
* `./sg webhooks`: Manage Event and Inbound Parse webhooks
These will output JavaScript Objects that are human readable.
You can also prepend `DEBUG=sg:*` for additional debug logging (not much yet).
Debug namespaces:
* `sg:client`
* `sg:utils`
* `sg:contacts-upload`
* `sg:subuser-admins`
* `sg:webhooks-add-parse`
* `sg:webhooks-disable-event`
* `sg:webhooks-enable-event`
# Todos
* Pipe from one command into another (need to output JSON strings to stdout)
# License
[LICENSE](LICENSE)