Often developers and IT organizations have routine tasks that can be encapsulated into a tool. There are likely many SendGrid customers who have written scripts to manage these kinds of tasks.  

For example, I was recently developing some internal tools, and making contributions during Hacktoberfest. I found myself repeatedly enabling and disabling webhooks for inbound parse, creating API keys, and uploading contacts. As a developer, context switching to make these changes in the UI slowed me down.

Then, a few weeks ago, I overheard a customer request to retrieve teammates who are admins for subuser accounts. This is possible through our API, of course. But, not everyone wants to (or can) write code to solve a niche use case with the SendGrid platform.  

Having come from a varied background, including IT and operations, I thought this seems like a common situation for a command line tool. So, we built one and today we’re announcing a new open source project: sendgrid-cli.  

The SendGrid CLI (Command Line Interface) tool allows you to interact with SendGrid services from the command line. 

The SendGrid CLI removes the need to write code to perform common management activities on the SendGrid platform like uploading a CSV file and enabling or disabling webhooks.

What can you do with the CLI?

At release, we have the following capabilities:

  • Uploading a CSV file of contacts
  • Listing API Keys
  • Listing teammates within each subuser account
  • Managing webhooks

You may wonder, what about sending email?! We’re taking an opinionated approach, and kept sending email out of this project. At the outset, including email in the project could dilute the main types of activities we want this tool to expedite, and why we focused on use cases like enabling and disabling webhooks, uploading contacts, and retrieving subusers and teammates.

Keeping the tool focused on scenarios related to administration and management of the customer’s use of SendGrid’s platform. Of course, we’re open to your suggestions as well, so feel free to open an issue or PR.

Some technical points

If you’re curious about the technical underpinnings of sendgrid-cli:

  • Since sendgrid-cli is a NodeJS project, we used the yargs library for creating the core command line utility features. Yargs made it easy and maintainable to create a subcommand structure in the project.
  • The main API calls are made via the @sendgrid/client library, and live in the lib/sgclient.js file.
  • The output for any of the commands sends to stdout in JSON format, and so can be saved to a file for further processing.

The project is released under an MIT license. You can find it in the SendGrid GitHub Organization at https://github.com/sendgrid/sendgrid-cli. We welcome your contributions and suggestions, so feel free to open an issue or PR!

We hope you find this tool useful, look forward to contributions, and would love to know how you’re using it!

Ashley Roach is a Principal Product Manager for Developer Experience at SendGrid. Previously, he was a Principal Engineer Evangelist for Cisco's developer relations team, DevNet. He has spoken and led workshops at many Cisco and 3rd-Party conferences. Prior to DevNet, he was a Product Manager in Cloud Collaboration working on APIs and XMPP technologies. Before Cisco, he was Product Manager at NewsGator Technologies, where he initiated the Social Sites product, the leading social software integration with SharePoint at the time. Before NewsGator, he joined Jabber, Inc. in 2003 where he was the Product Manager for the Jabber XCP server and launched the JabberNow appliance. Ashley holds an MBA from the University of Colorado Leeds School of Business and Undergraduate degree in History from the University of Pennsylvania. When not hacking on APIs, he enjoys playing guitar at blues jams around Denver, snowboarding, and camping.