socialdesk-node 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +54 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# socialdesk-node
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/socialdesk-node)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
[](https://www.typescriptlang.org/)
|
|
6
|
+
|
|
7
|
+
SDK oficial de [Socialdesk](https://socialdesk.cr) para Node.js.
|
|
8
|
+
|
|
9
|
+
- Tipado completo en TypeScript
|
|
10
|
+
- Helper para parsear webhooks
|
|
11
|
+
- Cliente HTTP pre-autenticado
|
|
12
|
+
|
|
13
|
+
## Ejemplo
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import { WebhookHelper, EventType } from 'socialdesk-node';
|
|
17
|
+
|
|
18
|
+
app.post('/webhook', async (req, res) => {
|
|
19
|
+
const webhook = new WebhookHelper(req.body);
|
|
20
|
+
const client = webhook.createClient();
|
|
21
|
+
|
|
22
|
+
if (webhook.isEventType(EventType.DirectMessage)) {
|
|
23
|
+
await client.sendHintMessage({
|
|
24
|
+
text: 'El cliente preguntó por precios',
|
|
25
|
+
message_id: webhook.getMessageId(),
|
|
26
|
+
conversation_id: webhook.getConversationId(),
|
|
27
|
+
quick_replies: [
|
|
28
|
+
{ text: 'El Plan Básico cuesta $79/mes + IVA.' },
|
|
29
|
+
],
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
res.json({ ok: true });
|
|
34
|
+
});
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Funcionalidades
|
|
38
|
+
|
|
39
|
+
| Método | Descripción |
|
|
40
|
+
|---|---|
|
|
41
|
+
| `sendHintMessage` | Envía un mensaje visible solo para el agente |
|
|
42
|
+
| `sendDirectMessage` | Envía un mensaje directo al participante |
|
|
43
|
+
| `sendHSMMessage` | Envía un mensaje con plantilla (HSM) |
|
|
44
|
+
| `sendHintCallback` | Ejecuta un callback de un hint message |
|
|
45
|
+
| `assignConversation` | Asigna una conversación a un agente o equipo |
|
|
46
|
+
| `addLabel` | Agrega una etiqueta a una conversación |
|
|
47
|
+
|
|
48
|
+
## Documentación
|
|
49
|
+
|
|
50
|
+
[socialdesk-docs.web.app](https://socialdesk-docs.web.app)
|
|
51
|
+
|
|
52
|
+
## Licencia
|
|
53
|
+
|
|
54
|
+
MIT
|