new(whatsapp.gblib): New provider.

This commit is contained in:
Rodrigo Rodriguez 2022-06-10 14:43:13 -03:00
parent 0c967a9f71
commit 49056e9f76

View file

@ -139,7 +139,7 @@ export class WhatsappDirectLine extends GBService {
options = { options = {
url: url, url: url,
method: 'POST', method: 'POST',
body: { webhook: webhook, }, body: { webhook: `${GBServer.globals.publicAddress}/webhooks/whatsapp/${this.botId}` },
headers: { headers: {
'x-maytapi-key': this.whatsappServiceKey, 'x-maytapi-key': this.whatsappServiceKey,
'Content-Type': 'application/json', 'Content-Type': 'application/json',
@ -541,20 +541,20 @@ export class WhatsappDirectLine extends GBService {
} }
else { else {
// TODO: Attach.
let contents = 0; let contents = 0;
let body = { let body = {
type: 'image', to_number: to,
text: 'Base64 Image Response', type: "media",
message: `data:image/jpeg;base64,${contents}`, message: url,
text: caption
}; };
let phoneId = this.whatsappServiceNumber.split(';')[0]; let phoneId = this.whatsappServiceNumber.split(';')[0];
let productId = this.whatsappServiceNumber.split(';')[1] let productId = this.whatsappServiceNumber.split(';')[1]
let url = `${this.INSTANCE_URL}/${productId}/${phoneId}/sendMessage`;
options = { options = {
url: `${this.INSTANCE_URL}/${productId}/${phoneId}/sendMessage`,
method: 'post', method: 'post',
json: true, json: true,
body, body,