1.0.16 • Published 2 years ago

@zapfacil/mega-api v1.0.16

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

Mega API

This lib integrate with Mega api service.

Examples

import MegaApi from '@zapfacil/mega-api';

const arrayOfInstances = {
  60000: 'http://url1',
  60200: 'http://url2',
  60400: 'http://url3',
  60600: 'http://url4',
  60800: 'http://url5',
  61000: 'http://url6',
  61200: 'http://url7',
  61400: 'http://url8',
  61600: 'http://url9',
};

const megaApi = new MegaAPi({ arrayOfInstances, verbose: boolean });

const response = await megaApi.sendMessage({
    instance: 'botInstance',
    message: 'This is a message to send',
    phoneNumber: 'phoneNumber',
    token: 'botToken',
});

const sendMessageTemplate = await megaApi.sendButtonTemplate({
      type: 'text' | 'image' | 'video' | 'document',
      caption: 'Select an option',
      footer: 'Title if type text',
      buttons: [
        {
          index: 1,
          urlButton: {
            displayText: 'link text',
            url: 'https://www.lipsum.com',
          },
        },
        {
          index: 2,
          callButton: {
            displayText: 'Jhon doe',
            phoneNumber: '559912341234',
          },
        },
        {
          index: 3,
          quickReplyButton: {
            displayText: 'Reply',
            id: 'button-sim',
          },
        },
      ],
      phoneNumber: '559912341234',
      instance: '12345',
      token: 'token',
      body: 'if !== text, paste url here',
    });

    const sendMessage = await megaApi.sendButtonMessage({
      type: 'text' | 'image' | 'video' | 'document',
      caption: 'Select an option',
      displayText: 'This is a message test',
      buttons: ['Yes', 'Not', 'Whatever'],
      phoneNumber: '559912341234',
      instance: '12345',
      token: 'token',
      body: 'if !== text, paste url here',
    });

    const sendFile = await megaApi.sendFile({
      instance: 'botInstance',
      token: 'botToken',
      phoneNumber: 'phoneNumber',
      caption: 'This is a message to send',
      fileName: 'fileName.jpeg',
      body: 'http://idsolucoesweb.com.br/rcenter/mes2.jpeg',
    })

Few words

  • this lib is for multi device.
1.0.16

2 years ago

1.0.15

2 years ago

1.0.14

2 years ago

1.0.13

2 years ago

1.0.12

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago