Email Nofitication
Pengembang dapat menggunakan fungsi dalam email
untuk manajemen notifikasi.
client.email;
Email methods
send(payload)
mengirim email.
Arguments
name | type | description | special use |
---|---|---|---|
payload | object | payload email | |
payload.content | object | content email | |
payload.content.to | string / array | tujuan pengiriman email | |
payload.content.from | string | alamat pengirim email | |
payload.content.replayTo | string | alamat email balasan | |
payload.content.rawBody | string | body email | |
payload.content.subject | string | subject email | |
payload.content.template | string | nama template | |
payload.content.values | object | value yang dimasukkan ke dalam template |
Return
Promise<Object>
berisi response dari endpoint notification/push
Example
const email = client.email;
const payload = {
content: {
from: "MBAAS-SERVER <email@mail.com>",
to: ["email@gmail.com"],
replyTo: "fr.n@mail.com",
rawBody: "body",
subject: "subject test email",
},
};
email.send(payload);
getTemplates()
digunakan untuk mendapatkan list template yang tersedia.
Return
Promise<Object[]>
berisi array of object dari list template yang tersedia.
Example
const email = client.email;
(async function () {
const templates = await email.getTemplates();
console.log(templates); // list template yang tersedia
})();