{"id":39644997,"url":"https://github.com/socketlabs/socketlabs-nodejs","last_synced_at":"2026-01-18T09:04:11.287Z","repository":{"id":33278342,"uuid":"152119408","full_name":"socketlabs/socketlabs-nodejs","owner":"socketlabs","description":"SocketLabs Email Delivery Node.js client library","archived":false,"fork":false,"pushed_at":"2024-01-10T00:13:56.000Z","size":589,"stargazers_count":8,"open_issues_count":4,"forks_count":7,"subscribers_count":13,"default_branch":"main","last_synced_at":"2025-10-26T22:38:01.821Z","etag":null,"topics":["deliverability","email","nodejs","socketlabs"],"latest_commit_sha":null,"homepage":"https://www.socketlabs.com","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/socketlabs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2018-10-08T17:29:36.000Z","updated_at":"2022-05-06T19:33:52.000Z","dependencies_parsed_at":"2023-10-11T16:57:40.250Z","dependency_job_id":null,"html_url":"https://github.com/socketlabs/socketlabs-nodejs","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/socketlabs/socketlabs-nodejs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/socketlabs%2Fsocketlabs-nodejs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/socketlabs%2Fsocketlabs-nodejs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/socketlabs%2Fsocketlabs-nodejs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/socketlabs%2Fsocketlabs-nodejs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/socketlabs","download_url":"https://codeload.github.com/socketlabs/socketlabs-nodejs/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/socketlabs%2Fsocketlabs-nodejs/sbom","scorecard":{"id":835643,"data":{"date":"2025-08-11","repo":{"name":"github.com/socketlabs/socketlabs-nodejs","commit":"ffe9f947a1afd3ef61128a150b7b2e2d38adbcac"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.2,"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/f6ed084d17c9236477efd66e5b258b9d4cc7b389/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/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":2,"reason":"Found 2/9 approved changesets -- score normalized to 2","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/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"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/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"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/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"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/f6ed084d17c9236477efd66e5b258b9d4cc7b389/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/f6ed084d17c9236477efd66e5b258b9d4cc7b389/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/f6ed084d17c9236477efd66e5b258b9d4cc7b389/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/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"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/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"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/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":3,"reason":"branch protection is not maximal on development and all release branches","details":["Info: 'allow deletion' disabled on branch 'main'","Info: 'force pushes' disabled on branch 'main'","Info: 'branch protection settings apply to administrators' is required to merge on branch 'main'","Warn: could not determine whether codeowners review is allowed","Warn: no status checks found to merge onto branch 'main'","Warn: PRs are not required to make changes on branch 'main'; or we don't have data to detect it.If you think it might be the latter, make sure to run Scorecard with a PAT or use Repo Rules (that are always public) instead of Branch Protection settings"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":6,"reason":"4 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-wf5p-g6vw-rhxx","Warn: Project is vulnerable to: GHSA-jr5f-v2jv-69x6","Warn: Project is vulnerable to: GHSA-jchw-25xp-jwwc","Warn: Project is vulnerable to: GHSA-cxjh-pqwp-8mfp"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 25 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-23T18:58:03.058Z","repository_id":33278342,"created_at":"2025-08-23T18:58:03.058Z","updated_at":"2025-08-23T18:58:03.058Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28534154,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-18T00:39:45.795Z","status":"online","status_checked_at":"2026-01-18T02:00:07.578Z","response_time":98,"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":["deliverability","email","nodejs","socketlabs"],"created_at":"2026-01-18T09:04:11.023Z","updated_at":"2026-01-18T09:04:11.273Z","avatar_url":"https://github.com/socketlabs.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![SocketLabs](https://static.socketlabs.com/logos/logo-dark-326x64.png)](https://www.socketlabs.com/developers)\n# [![Twitter Follow](https://img.shields.io/twitter/follow/socketlabs.svg?style=social\u0026label=Follow)](https://twitter.com/socketlabs) [![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/socketlabs/socketlabs-nodejs/blob/master/CONTRIBUTING.md)\n\nThe SocketLabs Email Delivery Node.js library allows you to easily send email messages via the [SocketLabs Injection API](https://www.socketlabs.com/docs/inject/).  The library makes it easy to build and send any type of message supported by the API, from a simple message to a single recipient all the way to a complex bulk message sent to a group of recipients with unique merge data per recipient.\n\n# Table of Contents\n* [Prerequisites and Installation](#prerequisites-and-installation)\n* [Getting Started](#getting-started)\n* [Managing API Keys](#managing-api-keys)\n* [Examples and Use Cases](#examples-and-use-cases)\n* [License](#license)\n\n\n\u003ca name=\"prerequisites-and-installation\"\u003e\u003c/a\u003e\n# Prerequisites and Installation\n## Prerequisites\n* A supported Node.js version (`6.0` or higher)\n* A SocketLabs account. If you don't have one yet, you can [sign up for a free account](https://signup.socketlabs.com/step-1?plan=free) to get started.\n\n## Installation\nFor most uses we recommend installing the SocketLabs Email Delivery package via [npm](https://npmjs.org). If you already have a supported version of Node.js,\nthen it should have included npm automatically. To install the package to your current project, simply type the following in your terminal or command prompt:\n\n```\n\u003e npm install --save @socketlabs/email\n```\n\nAlternately, you can simply [clone this repository](https://github.com/socketlabs/socketlabs-nodejs.git) directly to include the source code in your project.\n\n\u003ca name=\"getting-started\"\u003e\u003c/a\u003e\n# Getting Started\n## Obtaining your API Key and SocketLabs ServerId number\nIn order to get started, you'll need to enable the Injection API feature in the [SocketLabs Control Panel](https://cp.socketlabs.com).\nOnce logged in, navigate to your SocketLabs server's dashboard (if you only have one server on your account you'll be taken here immediately after logging in).\nMake note of your 4 or 5 digit ServerId number, as you'll need this along with\nyour API key in order to use the Injection API.\n\nTo enable the Injection API, click on the \"For Developers\" dropdown on the top-level navigation, then choose the \"Configure HTTP Injection API\" option.\nOnce here, you can enable the feature by choosing the \"Enabled\" option in the\ndropdown. Enabling the feature will also generate your API key, which you'll\nneed (along with your ServerId) to start using the API. Be sure to click the\n\"Update\" button to save your changes once you are finished.\n\n## Basic Message\nA basic message is an email message like you'd send from a personal email client such as Outlook.\nA basic message can have many recipients, including multiple To addresses, CC addresses, and even BCC addresses.\nYou can also send a file attachment in a basic message.\n\n```js\nconst {SocketLabsClient} = require('@socketlabs/email');\n\nconst client = new SocketLabsClient(parseInt(process.env.SOCKETLABS_SERVER_ID), process.env.SOCKETLABS_INJECTION_API_KEY);\n\nconst message = {\n    to: \"recipient@example.com\",\n    from: \"sender@example.com\",\n    subject: \"Hello from Node.js\",\n    textBody: \"This message was sent using the SocketLabs Node.js library!\",\n    htmlBody: \"\u003chtml\u003eThis message was sent using the SocketLabs Node.js library!\u003c/html\u003e\",\n    messageType: 'basic'\n}\n\nclient.send(message);\n```\n\nA basic message supports up to 50 recipients and supports several different ways to add recipients. We've also provided several helper classes\nto help you construct your message more easily:\n\n```js\nconst {SocketLabsClient, BasicMessage, EmailAddress} = require('@socketlabs/email');\n\nconst client = new SocketLabsClient(parseInt(process.env.SOCKETLABS_SERVER_ID), process.env.SOCKETLABS_INJECTION_API_KEY);\n\n//Instantiate the BasicMessage class to use built-in properties and helper methods. No need to set the messageType when using\n//the helper classes.\nlet basicMessage = new BasicMessage();\n\nbasicMessage.from = \"sender@example.com\";\nbasicMessage.subject = \"Hello from Node.js\";\nbasicMessage.textBody = \"This message was sent using the SocketLabs Node.js library!\";\n\n//Add a recipient by pushing a string to the To array\nbasicMessage.to.push(\"recipient1@example.com\");\n\n//Add a recipient by pushing an object literal to the To array\nbasicMessage.to.push({emailAddress: \"recipient2@example.com\", friendlyName: \"Recipent #2\"});\n\n//Add a recipient by pushing an EmailAddress object to the To array\nbasicMessage.to.push(new EmailAddress(\"recipient3@example.com\", { friendlyName: \"Recipient #3\" }));\n\n//Use the helper method on the instantiated BasicMessage\nbasicMessage.addToEmailAddress(\"recipient4@example.com\", \"Recipient #4\");\n\n//CC and BCC addresses have all of the same options\nbasicMessage.cc.push(\"cc@example.com\");\nbasicMessage.addBccEmailAddress(\"bccRecipient@example.com\");\n\nclient.send(message);\n```\n\n## Bulk Message\nA bulk message usually contains a single recipient per message\nand is generally used to send the same content to many recipients,\noptionally customizing the message via the use of MergeData.\nFor more information about using Merge data, please see the [Injection API documentation](https://www.socketlabs.com/api-reference/injection-api/#merging).\n```js\nconst {SocketLabsClient, BulkMessage, BulkRecipient} = require('@socketlabs/email');\n\nconst client = new SocketLabsClient(parseInt(process.env.SOCKETLABS_SERVER_ID), process.env.SOCKETLABS_INJECTION_API_KEY);\n\nlet bulkMessage = new BulkMessage();\n\nbulkMessage.textBody = \"Is your favorite color still %%FavoriteColor%%?\";\nbulkMessage.htmlBody = \"\u003chtml\u003eIs your favorite color still %%FavoriteColor%%?\";\nbulkMessage.subject = \"Sending a Bulk Message With Merge Fields\";\nbulkMessage.setFrom(\"from@example.com\");\n\n//Use built-in classes and helper methods\nlet recipient1 = new BulkRecipient(\"recipient1@example.com\");\nrecipient1.addMergeData(\"FavoriteColor\", \"Green\");\nbulkMessage.to.push(recipient1);\n\n//Use object literals\nconst recipient2 = {\n    emailAddress: \"recipient2@example.com\",\n    friendlyName: \"Recipient #2\",\n    mergeData: [\n        { key: \"FavoriteColor\", value: \"Orange\" }\n    ]\n});\n\nbulkMessage.to.push(recipient2);\n\nclient.send(bulkMessage);\n```\n\n\u003ca name=\"managing-api-keys\"\u003e\u003c/a\u003e\n## Managing API Keys\nFor ease of demonstration, some of our examples may include the ServerId and API\nkey directly in our code sample. Generally it is not considered a good practice\nto store sensitive information like this directly in your code. In most cases\nwe recommend the use of [Environment Variables](https://medium.freecodecamp.org/heres-how-you-can-actually-use-node-environment-variables-8fdf98f53a0a).\n\n\n\u003ca name=\"examples-and-use-cases\"\u003e\u003c/a\u003e\n# Examples and Use Cases\nIn order to demonstrate the many possible use cases for the Node.js library, we've provided\nan assortment of code examples. These examples demonstrate many different\nfeatures available to the Injection API and Node.js library, including using templates\ncreated in the [SocketLabs Email Designer](https://www.socketlabs.com/blog/introducing-new-email-designer/), custom email headers, sending\nattachments, sending content that is stored in an HTML file, advanced bulk\nmerging, and even pulling recipients from a datasource.\n\n### [Basic send from SocketLabs Template](https://github.com/socketlabs/socketlabs-nodejs/blob/master/examples/basic/basicSendWithApiTemplate.js)\nThis example demonstrates the sending of a piece of content that was created in the\nSocketLabs Email Designer. This is also known as the [API Templates](https://www.socketlabs.com/blog/introducing-api-templates/) feature.\n\n### [Basic send from HTML file](https://github.com/socketlabs/socketlabs-nodejs/blob/master/examples/basic/basicSendFromHtmlFile.js)\nThis example demonstrates how to read in your HTML content from an HTML file\nrather than passing in a string directly.\n\n### [Basic send with file attachment](https://github.com/socketlabs/socketlabs-nodejs/blob/master/examples/basic/basicSendWithAttachment.js)\nThis example demonstrates how to add a file attachment to your message.\n\n### [Basic send with embedded image](https://github.com/socketlabs/socketlabs-nodejs/blob/master/examples/basic/basicSendWithEmbeddedImage.js)\nThis example demonstrates how to embed an image in your message.\n\n### [Basic send with specified character set](https://github.com/socketlabs/socketlabs-nodejs/blob/master/examples/basic/basicSendWithASCIICharset.js)\nThis example demonstrates sending with a specific character set.\n\n### [Basic send with custom email headers](https://github.com/socketlabs/socketlabs-nodejs/blob/master/examples/basic/basicSendWithCustomHeaders.js)\nThis example demonstrates how to add custom headers to your email message.\n\n### [Basic send with a web proxy](https://github.com/socketlabs/socketlabs-nodejs/blob/master/examples/basic/basicSendWithProxy.js)\nThis example demonstrates how to use a proxy with your HTTP client.\n\n### [Basic send with retry enabled](https://github.com/socketlabs/socketlabs-nodejs/blob/master/examples/basic/basicSendWithRetry.js)\nThis example demonstrates how to use the retry logic with your HTTP client.\n\n### [Basic send complex example](https://github.com/socketlabs/socketlabs-nodejs/blob/master/examples/basic/basicSendComplexExample.js)\nThis example demonstrates many features of the Basic Send, including adding multiple recipients, adding message and mailing id's, and adding an embedded image.\n\n### [Basic send with Amp ](https://github.com/socketlabs/socketlabs-nodejs/blob/main/examples/basic/basicSendWithAmpBodyExample.js)\nThis example demonstrates how to send a basic message with an AMP Html body.\nFor more information about AMP please see [AMP Project](https://amp.dev/documentation/)\n\n### [Basic send with invalid file attachment](https://github.com/socketlabs/socketlabs-nodejs/blob/master/examples/basic/invalid/basicSendWithInvalidAttachment.js)\nThis example demonstrates the results of attempting to do a send with an invalid attachment.\n\n### [Basic send with invalid from address](https://github.com/socketlabs/socketlabs-nodejs/blob/master/examples/basic/invalid/basicSendWithInvalidFrom.js)\nThis example demonstrates the results of attempting to do a send with an invalid from address.\n\n### [Basic send with invalid recipients](https://github.com/socketlabs/socketlabs-nodejs/blob/master/examples/basic/invalid/basicSendWithInvalidRecipients.js)\nThis example demonstrates the results of attempting to do a send with invalid recipients.\n\n### [Bulk send with multiple recipients](https://github.com/socketlabs/socketlabs-nodejs/blob/master/examples/bulk/bulkSend.js)\nThis example demonstrates how to send a bulk message to multiple recipients.\n\n### [Bulk send with complex merge including attachments](https://github.com/socketlabs/socketlabs-nodejs/blob/master/examples/bulk/bulkSendComplexExample.js)\nThis example demonstrates many features of the `BulkMessage()`, including\nadding multiple recipients, merge data, and adding an attachment.\n\n### [Bulk send with recipients pulled from a datasource](https://github.com/socketlabs/socketlabs-nodejs/blob/master/examples/bulk/bulkSendFromDataSourceWithMerge.js)\nThis example uses a mock repository class to demonstrate how you would pull\nyour recipients from a database and create a bulk mailing with merge data.\n\n### [Bulk send with Ascii charset and special characters](https://github.com/socketlabs/socketlabs-nodejs/blob/master/examples/bulk/bulkSendWithASCIICharsetMergeData.js)\nThis example demonstrates how to send a bulk message with a specified character\nset and special characters.\n\n### [Bulk send with Amp ](https://github.com/socketlabs/socketlabs-nodejs/blob/main/examples/bulk/bulkSendWithAmpBodyExample.js)\nThis example demonstrates how to send a bulk message with an AMP Html body.\nFor more information about AMP please see [AMP Project](https://amp.dev/documentation/)\n\n\u003ca name=\"version\"\u003e\u003c/a\u003e\n* 1.4.4 - Added MetadataOrTagsAreTooLarge error messsage\n* 1.4.0 - Adding Metadata and Tags\n* 1.2.1 - Adding optional retry logic for Http requests. If configured, the request will retry when certain 500 errors occur (500, 502, 503, 504)\n* 1.1.1 - Adding request timeout value on the client for Http requests\n* 1.1.0 - Adds Amp Html Support\n* 1.0.0 - Initial Release\n\n\u003ca name=\"license\"\u003e\u003c/a\u003e\n# License\nThe SocketLabs Node.js library and all associated code, including any code samples, are [MIT Licensed](https://github.com/socketlabs/socketlabs-nodejs/blob/master/LICENSE.MD).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsocketlabs%2Fsocketlabs-nodejs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsocketlabs%2Fsocketlabs-nodejs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsocketlabs%2Fsocketlabs-nodejs/lists"}