GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - sendable/sendable-node: Sendable for Node.js

BranchesTags
Open more actions menu

Latest commit

 

History

15 Commits
15 Commits

Folders and files

NameName
Last commit message
Last commit date
src
src
 
 
tests
tests
 
 
.gitignore
.gitignore
 
 
.travis.yml
.travis.yml
 
 
CONTRIBUTING.md
CONTRIBUTING.md
 
 
README.md
README.md
 
 
nwb.config.js
nwb.config.js
 
 
package-lock.json
package-lock.json
 
 
package.json
package.json
 
 

Repository files navigation

Sendable Node Client

Installation

npm install sendable

Setup

You can either use the environment variables, or configure the client manually.

Option 1 - Environment Variable

Add the following environment variable to your application. You can get your API key from the project settings page of your Sendable dashboard.

SENDABLE_API_KEY=YOUR API KEY

Option 2 - Manual Configuration

If you don't want to set an environment variable, use the following code:

const { Client } = require('sendable')
const sendable = new Client('<SENDABLE_API_KEY>')

Usage

Render Method

The render method renders your email template and returns the HTML in response. It accepts two arguments and returns a Promise object.

  • template - integer - This is your Sendable email template id
  • params - object - Object containing the following keys
    • data - object - Any email template data that will replace the email template variables

Render Request

const { Sendable } = require('sendable')

return Sendable.render(
  123, {
    data: {
      firstName: "John",
      age: 28
    },
  }
).then(result => {
  // response goes here
})

Render Response

{
  success: true,
  email: {
    html: "<html><head></head><body><h1>Sample HTML</h1></body></html>",
    plain: "Sample Plain Text",
    subject: "Sample Subject",
    preheader: "Sample Preheader"
  }
}

Email Method

The email method sends the email using your configured SMTP mailer in Sendable. It accepts two arguments and returns a Promise object.

  • template - integer - This is your Sendable template id
  • params - object - Object containing the following keys
    • to - string - This is the recipient's email address
    • from - string - This is the sender's email address
    • data - object - Any email template data that will replace the email template variables

Email Request

const { Sendable } = require('sendable')

return Sendable.email(
  123, {
    from: '[email protected]',
    to: '[email protected]',
    data: {
      firstName: "John",
      age: 28
    },
  }
).then(result => {
  // response goes here
})

Email Response

{
  success: true,
  email: {
    html: "<html><head></head><body><h1>Sample HTML</h1></body></html>",
    plain: "Sample Plain Text",
    subject: "Sample Subject",
    preheader: "Sample Preheader"
  },
  delivery: {}
}

The delivery key contains the response from your ESP.

About

Sendable for Node.js

Resources

Readme

Contributing

Contributing
Activity
Custom properties

Stars

1 star

Watchers

2 watching

Forks

0 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.