Skip to content

The official Node.js client library for the Yonoma API

Notifications You must be signed in to change notification settings

YonomaHQ/yonoma-node

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Yonoma Node.js Email Marketing SDK

Install

npm install yonoma

Setup

First, you need to get an API key:

import { Yonoma } from "yonoma";

// commonjs
const { Yonoma } = require("yonoma");

const yonoma = new Yonoma("YOUR_API_KEY");

Usage

Send your email:

await yonoma.email.send({
  from_email: 'email@example.com',
  to_email: 'to@example.com',
  subject: 'From Yonoma.io',
  mail_template: 'Everything is working',
});

Lists

Create new list

await yonoma.lists.create({ list_name: "New list" });

Get list of lists

await yonoma.lists.list();

Get one list

await yonoma.lists.retrieve("List id");

Update list

await yonoma.lists.update("List id", { list_name: "Updated list name" });

Delete list

await yonoma.lists.delete("List id");

Tags

Create new tag

await yonoma.tags.create({ tag_name: "New tag" });

Get list of tags

await yonoma.tags.list();

Get one tag

await yonoma.tags.retrieve("Tag id");

Update tag

await yonoma.tags.update("Tag id", { tag_name: "Updated tag name" });

Delete tag

await yonoma.tags.delete("Tag id");

Contacts

Create new contact

await yonoma.contacts.create("List id", { 
  email: "email@example.com",
  status: "Subscribed" | "Unsubscribed",
  firstName: string, //optional
  lastName: string, //optional
  phone: string, //optional
  gender: string, //optional
  address: string, //optional
  city: string, //optional
  state: string, //optional
  country: string, //optional
  zipcode: string //optional
});

Update contact

await yonoma.contacts.update("List id", "Contact id", {
  status: "Subscribed" | "Unsubscribed",
});

Add tag to contact

await yonoma.contacts.addTag("Contact id", {
  tag_id: "Tag id",
});

Remove tag from contact

await yonoma.contacts.removeTag("Contact id", {
  tag_id: "Tag id",
});

About

The official Node.js client library for the Yonoma API

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published