@taoya785/flow-bark
Version:
Bark notification plugin for activepieces
26 lines (22 loc) • 771 B
JavaScript
;
const piecesCommon = require('@activepieces/pieces-common');
function buildBarkUrl(baseUrl, key, title, subtitle, body) {
let url = `${baseUrl}/${key}/`;
if (title && subtitle && body) {
url += `${encodeURIComponent(title)}/${encodeURIComponent(subtitle)}/${encodeURIComponent(body)}`;
} else if (title && body) {
url += `${encodeURIComponent(title)}/${encodeURIComponent(body)}`;
} else if (body) {
url += encodeURIComponent(body);
}
return url;
}
async function sendBarkNotification(url, params = {}) {
return await piecesCommon.httpClient.sendRequest({
method: piecesCommon.HttpMethod.GET,
url,
queryParams: params
});
}
exports.buildBarkUrl = buildBarkUrl;
exports.sendBarkNotification = sendBarkNotification;