supermeteor
v1.1.2
Published
[![npm version](https://img.shields.io/npm/v/supermeteor.svg?style=flat-square)](https://www.npmjs.org/package/supermeteor) [![install size](https://packagephobia.now.sh/badge?p=supermeteor)](https://packagephobia.now.sh/result?p=supermeteor) [![npm downl
Downloads
13
Readme
Supermeteor
Supermeteor is Node Js SDK use to send SMS message and email.
How to use:
install using npm
npm install supermeteor
include supermeter in your file
const supermeteor = require('supermeteor')('SECRET_KEY');
Package uses axios for HTTP request, so for function use "async" prefix and for mathod use "await" prefix.
1. For sending sms:
pass secret key, type, phone, message as function parameter, Here is the sample function call for send sms.
Type must be: sms or whatsapp
await supermeteor.sendMessage('sms|whatsapp','phone','message');
2. For sending email:
pass secret key, email, subject, message as function parameter, Here is the sample function call for send email.
await supermeteor.sendEmail('email','subject','message');
Incoming webhook
Inbound message hook is available in real-time, and setting is in the Setting Page.
Here are the examples of webhook data. The webhook is sent in POST method with JSON body
receiving a message
{
"_id": "62996851a0b5be00127052cd",
"accountId": "5ccbdc9bd7b320fe8c4e119d",
"createdAt": "2022-06-03T01:48:01.459Z",
"channel": "whatsapp",
"type": "incoming",
"status": "SUCCESS",
"phoneCountryCode": "852",
"phoneNumber": "61112222",
"fromPhoneCountryCode": "852",
"fromPhoneNumber": "64447777",
"message": "this is testing message",
"quotedMessage": null
}
receiving an image
{
"_id": "6299686fa0b5be00127052cf",
"accountId": "5ccbdc9bd7b320fe8c4e119d",
"createdAt": "2022-06-03T01:48:31.941Z",
"channel": "whatsapp",
"type": "incoming",
"status": "SUCCESS",
"phoneCountryCode": "852",
"phoneNumber": "61112222",
"fromPhoneCountryCode": "852",
"fromPhoneNumber": "64447777",
"image": "https://supermeteor.s3-ap-southeast-1.amazonaws.com/2022/06/6299686fa0b5be00127052cf.png"
}
receiving a quoted message
{
"_id": "62996851a0b5be00127052ce",
"accountId": "5ccbdc9bd7b320fe8c4e119d",
"createdAt": "2022-06-03T01:48:01.460Z",
"channel": "whatsapp",
"type": "incoming",
"status": "SUCCESS",
"phoneCountryCode": "852",
"phoneNumber": "61112222",
"fromPhoneCountryCode": "852",
"fromPhoneNumber": "64447777",
"message": "this is quoted message",
"quotedMessage": "this is testing message"
}