@sheilim/shimli-sdk
Advanced tools
Comparing version 1.0.4 to 1.0.5
24
index.js
@@ -86,2 +86,26 @@ const axios = require('axios'); | ||
}, | ||
sendWhBusinessApi: (type, body, to, instance, caption = null) => { | ||
return new Promise(async (resolve, reject) => { | ||
if(!config.token){ | ||
resolve({ | ||
error: true, | ||
txt: 'Configurate Token' | ||
}) | ||
} | ||
let data_ = { | ||
"token": config.token, | ||
"type": type, | ||
"body": body, | ||
"to": to, | ||
"instance": instance | ||
}; | ||
if(caption) | ||
data_['caption'] = caption; | ||
const result = await connectShimli( | ||
'https://api.shimli.app/v1/whatsapp-api', | ||
data_ | ||
); | ||
resolve(result); | ||
}) | ||
}, | ||
leadInsert: (to, instance, text, channel = 'whatsapp', area = null, agent = null, process = null, tags = null) => { | ||
@@ -88,0 +112,0 @@ return new Promise(async (resolve, reject) => { |
{ | ||
"name": "@sheilim/shimli-sdk", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"description": "API for sending WhatsApp, CRM, chatbot and more channels such as Facebook Messenger, Instagram and Telegram", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -59,2 +59,24 @@ # shimli-sdk | ||
## Send WhatsApp Business API | ||
``` | ||
const shimli = require('@sheilim/shimli-sdk'); | ||
(function(){ | ||
shimli.config['token'] = "YOUR_TOKEN"; | ||
const result = await sendWhBusinessApi.sendFbMessenger("text", "Hi!! 👋", "14243962506", "ID_INSTANCE"); | ||
if(result.error) | ||
console.log(result.message); | ||
else | ||
console.log(result); | ||
})(); | ||
``` | ||
## Options sendWhBusinessApi | ||
* *type* - _string_ I could be text, image, video, audio, document | ||
* *body* - _string_ Message text or url of the media file to send | ||
* *to* - _string_ WhatsApp number to which the message will be sent | ||
* *instance* - _string_ Id of the instance connected to Shimli | ||
* *caption* - _string_ (optional) Image or video caption | ||
## Add Lead to Shimli | ||
@@ -61,0 +83,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8266
137
104