@builderbot/provider-twilio 1.0.21-alpha.0 → 1.0.23-alpha.0
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/dist/index.cjs +121 -71
- package/dist/index.d.ts +12 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/server.d.ts +4 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/twilioInterface.d.ts +11 -0
- package/dist/twilioInterface.d.ts.map +1 -0
- package/dist/utils.d.ts +2 -1
- package/dist/utils.d.ts.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -30428,10 +30428,15 @@ var polka = opts => new Polka(opts);
|
|
|
30428
30428
|
var polka$1 = /*@__PURE__*/getDefaultExportFromCjs(polka);
|
|
30429
30429
|
|
|
30430
30430
|
const parseNumber = (number) => {
|
|
30431
|
-
return
|
|
30431
|
+
return number.replace(/(?:whatsapp:|\+\d+)/, '');
|
|
30432
|
+
};
|
|
30433
|
+
const parseNumberFrom = (number) => {
|
|
30434
|
+
const cleanNumber = number.replace(/whatsapp|:|\+/g, '');
|
|
30435
|
+
return `whatsapp:+${cleanNumber}`;
|
|
30432
30436
|
};
|
|
30433
30437
|
|
|
30434
|
-
const idCtxBot = 'ctx-bot';
|
|
30438
|
+
const idCtxBot = 'id-ctx-bot';
|
|
30439
|
+
const idBotName = 'id-bot';
|
|
30435
30440
|
/**
|
|
30436
30441
|
* Encargado de levantar un servidor HTTP con una hook url
|
|
30437
30442
|
* [POST] /twilio-hook
|
|
@@ -30439,6 +30444,23 @@ const idCtxBot = 'ctx-bot';
|
|
|
30439
30444
|
class TwilioWebHookServer extends node_events.EventEmitter {
|
|
30440
30445
|
constructor(twilioPort) {
|
|
30441
30446
|
super();
|
|
30447
|
+
this.getListRoutes = (app) => {
|
|
30448
|
+
try {
|
|
30449
|
+
const list = app.routes;
|
|
30450
|
+
const methodKeys = Object.keys(list);
|
|
30451
|
+
const parseListRoutes = methodKeys.reduce((prev, current) => {
|
|
30452
|
+
const routesForMethod = list[current].flat(2).map((i) => ({ method: current, path: i.old }));
|
|
30453
|
+
prev = prev.concat(routesForMethod);
|
|
30454
|
+
return prev;
|
|
30455
|
+
}, []);
|
|
30456
|
+
const unique = parseListRoutes.map((r) => `[${r.method}]: http://localhost:${this.port}${r.path}`);
|
|
30457
|
+
return [...new Set(unique)];
|
|
30458
|
+
}
|
|
30459
|
+
catch (e) {
|
|
30460
|
+
console.log(`[Error]:`, e);
|
|
30461
|
+
return [];
|
|
30462
|
+
}
|
|
30463
|
+
};
|
|
30442
30464
|
/**
|
|
30443
30465
|
* Mensaje entrante
|
|
30444
30466
|
* emit: 'message'
|
|
@@ -30515,29 +30537,24 @@ class TwilioWebHookServer extends node_events.EventEmitter {
|
|
|
30515
30537
|
.use(cors())
|
|
30516
30538
|
.use(bodyParserExports.urlencoded({ extended: true }))
|
|
30517
30539
|
.use(bodyParserExports.json())
|
|
30518
|
-
.post('/
|
|
30540
|
+
.post('/webhook', this.incomingMsg)
|
|
30519
30541
|
.get('/tmp', this.handlerLocalMedia);
|
|
30520
30542
|
}
|
|
30521
30543
|
/**
|
|
30522
30544
|
* Iniciar el servidor HTTP
|
|
30523
30545
|
*/
|
|
30524
|
-
start(vendor, port) {
|
|
30546
|
+
start(vendor, port, args, cb = () => null) {
|
|
30525
30547
|
if (port)
|
|
30526
30548
|
this.port = port;
|
|
30527
30549
|
this.server.use(async (req, _, next) => {
|
|
30528
30550
|
req[idCtxBot] = vendor;
|
|
30551
|
+
req[idBotName] = args?.botName ?? 'bot';
|
|
30529
30552
|
if (req[idCtxBot])
|
|
30530
30553
|
return next();
|
|
30531
30554
|
return next();
|
|
30532
30555
|
});
|
|
30533
|
-
this.
|
|
30534
|
-
|
|
30535
|
-
console.log(`[Twilio]: Agregar esta url "WHEN A MESSAGE COMES IN"`);
|
|
30536
|
-
console.log(`[Twilio]: POST http://localhost:${this.port}/twilio-hook`);
|
|
30537
|
-
console.log(`[Twilio]: Más información en la documentación`);
|
|
30538
|
-
console.log(``);
|
|
30539
|
-
});
|
|
30540
|
-
this.emit('ready', true);
|
|
30556
|
+
const routes = this.getListRoutes(this.server).join('\n');
|
|
30557
|
+
this.server.listen(this.port, cb(routes));
|
|
30541
30558
|
}
|
|
30542
30559
|
stop() {
|
|
30543
30560
|
return new Promise((resolve, reject) => {
|
|
@@ -30554,8 +30571,67 @@ class TwilioWebHookServer extends node_events.EventEmitter {
|
|
|
30554
30571
|
}
|
|
30555
30572
|
|
|
30556
30573
|
class TwilioProvider extends bot.ProviderClass {
|
|
30557
|
-
constructor(
|
|
30574
|
+
constructor(args) {
|
|
30558
30575
|
super();
|
|
30576
|
+
this.globalVendorArgs = {
|
|
30577
|
+
accountSid: undefined,
|
|
30578
|
+
authToken: undefined,
|
|
30579
|
+
vendorNumber: undefined,
|
|
30580
|
+
};
|
|
30581
|
+
this.busEvents = () => [
|
|
30582
|
+
{
|
|
30583
|
+
event: 'auth_failure',
|
|
30584
|
+
func: (payload) => this.emit('auth_failure', payload),
|
|
30585
|
+
},
|
|
30586
|
+
{
|
|
30587
|
+
event: 'ready',
|
|
30588
|
+
func: () => this.emit('ready', true),
|
|
30589
|
+
},
|
|
30590
|
+
{
|
|
30591
|
+
event: 'message',
|
|
30592
|
+
func: (payload) => {
|
|
30593
|
+
this.emit('message', payload);
|
|
30594
|
+
},
|
|
30595
|
+
},
|
|
30596
|
+
{
|
|
30597
|
+
event: 'host',
|
|
30598
|
+
func: (payload) => {
|
|
30599
|
+
this.emit('host', payload);
|
|
30600
|
+
},
|
|
30601
|
+
},
|
|
30602
|
+
];
|
|
30603
|
+
this.sendMedia = async (number, message = '', mediaInput) => {
|
|
30604
|
+
const entryPointUrl = this.globalVendorArgs?.publicUrl ?? `http://localhost:${this.http.port}`;
|
|
30605
|
+
if (!mediaInput)
|
|
30606
|
+
throw new Error(`Media cannot be null`);
|
|
30607
|
+
const encryptPath = bot.utils.encryptData(encodeURIComponent(mediaInput));
|
|
30608
|
+
const urlEncode = `${entryPointUrl}/tmp?path=${encryptPath}`;
|
|
30609
|
+
const regexUrl = /^(?!https?:\/\/)[^\s]+$/;
|
|
30610
|
+
const instructions = [
|
|
30611
|
+
`You are trying to send a file that is local.`,
|
|
30612
|
+
`For this to work with Twilio, the file needs to be in a public URL.`,
|
|
30613
|
+
`More information here https://builderbot.vercel.app/en/twilio/uses-cases`,
|
|
30614
|
+
`This is the URL that will be sent to Twilio (must be public)`,
|
|
30615
|
+
``,
|
|
30616
|
+
`${urlEncode}`,
|
|
30617
|
+
];
|
|
30618
|
+
if (mediaInput.includes('localhost') ||
|
|
30619
|
+
mediaInput.includes('127.0.0.1') ||
|
|
30620
|
+
mediaInput.includes('0.0.0.0') ||
|
|
30621
|
+
regexUrl.test(mediaInput)) {
|
|
30622
|
+
mediaInput = urlEncode;
|
|
30623
|
+
this.emit('notice', {
|
|
30624
|
+
title: '🟠 WARNING 🟠',
|
|
30625
|
+
instructions,
|
|
30626
|
+
});
|
|
30627
|
+
}
|
|
30628
|
+
return this.vendor.messages.create({
|
|
30629
|
+
mediaUrl: [`${mediaInput}`],
|
|
30630
|
+
body: message,
|
|
30631
|
+
from: parseNumberFrom(this.globalVendorArgs.vendorNumber),
|
|
30632
|
+
to: parseNumberFrom(number),
|
|
30633
|
+
});
|
|
30634
|
+
};
|
|
30559
30635
|
this.listenOnEvents = () => {
|
|
30560
30636
|
const listEvents = this.busEvents();
|
|
30561
30637
|
for (const { event, func } of listEvents) {
|
|
@@ -30569,10 +30645,9 @@ class TwilioProvider extends bot.ProviderClass {
|
|
|
30569
30645
|
* @returns
|
|
30570
30646
|
*/
|
|
30571
30647
|
this.initHttpServer = (port, opts) => {
|
|
30572
|
-
this.http = new TwilioWebHookServer(port);
|
|
30573
30648
|
const methods = {
|
|
30574
30649
|
sendMessage: this.sendMessage,
|
|
30575
|
-
provider: this
|
|
30650
|
+
provider: this,
|
|
30576
30651
|
blacklist: opts.blacklist,
|
|
30577
30652
|
dispatch: (customEvent, payload) => {
|
|
30578
30653
|
this.emit('message', {
|
|
@@ -30583,21 +30658,37 @@ class TwilioProvider extends bot.ProviderClass {
|
|
|
30583
30658
|
});
|
|
30584
30659
|
},
|
|
30585
30660
|
};
|
|
30586
|
-
this.http.start(methods, port)
|
|
30661
|
+
this.http.start(methods, port, { botName: this.globalVendorArgs.name }, (routes) => {
|
|
30662
|
+
this.emit('notice', {
|
|
30663
|
+
title: '🛜 HTTP Server ON ',
|
|
30664
|
+
instructions: routes,
|
|
30665
|
+
});
|
|
30666
|
+
this.emit('notice', {
|
|
30667
|
+
title: '⚡⚡ SETUP TWILIO ⚡⚡',
|
|
30668
|
+
instructions: [
|
|
30669
|
+
`Add "When a message comes in"`,
|
|
30670
|
+
`http://localhost:${port}/webhook`,
|
|
30671
|
+
`More info https://builderbot.vercel.app/en/providers/twilio`,
|
|
30672
|
+
],
|
|
30673
|
+
});
|
|
30674
|
+
const host = {
|
|
30675
|
+
phone: this.globalVendorArgs.vendorNumber,
|
|
30676
|
+
};
|
|
30677
|
+
this.emit('host', host);
|
|
30678
|
+
});
|
|
30587
30679
|
this.listenOnEvents();
|
|
30588
30680
|
return;
|
|
30589
30681
|
};
|
|
30590
30682
|
this.sendMessage = async (number, message, options) => {
|
|
30591
30683
|
options = { ...options, ...options['options'] };
|
|
30592
|
-
number = parseNumber(`${number}`);
|
|
30593
30684
|
if (options?.buttons?.length)
|
|
30594
30685
|
await this.sendButtons();
|
|
30595
30686
|
if (options?.media)
|
|
30596
30687
|
return this.sendMedia(number, message, options.media);
|
|
30597
30688
|
const response = this.vendor.messages.create({
|
|
30598
30689
|
body: message,
|
|
30599
|
-
from:
|
|
30600
|
-
to:
|
|
30690
|
+
from: parseNumberFrom(this.globalVendorArgs.vendorNumber),
|
|
30691
|
+
to: parseNumberFrom(number),
|
|
30601
30692
|
});
|
|
30602
30693
|
return response;
|
|
30603
30694
|
};
|
|
@@ -30612,60 +30703,19 @@ class TwilioProvider extends bot.ProviderClass {
|
|
|
30612
30703
|
return 'ERROR';
|
|
30613
30704
|
}
|
|
30614
30705
|
};
|
|
30615
|
-
this.
|
|
30616
|
-
this.
|
|
30617
|
-
this.
|
|
30618
|
-
}
|
|
30619
|
-
busEvents() {
|
|
30620
|
-
return [
|
|
30621
|
-
{
|
|
30622
|
-
event: 'auth_failure',
|
|
30623
|
-
func: (payload) => this.emit('error', payload),
|
|
30624
|
-
},
|
|
30625
|
-
{
|
|
30626
|
-
event: 'ready',
|
|
30627
|
-
func: () => this.emit('ready', true),
|
|
30628
|
-
},
|
|
30629
|
-
{
|
|
30630
|
-
event: 'message',
|
|
30631
|
-
func: (payload) => {
|
|
30632
|
-
this.emit('message', payload);
|
|
30633
|
-
},
|
|
30634
|
-
},
|
|
30635
|
-
];
|
|
30636
|
-
}
|
|
30637
|
-
async sendMedia(number, message, mediaInput) {
|
|
30638
|
-
if (!mediaInput)
|
|
30639
|
-
throw new Error(`Media cannot be null`);
|
|
30640
|
-
const encryptPath = bot.utils.encryptData(encodeURIComponent(mediaInput));
|
|
30641
|
-
const urlEncode = `${this.publicUrl}/tmp?path=${encryptPath}`;
|
|
30642
|
-
const regexUrl = /^(?!https?:\/\/)[^\s]+$/;
|
|
30643
|
-
const urlNotice = [
|
|
30644
|
-
`[NOTA]: Estas intentando enviar una fichero que esta en local.`,
|
|
30645
|
-
`[NOTA]: Para que esto funcione con Twilio necesitas que el fichero este en una URL publica`,
|
|
30646
|
-
`[NOTA]: más informacion aqui https://bot-whatsapp.netlify.app/docs/provider-twilio/`,
|
|
30647
|
-
`[NOTA]: Esta es la url que se enviara a twilio (debe ser publica) ${urlEncode}`,
|
|
30648
|
-
].join('\n');
|
|
30649
|
-
if (mediaInput.includes('localhost') ||
|
|
30650
|
-
mediaInput.includes('127.0.0.1') ||
|
|
30651
|
-
mediaInput.includes('0.0.0.0') ||
|
|
30652
|
-
regexUrl.test(mediaInput)) {
|
|
30653
|
-
mediaInput = urlEncode;
|
|
30654
|
-
console.log(urlNotice);
|
|
30655
|
-
}
|
|
30656
|
-
number = parseNumber(number);
|
|
30657
|
-
return this.vendor.messages.create({
|
|
30658
|
-
mediaUrl: [`${mediaInput}`],
|
|
30659
|
-
body: message,
|
|
30660
|
-
from: `whatsapp:+${this.vendorNumber}`,
|
|
30661
|
-
to: `whatsapp:+${number}`,
|
|
30662
|
-
});
|
|
30706
|
+
this.http = new TwilioWebHookServer(args?.port);
|
|
30707
|
+
this.globalVendorArgs = { ...this.globalVendorArgs, ...args };
|
|
30708
|
+
this.vendor = twilio(this.globalVendorArgs.accountSid, this.globalVendorArgs.authToken);
|
|
30663
30709
|
}
|
|
30664
30710
|
async sendButtons() {
|
|
30665
|
-
this.emit('notice',
|
|
30666
|
-
|
|
30667
|
-
|
|
30668
|
-
|
|
30711
|
+
this.emit('notice', {
|
|
30712
|
+
title: '📃 INFO 📃',
|
|
30713
|
+
instructions: [
|
|
30714
|
+
`Twilio presents a different way to implement buttons`,
|
|
30715
|
+
`To understand more about how it works, I recommend you check the following URLs`,
|
|
30716
|
+
`https://builderbot.vercel.app/en/providers/twilio/uses-cases`,
|
|
30717
|
+
],
|
|
30718
|
+
});
|
|
30669
30719
|
}
|
|
30670
30720
|
}
|
|
30671
30721
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,20 +1,23 @@
|
|
|
1
1
|
import { ProviderClass } from '@builderbot/bot';
|
|
2
2
|
import { Vendor } from '@builderbot/bot/dist/provider/providerClass';
|
|
3
|
-
import { BotContext, BotCtxMiddlewareOptions, SendOptions } from '@builderbot/bot/dist/types';
|
|
3
|
+
import { BotContext, BotCtxMiddlewareOptions, GlobalVendorArgs, SendOptions } from '@builderbot/bot/dist/types';
|
|
4
4
|
import twilio from 'twilio';
|
|
5
5
|
|
|
6
6
|
import { TwilioWebHookServer } from './server';
|
|
7
|
+
import { TwilioProviderMethods } from './twilioInterface';
|
|
7
8
|
import { ITwilioProviderOptions, TwilioRequestBody } from './types';
|
|
8
|
-
declare class TwilioProvider extends ProviderClass {
|
|
9
|
+
declare class TwilioProvider extends ProviderClass implements TwilioProviderMethods {
|
|
9
10
|
http: TwilioWebHookServer;
|
|
10
11
|
vendor: Vendor<twilio.Twilio>;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
globalVendorArgs: ITwilioProviderOptions & Partial<GlobalVendorArgs>;
|
|
13
|
+
constructor(args: ITwilioProviderOptions & Partial<GlobalVendorArgs>);
|
|
14
|
+
busEvents: () => {
|
|
15
|
+
event: string;
|
|
16
|
+
func: (payload: any) => void;
|
|
17
|
+
}[];
|
|
18
|
+
sendMedia: (number: string, message: string, mediaInput: string) => Promise<import("twilio/lib/rest/api/v2010/account/message").MessageInstance>;
|
|
19
|
+
sendButtons(): Promise<void>;
|
|
20
|
+
listenOnEvents: () => void;
|
|
18
21
|
/**
|
|
19
22
|
*
|
|
20
23
|
* @param port
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAS,MAAM,iBAAiB,CAAA;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,6CAA6C,CAAA;AACpE,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAS,MAAM,iBAAiB,CAAA;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,6CAA6C,CAAA;AACpE,OAAO,EACH,UAAU,EAEV,uBAAuB,EACvB,gBAAgB,EAChB,WAAW,EACd,MAAM,4BAA4B,CAAA;AAGnC,OAAO,MAAM,MAAM,QAAQ,CAAA;AAE3B,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAA;AAC9C,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAA;AACzD,OAAO,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAGnE,cAAM,cAAe,SAAQ,aAAc,YAAW,qBAAqB;IAChE,IAAI,EAAE,mBAAmB,CAAA;IACzB,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;IAEpC,gBAAgB,EAAE,sBAAsB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAInE;gBAEW,IAAI,EAAE,sBAAsB,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAOpE,SAAS;;wBAGe,GAAG;QAkB1B;IAED,SAAS,WAAkB,MAAM,+BAA4B,MAAM,kFAmClE;IAEK,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;IAWlC,cAAc,aAKb;IAED;;;;;OAKG;IACH,cAAc,SAAU,MAAM,QAAQ,KAAK,uBAAuB,EAAE,WAAW,CAAC,UAsC/E;IAED,WAAW,WAAkB,MAAM,WAAW,MAAM,YAAY,WAAW,KAAG,QAAQ,GAAG,CAAC,CAUzF;IAED,QAAQ,QAAe,QAAQ,iBAAiB,GAAG,UAAU,CAAC,YAAY;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,KAAG,QAAQ,MAAM,CAAC,CAS3G;CACJ;AAED,OAAO,EAAE,cAAc,EAAE,CAAA"}
|
package/dist/server.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ declare class TwilioWebHookServer extends EventEmitter {
|
|
|
13
13
|
server: Polka;
|
|
14
14
|
port: number;
|
|
15
15
|
constructor(twilioPort: number);
|
|
16
|
+
protected getListRoutes: (app: Polka) => string[];
|
|
16
17
|
/**
|
|
17
18
|
* Mensaje entrante
|
|
18
19
|
* emit: 'message'
|
|
@@ -36,7 +37,9 @@ declare class TwilioWebHookServer extends EventEmitter {
|
|
|
36
37
|
/**
|
|
37
38
|
* Iniciar el servidor HTTP
|
|
38
39
|
*/
|
|
39
|
-
start(vendor: BotCtxMiddleware, port?: number
|
|
40
|
+
start(vendor: BotCtxMiddleware, port?: number, args?: {
|
|
41
|
+
botName: string;
|
|
42
|
+
}, cb?: (arg?: any) => void): void;
|
|
40
43
|
stop(): Promise<void>;
|
|
41
44
|
}
|
|
42
45
|
/**
|
package/dist/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AAI7D,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE1C,OAAc,EAAc,KAAK,EAAE,MAAM,OAAO,CAAA;AAEhD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,IAAI,CAAA;AACxC,OAAO,EAAqB,aAAa,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AAI7D,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE1C,OAAc,EAAc,KAAK,EAAE,MAAM,OAAO,CAAA;AAEhD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,IAAI,CAAA;AACxC,OAAO,EAAqB,aAAa,EAAE,MAAM,SAAS,CAAA;AAM1D;;;GAGG;AACH,cAAM,mBAAoB,SAAQ,YAAY;IACnC,MAAM,EAAE,KAAK,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;gBAEP,UAAU,EAAE,MAAM;IAM9B,SAAS,CAAC,aAAa,QAAS,KAAK,KAAG,MAAM,EAAE,CAe/C;IAED;;;;;OAKG;IACH,OAAO,CAAC,WAAW,CAwClB;IAED;;;;;;OAMG;IACH,OAAO,CAAC,iBAAiB,CAWxB;IAED;;;OAGG;IACH,SAAS,CAAC,eAAe,IAAI,KAAK;IASlC;;OAEG;IACH,KAAK,CAAC,MAAM,EAAE,gBAAgB,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,EAAE,EAAE,GAAE,CAAC,GAAG,CAAC,EAAE,GAAG,KAAK,IAAiB;IAc/G,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAWxB;AAED;;;;GAIG;AACH,QAAA,MAAM,WAAW;cAC2D,cAAc;2BAC9C,GAAG,OAAO,GAAG,KAAK,QAAQ,IAAI,CAAC,WAEjE,GAAG,OAAO,GAAG,QAoBlB,CAAA;AAEL,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,WAAW,EAAE,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { SendOptions, BotContext } from '@builderbot/bot/dist/types';
|
|
2
|
+
|
|
3
|
+
import { TwilioRequestBody } from './types';
|
|
4
|
+
export interface TwilioProviderMethods {
|
|
5
|
+
sendMedia: (number: string, message: string, mediaInput: string) => Promise<any>;
|
|
6
|
+
sendMessage: (number: string, message: string, options?: SendOptions) => Promise<any>;
|
|
7
|
+
saveFile: (ctx: Partial<TwilioRequestBody & BotContext>, options?: {
|
|
8
|
+
path: string;
|
|
9
|
+
}) => Promise<string>;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=twilioInterface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"twilioInterface.d.ts","sourceRoot":"","sources":["../src/twilioInterface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAA;AAEpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAE3C,MAAM,WAAW,qBAAqB;IAClC,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,GAAG,CAAC,CAAA;IAChF,WAAW,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,GAAG,CAAC,CAAA;IACrF,QAAQ,EAAE,CAAC,GAAG,EAAE,OAAO,CAAC,iBAAiB,GAAG,UAAU,CAAC,EAAE,OAAO,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,KAAK,OAAO,CAAC,MAAM,CAAC,CAAA;CAC1G"}
|
package/dist/utils.d.ts
CHANGED
package/dist/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,WAAW,WAAY,MAAM,KAAG,MAErC,CAAA;AAED,OAAO,EAAE,WAAW,EAAE,CAAA"}
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,WAAW,WAAY,MAAM,KAAG,MAErC,CAAA;AAED,QAAA,MAAM,eAAe,WAAY,MAAM,KAAG,MAGzC,CAAA;AAED,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@builderbot/provider-twilio",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.23-alpha.0",
|
|
4
4
|
"description": "> TODO: description",
|
|
5
5
|
"author": "Leifer Mendez <leifer33@gmail.com>",
|
|
6
6
|
"homepage": "https://github.com/codigoencasa/bot-whatsapp#readme",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"url": "https://github.com/codigoencasa/bot-whatsapp/issues"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@builderbot/bot": "^1.0.
|
|
31
|
+
"@builderbot/bot": "^1.0.23-alpha.0",
|
|
32
32
|
"@rollup/plugin-commonjs": "^25.0.7",
|
|
33
33
|
"@rollup/plugin-json": "^6.1.0",
|
|
34
34
|
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
@@ -54,5 +54,5 @@
|
|
|
54
54
|
"polka": "^0.5.2",
|
|
55
55
|
"twilio": "4.20.0"
|
|
56
56
|
},
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "eda828c77a06b4e0215deb54d3000469c0e2ecb4"
|
|
58
58
|
}
|