n8n-nodes-base
Version:
Base nodes of n8n
29 lines • 803 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.msg91ApiRequest = msg91ApiRequest;
const n8n_workflow_1 = require("n8n-workflow");
/**
* Make an API request to MSG91
*
*/
async function msg91ApiRequest(method, endpoint, body, query) {
const credentials = await this.getCredentials('msg91Api');
if (query === undefined) {
query = {};
}
query.authkey = credentials.authkey;
const options = {
method,
form: body,
qs: query,
uri: `https://api.msg91.com/api${endpoint}`,
json: true,
};
try {
return await this.helpers.request(options);
}
catch (error) {
throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
}
}
//# sourceMappingURL=GenericFunctions.js.map