Socket
Socket
Sign inDemoInstall

trenalyze

Package Overview
Dependencies
1
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    trenalyze

A whatsApp API for sending whatsapp Messages with your own custom phone number


Version published
Weekly downloads
7
Maintainers
1
Created
Weekly downloads
 

Readme

Source

trenalyze

Author | Docs

Library Prerequisites

  1. Node >= 12x
  2. WhatsApp account.
  3. Active Token - Get a Token here.

Installation

Using npm:

$ npm i trenalyze

Note: add --save if you are using npm < 5.0.0

In Node.js:

Note: You'll need to require the Trenalyze npm Module after installation

// Load the full build.
const Trenalyze = require('trenalyze');

API

1. new Trenalyze(token, sender, true)

ParamTypeDescription
tokenstringUse your Trenalyze Token from your Dashboard.
senderintergerEnter the WhatApp Number that has already be scanned on the Trenalyze Dashboard.
debugboolean(OPTIONAL). Default is false. But you can set to be true and the debug message is passed onto the console.
// Set The Config
const wa = new Trenalyze(YOUR_TRENALYZE_TOKEN_HERE, YOUR_WHATASPP_NUMBER_HERE, true);

Note: Phone number should be in following format 12345678912, without + or any other symbols

2. Initialize needed params in an array

ParamTypeDescription
receiverintergerPhone number should be in following format 12345678912, without + or any other symbols.
messageintergerEnter the desired text message to send.
mediaurlstring(OPTIONAL). BUT MUST BE DECLARED This should be a valid media/file link. Learn More
buttonsarray(OPTIONAL). BUT MUST BE DECLARED You can attach quick replies buttons to your message. Learn More
// Set the Required Parameters for sending message 
const details = {
    receiver: '123456789',
    message: 'Hello World',
    mediaurl: 'https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png',
    buttons: [{
        text: 'Click Me',
        url: 'https://trenalyze.com'
    }]
}

NOTE: When not using mediaurl and buttons set to NULL

mediaurl: '',
buttons: ''

3. Initialize SendMessage

ParamTypeDescription
detailsarray(variable)Send the variable declared in step 2
// Initialize the send whatsapp message functions
wa.sendMessage(details, (error, data) => {
    if (data.statusCode !== 200) {
        console.log('Error: ' + data.statusMessage);
    } else {
        console.log('Success ' + data.statusMessage);
    }
});

Keywords

FAQs

Last updated on 06 Aug 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc