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