1.0.6 • Published 1 year ago
yonoma_email_marketing v1.0.6
Yonoma Node.js Email Marketing SDK
Install
npm install yonoma_email_marketingSetup
First, you need to get an API key:
import { Yonoma } from "yonoma_email_marketing";
// commonjs
const { Yonoma } = require("yonoma_email_marketing");
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',
});Groups
Create new group
await yonoma.groups.create({ group_name: "New group" });Get list of groups
await yonoma.groups.list();Get one group
await yonoma.groups.retrieve("Group id");Update group
await yonoma.groups.update("Group id", { group_name: "Updated group name" });Delete group
await yonoma.groups.delete("Group 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("Group id", {
email: "email@example.com",
status: "Subscribed" | "Unsubscribed",
data: {
firstName: string,
lastName: string,
phone: string,
gender: string,
address: string,
city: string,
state: string,
country: string,
zipcode: string,
}
});Update contact
await yonoma.contacts.update("Group 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",
});