1.0.13 • Published 2 years ago

supermeteor v1.0.13

Weekly downloads
1
License
ISC
Repository
github
Last release
2 years ago

Supermeteor

npm version install size npm downloads

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"
}