Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gzappy-js

Package Overview
Dependencies
Maintainers
0
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gzappy-js - npm Package Compare versions

Comparing version 0.0.16 to 0.0.17

34

dist/index.d.ts

@@ -7,2 +7,36 @@ declare class GzappyClient {

constructor({ token, instanceId }: GzappyClientOptions);
createInstance(instance_name: string): Promise<{
qr: string;
} | {
error: string;
}>;
listInstances(): Promise<{
data: {
instance_name: string;
instance_status: string;
instance_id: string;
}[];
} | {
error: string;
}>;
restoreInstance(instance_id: string): Promise<{
qr: string;
} | {
error: string;
}>;
deleteInstance(instance_id: string): Promise<{
msg: string;
} | {
error: string;
}>;
disconnectInstance(instance_id: string): Promise<{
msg: string;
} | {
error: string;
}>;
editInstance(instance_id: string, instance_name: string, webhook_receivement_message_url?: string): Promise<{
msg: string;
} | {
error: string;
}>;
sendMessage(messages: string[], phones: string[]): Promise<any>;

@@ -9,0 +43,0 @@ sendMedia(message: string, mediaUrl: string, phones: string[]): Promise<any>;

@@ -60,2 +60,78 @@ "use strict";

}
// Instances
async createInstance(instance_name) {
try {
const response = await this.api.post("/instances/add", {
instance_name
});
return response.data;
} catch (error) {
return {
error: error.response.data.msg
};
}
}
async listInstances() {
try {
const response = await this.api.get("/instances/list");
return response.data;
} catch (error) {
return {
error: error.response.data.msg
};
}
}
async restoreInstance(instance_id) {
try {
const response = await this.api.patch("/instances/restore", {
instance_id
});
return response.data;
} catch (error) {
return {
error: error.response.data.msg
};
}
}
async deleteInstance(instance_id) {
try {
const response = await this.api.delete("/instances/delete", {
data: {
instance_id
}
});
return response.data;
} catch (error) {
return {
error: error.response.data.msg
};
}
}
async disconnectInstance(instance_id) {
try {
const response = await this.api.patch("/instances/disconnect", {
instance_id
});
return response.data;
} catch (error) {
return {
error: error.response.data.msg
};
}
}
async editInstance(instance_id, instance_name, webhook_receivement_message_url) {
try {
const response = await this.api.patch("/instances/update", {
instance_name,
instance_id,
webhook_receivement_message_url
});
return response.data;
} catch (error) {
return {
error: error.response.data.msg
};
}
}
// Messages
async sendMessage(messages, phones) {

@@ -62,0 +138,0 @@ if (messages.some((message) => message === "")) {

2

package.json
{
"name": "gzappy-js",
"version": "0.0.16",
"version": "0.0.17",
"description": "gzappy-js é um pacote JavaScript que facilita a integração com a API de WhatsApp da gzappy.com",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -18,7 +18,7 @@ <div align="center">

- **Agendamento de mensagens** ✅
- Criar instância ⏱️
- Listar instâncias ⏱️
- Editar instância ⏱️
- Desconectar instância ⏱️
- Reconectar instância ⏱️
- **Criar instância** ✅
- **Listar instâncias** ✅
- **Editar instância** ✅
- **Desconectar instância** ✅
- **Reconectar instância** ✅
- Novo lead ⏱️

@@ -52,6 +52,2 @@ - Listar leads ⏱️

## Uso
Este é um exemplo simples de como configurar e usar esta biblioteca. Você pode ler mais em [https://docs.gzappy.com](https://docs.gzappy.com).
```js

@@ -67,8 +63,86 @@ // Importação do módulo gzappy-js

const gClient = new gzappy({ token, instanceId })
```
## Uso
Este é um exemplo simples de como configurar e usar esta biblioteca. Você pode ler mais em [https://docs.gzappy.com](https://docs.gzappy.com).
## INSTANCIAS
### Listar instâncias
```js
// Listando instancias
gClient
.listInstances()
.then((response) => console.log(response))
.catch((error) => console.error(error))
```
### Criar instância
```js
// Listando instancias
gClient
.createInstance('Minha primeira instância')
.then((response) => console.log(response))
.catch((error) => console.error(error))
```
### Restaurar instância
```js
const INSTANCE_ID = 'ID DA INSTANCIA'
// Listando instancias
gClient
.restoreInstance(INSTANCE_ID)
.then((response) => console.log(response))
.catch((error) => console.error(error))
```
### Deletar instância
```js
const INSTANCE_ID = 'ID DA INSTANCIA'
// Listando instancias
gClient
.deleteInstance(INSTANCE_ID)
.then((response) => console.log(response))
.catch((error) => console.error(error))
```
### Desconectar instância
```js
const INSTANCE_ID = 'ID DA INSTANCIA'
// Listando instancias
gClient
.disconnectInstance(INSTANCE_ID)
.then((response) => console.log(response))
.catch((error) => console.error(error))
```
### Editar instância
```js
const INSTANCE_ID = 'ID DA INSTANCIA'
const WEBHOOK_URL = 'https://example.com/webhook'
// Listando instancias
gClient
.editInstance(INSTANCE_ID, 'Novo nome da instância', WEBHOOK_URL)
.then((response) => console.log(response))
.catch((error) => console.error(error))
```
## MENSAGENS
### Envio mensagens
```js
// Enviando mensagens
const messages = [
'Olá, tudo bem?',
'Você tem um novo agendamento marcado, Sr Cliente',
]
const messages = ['Você tem um novo agendamento marcado, Sr Cliente']
const phones = ['5511999999999']

@@ -82,3 +156,3 @@

## Envio de mídias
### Envio de mídias

@@ -95,3 +169,3 @@ ```js

## Envio de Mensagens para Grupos
### Envio de Mensagens para Grupos

@@ -107,3 +181,3 @@ ```js

## Agendamento de Mensagens
### Agendamento de Mensagens

@@ -110,0 +184,0 @@ ```js

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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