{"id":18783928,"url":"https://github.com/sparkpost/node-sparkpost","last_synced_at":"2025-10-19T03:08:55.550Z","repository":{"id":20817081,"uuid":"24102765","full_name":"SparkPost/node-sparkpost","owner":"SparkPost","description":"SparkPost client library for Node.js","archived":false,"fork":false,"pushed_at":"2024-02-09T22:02:41.000Z","size":775,"stargazers_count":178,"open_issues_count":29,"forks_count":43,"subscribers_count":43,"default_branch":"master","last_synced_at":"2025-10-17T21:49:05.573Z","etag":null,"topics":["client-library","email","javascript","nodejs","sparkpost"],"latest_commit_sha":null,"homepage":"https://www.sparkpost.com/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SparkPost.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-09-16T14:23:35.000Z","updated_at":"2025-09-08T15:30:32.000Z","dependencies_parsed_at":"2024-06-18T12:40:43.873Z","dependency_job_id":"dfca63cb-44d3-45a2-bc5f-fb84d0bcba4d","html_url":"https://github.com/SparkPost/node-sparkpost","commit_stats":{"total_commits":336,"total_committers":34,"mean_commits":9.882352941176471,"dds":0.5744047619047619,"last_synced_commit":"e41ecd697ae99e711ee8a96c49156aa4b3e90bf3"},"previous_names":[],"tags_count":27,"template":false,"template_full_name":null,"purl":"pkg:github/SparkPost/node-sparkpost","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SparkPost%2Fnode-sparkpost","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SparkPost%2Fnode-sparkpost/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SparkPost%2Fnode-sparkpost/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SparkPost%2Fnode-sparkpost/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SparkPost","download_url":"https://codeload.github.com/SparkPost/node-sparkpost/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SparkPost%2Fnode-sparkpost/sbom","scorecard":{"id":132699,"data":{"date":"2025-08-04","repo":{"name":"github.com/SparkPost/node-sparkpost","commit":"e41ecd697ae99e711ee8a96c49156aa4b3e90bf3"},"scorecard":{"version":"v5.2.1-28-gc1d103a9","commit":"c1d103a9bb9f635ec7260bf9aa0699466fa4be0e"},"score":3,"checks":[{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#token-permissions"}},{"name":"Code-Review","score":4,"reason":"Found 7/17 approved changesets -- score normalized to 4","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#security-policy"}},{"name":"License","score":9,"reason":"license file detected","details":["Info: project has a license file: LICENSE.txt:0","Warn: project license file does not contain an FSF or OSI license."],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#license"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":6,"reason":"branch protection is not maximal on development and all release branches","details":["Info: 'allow deletion' disabled on branch 'master'","Info: 'force pushes' disabled on branch 'master'","Warn: 'branch protection settings apply to administrators' is disabled on branch 'master'","Warn: required approving review count is 1 on branch 'master'","Warn: codeowners review is not required on branch 'master'","Warn: no status checks found to merge onto branch 'master'","Info: PRs are required in order to make changes on branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 22 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"38 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-6chw-6frg-f759","Warn: Project is vulnerable to: GHSA-v88g-cgmw-v5xw","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-4gmj-3p3h-gm8h","Warn: Project is vulnerable to: GHSA-qrmc-fj45-qfc2","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-4q6p-r6v2-jvc5","Warn: Project is vulnerable to: GHSA-q42p-pg8m-cqh6","Warn: Project is vulnerable to: GHSA-w457-6q6x-cgp9","Warn: Project is vulnerable to: GHSA-62gr-4qp9-h98f","Warn: Project is vulnerable to: GHSA-f52g-6jhx-586p","Warn: Project is vulnerable to: GHSA-2cf5-4w76-r9qv","Warn: Project is vulnerable to: GHSA-3cqr-58rm-57f8","Warn: Project is vulnerable to: GHSA-g9r4-xpmj-mj65","Warn: Project is vulnerable to: GHSA-q2c6-c6pm-g3gh","Warn: Project is vulnerable to: GHSA-765h-qjxv-5f44","Warn: Project is vulnerable to: GHSA-f2jv-r9rf-7988","Warn: Project is vulnerable to: GHSA-2pr6-76vf-7546","Warn: Project is vulnerable to: GHSA-8j8c-7jfh-h6hx","Warn: Project is vulnerable to: GHSA-896r-f27r-55mw","Warn: Project is vulnerable to: GHSA-282f-qqgm-c34q","Warn: Project is vulnerable to: GHSA-4xc9-xhrj-v574","Warn: Project is vulnerable to: GHSA-x5rq-j2xg-h7qm","Warn: Project is vulnerable to: GHSA-jf85-cpcp-j695","Warn: Project is vulnerable to: GHSA-p6mc-m468-83gw","Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9","Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-vh95-rmgr-6w4m","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-g6ww-v8xp-vmwg","Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp","Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-4rq4-32rv-6wp6","Warn: Project is vulnerable to: GHSA-64g7-mvw6-v9qj","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-16T05:34:59.494Z","repository_id":20817081,"created_at":"2025-08-16T05:34:59.494Z","updated_at":"2025-08-16T05:34:59.494Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279681140,"owners_count":26209804,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-19T02:00:07.647Z","response_time":64,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["client-library","email","javascript","nodejs","sparkpost"],"created_at":"2024-11-07T20:41:12.251Z","updated_at":"2025-10-19T03:08:55.535Z","avatar_url":"https://github.com/SparkPost.png","language":"JavaScript","readme":"\u003ca href=\"https://www.sparkpost.com\"\u003e\u003cimg src=\"https://www.sparkpost.com/sites/default/files/attachments/SparkPost_Logo_2-Color_Gray-Orange_RGB.svg\" width=\"200px\"/\u003e\u003c/a\u003e\n\n[Sign up][sparkpost sign up] for a SparkPost account and visit our [Developer Hub](https://developers.sparkpost.com) for even more content.\n\n# Node.js Client Library\n\n[![Travis CI](https://travis-ci.org/SparkPost/node-sparkpost.svg?branch=master)](https://travis-ci.org/SparkPost/node-sparkpost) [![Coverage Status](https://coveralls.io/repos/SparkPost/node-sparkpost/badge.svg?branch=master\u0026service=github)](https://coveralls.io/github/SparkPost/node-sparkpost?branch=master) [![NPM version](https://badge.fury.io/js/sparkpost.png)](http://badge.fury.io/js/sparkpost)\n\nThe official Node.js binding for your favorite [SparkPost APIs](https://developers.sparkpost.com/api)!\n\n## Prerequisites\n\nBefore using this library, you must have:\n\n* A shiny new SparkPost Account, [sign up for a new account][sparkpost sign up] or [login to SparkPost](https://app.sparkpost.com/)\n* A valid SparkPost API Key. Check out our [Support Center](https://support.sparkpost.com/) for information on how to [create API keys](https://support.sparkpost.com/customer/portal/articles/1933377-create-api-keys)\n\n## Installation\n\n```\nnpm install sparkpost\n```\n\n*Note: Node.js versions 0.10 and 0.12 are no longer supported.*\n\n## Initialization\n**new SparkPost(apiKey[, options])** - Initialization\n\n* `apiKey`\n    * Required: yes (unless key is stored in `SPARKPOST_API_KEY` environment variable)\n    * Type: `String`\n    * a passed in apiKey will take precedence over an environment variable\n* `options.origin` or `options.endpoint`\n    * Required: no\n    * Type: `String`\n    * Default: `https://api.sparkpost.com:443`\u003cbr/\u003e\n    *Note: To use the SparkPost EU API you will need to set this to `https://api.eu.sparkpost.com:443`.*\n* `options.apiVersion`\n    * Required: no\n    * Type: `String`\n    * Default: `v1`\n* `options.stackIdentity`\n    * Required: no\n    * Type: `String`\n    * An optional identifier to include in the User-Agent header. e.g. `product/1.0.0`\n* `options.headers`\n    * Required: no\n    * Type: `Object`\n    * set headers that apply to all requests\n* `options.debug`\n    * Required: no\n    * Type: `Boolean`\n    * Default: `false`\n    * appends full response from request client as `debug` when `true` for debugging purposes\u003cbr/\u003e\n    *Note: This will expose your api key to the client-side. Do not use in production.*\n\n## Methods\n\n*Note: All methods return promises and accept an optional last argument callback. [Read about how we handle callbacks and promises](/docs/async.md).*\n\n* **request(options[, callback])**\n    * `options` - [see request modules options](https://github.com/mikeal/request#requestoptions-callback)\n    * `options.uri` - can either be a full url or a path that is appended to `options.origin` used at initialization ([url.resolve](http://nodejs.org/api/url.html#url_url_resolve_from_to))\n    * `options.debug` - setting to `true` includes full response from request client for debugging purposes\n* **get | post | put | delete(options[, callback])**\n    * `options` - see request options\n    * Request method will be overwritten and set to the same value as the name of these methods.\n\n## Creating a SparkPost Client\n\nPassing in an API key\n```js\nconst SparkPost = require('sparkpost');\nconst client = new SparkPost('YOUR_API_KEY');\n```\n\nUsing an API key stored in an environment variable\n```js\n//Create an env var as SPARKPOST_API_KEY\nconst SparkPost = require('sparkpost');\nconst client = new SparkPost();\n```\n\nSpecifying non-default options\n```js\nconst SparkPost = require('sparkpost');\nconst options = {\n  endpoint: 'https://dev.sparkpost.com:443'\n};\nconst client = new SparkPost('YOUR_API_KEY', options);\n```\n\n## Using the Node Client Library Base Object\nWe may not wrap every resource available in the SparkPost Client Library, for example the Node Client Library does not wrap the Metrics resource,\nbut you can use the Node Client Library Base Object to form requests to these unwrapped resources. Here is an example request using the\nbase object to make requests to the Metrics resource. Here is an example request using the base object to make requests to\nthe Metrics resource.\n\n```js\n// Get a list of domains that the Metrics API contains data on.\nconst options = {\n  uri: 'metrics/domains'\n};\n\nclient.get(options)\n  .then(data =\u003e {\n    console.log(data);\n  })\n  .catch(err =\u003e {\n    console.log(err);\n  });\n```\n\n## Send An Email \"Hello World\" Example\nBelow is an example of how to send a simple email. Sending an email is known as a *transmission*. By using the send\nmethod on the transmissions service that's available from the SparkPost object you instantiate, you can pass in an\nobject with all the [transmission attributes](https://developers.sparkpost.com/api/transmissions#header-transmission-attributes)\nrelevant to the email being sent. The send method will return a promise that will let you know if the email was sent\nsuccessful and if not information about the error that occurred. If a callback is passed, it will be executed.\n\n```javascript\nconst SparkPost = require('sparkpost');\nconst client = new SparkPost('\u003cYOUR API KEY\u003e');\n\n// If you have a SparkPost EU account you will need to pass a different `origin` via the options parameter:\n// const euClient = new SparkPost('\u003cYOUR API KEY\u003e', { origin: 'https://api.eu.sparkpost.com:443' });\n\nclient.transmissions.send({\n    options: {\n      sandbox: true\n    },\n    content: {\n      from: 'testing@sparkpostbox.com',\n      subject: 'Hello, World!',\n      html:'\u003chtml\u003e\u003cbody\u003e\u003cp\u003eTesting SparkPost - the world\\'s most awesomest email service!\u003c/p\u003e\u003c/body\u003e\u003c/html\u003e'\n    },\n    recipients: [\n      {address: '\u003cYOUR EMAIL ADDRESS\u003e'}\n    ]\n  })\n  .then(data =\u003e {\n    console.log('Woohoo! You just sent your first mailing!');\n    console.log(data);\n  })\n  .catch(err =\u003e {\n    console.log('Whoops! Something went wrong');\n    console.log(err);\n  });\n```\n\n## SparkPost API Resources Supported in Node Client Library\nClick on the desired API to see usage and more information\n\n* [Inbound Domains](/docs/resources/inboundDomains.md) - `client.inboundDomains` ([examples](/examples/inboundDomains))\n* [Message Events](/docs/resources/messageEvents.md) - `client.messageEvents` ([examples](/examples/messageEvents))\n* [Events](/docs/resources/events.md) - `client.events` ([examples](/examples/events))\n* [Recipient Lists](/docs/resources/recipientLists.md) - `client.recipientLists` ([examples](/examples/recipientLists))\n* [Relay Webhooks](/docs/resources/relayWebhooks.md) - `client.relayWebhooks` ([examples](/examples/relayWebhooks))\n* [Sending Domains](/docs/resources/sendingDomains.md) - `client.sendingDomains` ([examples](/examples/sendingDomains))\n* [Subaccounts](/docs/resources/subaccounts.md) - `client.subaccounts` ([examples](/examples/subaccounts))\n* [Suppression List](/docs/resources/suppressionList.md) - `client.suppressionList` ([examples](/examples/suppressionList))\n* [Templates](/docs/resources/templates.md) - `client.templates` ([examples](/examples/templates))\n* [Transmissions](/docs/resources/transmissions.md) - `client.transmissions` ([examples](/examples/transmissions))\n* [Webhooks](/docs/resources/webhooks.md) - `client.webhooks` ([examples](/examples/webhooks))\n\n\n## Development\n\n### Setup\nRun `npm install` inside the repository to install all the dev dependencies.\n\n### Testing\nOnce all the dependencies are installed, you can execute the unit tests using `npm test`\n\n### Contributing\n[Guidelines for adding issues](docs/ADDING_ISSUES.md)\n\n[Our coding standards](docs/CODE_STYLE_GUIDE.md)\n\n[Submitting pull requests](CONTRIBUTING.md)\n\n### ChangeLog\n\n[See ChangeLog here](CHANGELOG.md)\n\n[sparkpost sign up]: https://app.sparkpost.com/join?plan=free-0817?src=Social%20Media\u0026sfdcid=70160000000pqBb\u0026pc=GitHubSignUp\u0026utm_source=github\u0026utm_medium=social-media\u0026utm_campaign=github\u0026utm_content=sign-up\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsparkpost%2Fnode-sparkpost","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsparkpost%2Fnode-sparkpost","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsparkpost%2Fnode-sparkpost/lists"}