@shoppredigital/omniengage
v0.0.12
Published
Email with AWS SES or ShoppRe SES, Chat with Socket.io, WhatsApp, OneSignal, Firebase Cloud Messaging, Email Preferences
Downloads
5
Readme
OmniEngage
Javascript Client SDK for OmniEngage Server
Getting Started
You need to install OmniEngage and set API credentials before you get started
If you not installed yet, you can install using below options
Installation
npm i @shoppredigital/omniengage -S
Usage
for building emails for developers in command line
{
"scripts": {
"event:fire": "OMNIENGAGE_URL=https://engage.yourdomain.com ./node_modules/.bin/omniengage events",
"email-build": "OMNIENGAGE_URL=https://engage.yourdomain.com ./node_modules/.bin/omniengage build",
"email-update-send": "OMNIENGAGE_URL=https://engage.yourdomain.com ./node_modules/.bin/omniengage update-send",
"email-deploy": "OMNIENGAGE_URL=https://engage.yourdomain.com DEBUG=q-* ./node_modules/.bin/omniengage deploy"
}
}
for sending emails from nodejs
if (!process.env.OMNIENGAGE_URL) {
process.env.OMNIENGAGE_URL = 'https://engage.yourdomain.com';
}
const { ses } = require('@shoppredigital/omniengage');
const { FROM_EMAIL = '[email protected]' } = process.env;
const customer = {
email: '[email protected]',
};
ses.sendTemplatedEmail({
Source: `"OmniEngage" <${FROM_EMAIL}>`,
Destination: {
ToAddresses: [customer.email],
},
Template: 'user_signup',
TemplateData: JSON.stringify({
customer,
}),
})
const { comment, user } = require('@shoppredigital/omniengage');
// Register a user
user.signup({
id: userId,
first_name: 'Vikas',
last_name: 'Kumar',
email: '[email protected]',
});
// Sending Chat Message from Server
comment.create({
object_id: 1,
user_id: userId,
state_id: 1,
comments: 'Lead Completed',
}, 'leads')