Socket
Socket
Sign inDemoInstall

@sheilim/shimli-sdk

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sheilim/shimli-sdk - npm Package Compare versions

Comparing version 1.0.5 to 1.1.0

100

index.js

@@ -32,6 +32,6 @@ const axios = require('axios');

config: config,
sendWhatsApp: (type, body, to, instance, caption = null, filename = null,lat = null, lng = null) => {
sendWhatsApp: (message) => {
return new Promise(async (resolve, reject) => {
if(!config.token){
resolve({
return resolve({
error: true,

@@ -41,20 +41,30 @@ txt: 'Configurate Token'

}
let data_ = {
"token": config.token,
"type": type,
"body": body,
"to": to,
"instance": instance
};
if(caption)
data_['caption'] = caption;
if(filename)
data_['filename'] = filename;
if(lat)
data_['lat'] = lat;
if(lng)
data_['lng'] = lng;
message['token'] = config.token;
if(message.type == 'location'){
if(!message.lat || !message.lng){
return resolve({error: true, txt: 'It is necessary to send the latitude and longitude variables'});
}
}
if(message.type == 'buttons'){
if(!message.buttons){
return resolve({error: true, txt: 'The buttons variable is required'});
}
if(message.buttons.length == 0){
return resolve({error: true, txt: 'The buttons variable is required'});
}
if(message.buttons.length > 3){
return resolve({error: true, txt: 'Only a maximum of 3 items is allowed for buttons'});
}
if(!message.title || !message.footer){
return resolve({error: true, txt: 'You need to send the title and footer variables'});
}
}
if(message.type == 'lists'){
if(!message.sections || !message.title || !message.action){
return resolve({error: true, txt: 'You need to send the section, title and action variables'});
}
}
const result = await connectShimli(
'https://api.shimli.app/v1/msg-wh',
data_
message
);

@@ -64,6 +74,6 @@ resolve(result);

},
sendFbMessenger: (type, body, to, instance, caption = null) => {
sendFbMessenger: (message) => {
return new Promise(async (resolve, reject) => {
if(!config.token){
resolve({
return resolve({
error: true,

@@ -73,14 +83,6 @@ txt: 'Configurate Token'

}
let data_ = {
"token": config.token,
"type": type,
"body": body,
"to": to,
"instance": instance
};
if(caption)
data_['caption'] = caption;
message['token'] = config.token;
const result = await connectShimli(
'https://api.shimli.app/v1/facebook/send-messenger',
data_
message
);

@@ -90,6 +92,6 @@ resolve(result);

},
sendWhBusinessApi: (type, body, to, instance, caption = null) => {
sendWhBusinessApi: (message) => {
return new Promise(async (resolve, reject) => {
if(!config.token){
resolve({
return resolve({
error: true,

@@ -99,14 +101,6 @@ txt: 'Configurate Token'

}
let data_ = {
"token": config.token,
"type": type,
"body": body,
"to": to,
"instance": instance
};
if(caption)
data_['caption'] = caption;
message['token'] = config.token;
const result = await connectShimli(
'https://api.shimli.app/v1/whatsapp-api',
data_
message
);

@@ -116,6 +110,6 @@ resolve(result);

},
leadInsert: (to, instance, text, channel = 'whatsapp', area = null, agent = null, process = null, tags = null) => {
leadInsert: (lead) => {
return new Promise(async (resolve, reject) => {
if(!config.token){
resolve({
return resolve({
error: true,

@@ -125,20 +119,6 @@ txt: 'Configurate Token'

}
let data_ = {
"token": config.token,
"to": to,
"instance": instance,
"text": text,
"channel": channel
};
if(area)
data_['area'] = area;
if(agent)
data_['agent'] = agent;
if(process)
data_['process'] = process;
if(tags)
data_['tags'] = tags;
lead['token'] = config.token;
const result = await connectShimli(
'https://api.shimli.app/v1/crm',
data_
lead
);

@@ -145,0 +125,0 @@ resolve(result);

4

package.json
{
"name": "@sheilim/shimli-sdk",
"version": "1.0.5",
"description": "API for sending WhatsApp, CRM, chatbot and more channels such as Facebook Messenger, Instagram and Telegram",
"version": "1.1.0",
"description": "API for sending WhatsApp, CRM, chatbot and more channels such as Facebook Messenger and Telegram",
"main": "index.js",

@@ -6,0 +6,0 @@ "dependencies": {

@@ -19,3 +19,8 @@ # shimli-sdk

shimli.config['token'] = "YOUR_TOKEN";
const result = await shimli.sendWhatsApp("chat", "Hi!! 👋", "14243962506", "ID_INSTANCE");
const result = await shimli.sendWhatsApp({
"type": "chat",
"body": "Hi!! 👋",
"to": "14243962506",
"instance": "ID_INSTANCE"
});
if(result.error)

@@ -29,3 +34,3 @@ console.log(result.message);

## Options sendWhatsApp
* *type* - _string_ I could be chat, image, video, audio, location, document, sticker, gif
* *type* - _string_ I could be chat, image, video, audio, location, document, sticker, gif, buttons, lists
* *body* - _string_ Message text or url of the media file to send

@@ -46,3 +51,8 @@ * *to* - _string_ WhatsApp number to which the message will be sent

shimli.config['token'] = "YOUR_TOKEN";
const result = await shimli.sendFbMessenger("text", "Hi!! 👋", "PSID", "ID_INSTANCE");
const result = await shimli.sendFbMessenger({
"type": "text",
"body": "Hi!! 👋",
"to": "PSID",
"instance": "ID_INSTANCE"
});
if(result.error)

@@ -69,3 +79,8 @@ console.log(result.message);

shimli.config['token'] = "YOUR_TOKEN";
const result = await sendWhBusinessApi.sendFbMessenger("text", "Hi!! 👋", "14243962506", "ID_INSTANCE");
const result = await sendWhBusinessApi.sendFbMessenger({
"type": "text",
"body": "Hi!! 👋",
"to": "14243962506",
"instance": "ID_INSTANCE"
});
if(result.error)

@@ -92,3 +107,7 @@ console.log(result.message);

shimli.config['token'] = "YOUR_TOKEN";
const result = await shimli.leadInsert("ID_CLIENT", "ID_INSTANCE", "Insert Lead! 👋", "whatsapp");
const result = await shimli.leadInsert({
to: "ID_CLIENT",
instance: "ID_INSTANCE",
text: "Insert Lead! 👋", channel: "whatsapp"
});
if(result.error)

@@ -95,0 +114,0 @@ console.log(result.message);

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc