@zapfacil/mega-api
v1.0.16
Published
This lib integrate with Mega api service.
Downloads
2
Readme
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.