new(whatsapp.gblib): New WhatsApp provider: Meta.
This commit is contained in:
parent
db80d556c1
commit
3ec96d7bdd
1 changed files with 56 additions and 20 deletions
|
@ -529,6 +529,7 @@ export class DialogKeywords {
|
||||||
*/
|
*/
|
||||||
public async sendEmail({ pid, to, subject, body }) {
|
public async sendEmail({ pid, to, subject, body }) {
|
||||||
const { min, user } = await DialogKeywords.getProcessInfo(pid);
|
const { min, user } = await DialogKeywords.getProcessInfo(pid);
|
||||||
|
|
||||||
if (!body) {
|
if (!body) {
|
||||||
body = "";
|
body = "";
|
||||||
};
|
};
|
||||||
|
@ -545,6 +546,8 @@ export class DialogKeywords {
|
||||||
body = result.value;
|
body = result.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (emailToken) {
|
||||||
return new Promise<any>((resolve, reject) => {
|
return new Promise<any>((resolve, reject) => {
|
||||||
sgMail.setApiKey(emailToken);
|
sgMail.setApiKey(emailToken);
|
||||||
const msg = {
|
const msg = {
|
||||||
|
@ -563,6 +566,39 @@ export class DialogKeywords {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
let { client } = await GBDeployer.internalGetDriveClient(min);
|
||||||
|
|
||||||
|
const data = {
|
||||||
|
"message": {
|
||||||
|
"subject": subject,
|
||||||
|
"body": {
|
||||||
|
"contentType": "Text",
|
||||||
|
"content": body
|
||||||
|
},
|
||||||
|
"toRecipients": [
|
||||||
|
{
|
||||||
|
"emailAddress": {
|
||||||
|
"address": to
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"from": {
|
||||||
|
"emailAddress": {
|
||||||
|
"address": process.env.EMAIL_FROM
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
await client.api('/me/sendMail')
|
||||||
|
.post(data);
|
||||||
|
|
||||||
|
GBLogEx.info(min, `E-mail para ${to} (${subject}) enviado.`);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sends a file to a given mobile.
|
* Sends a file to a given mobile.
|
||||||
|
|
Loading…
Add table
Reference in a new issue