Skip to content

SDK for interacting with SendinCraft in Node.js

Notifications You must be signed in to change notification settings

sendincraft/node

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 

Repository files navigation

SendinCraft Node SDK

This project contains the helper library for interacting with the SendinCraft API using Node.js.

Table of contents

Card

Installation

Installing the latest version can be done through your package manager.

npm i @sendincraft/node

yarn add @sendincraft/node

Getting started

Any interaction you want to make with the SendinCraft API needs to be done through the SendinCraft client. You can use a default import to get started.

import SendinCraft from '@sendincraft/node';

const sendincraft = new SendinCraft("Your secret key");

API

Events

track()

Used to publish an event

Parameters
  • event: The name of the event to publish
  • email: The email address of the user to publish the event to
  • subscribed [Optional]: Whether to the contact is subscribed to marketing emails, defaults to true
  • data [Optional]: An object containing the data to attach to the user
const success = await sendincraft.events.track({
  event: "new-project",
  email: "hello@sendincraft.com",
  data: {
    company: "SendinCraft Inc"
  }
});

Emails

send()

Used to send a transactional email

Parameters
  • to: The email address of the recipient
  • subject: The subject of the email
  • body: The body of the email
  • type [Optional]: The type of email to send (html or markdown)
  • from [Optional]: The email address of the sender
  • name [Optional]: The name of the sender
  • subscribed [Optional]: Whether to the contact is subscribed to marketing emails, defaults to false
const success = await sendincraft.emails.send({
  to: "hello@sendincraft.com",
  subject: "Welcome to SendinCraft",
  body: "Hello world!",
});

About

SDK for interacting with SendinCraft in Node.js

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published