UNPKG

n8n-nodes-chatwoot

Version:

This is an n8n community node. It lets you use ChatWoot in your n8n workflows.

27 lines 1.13 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.resourceAccount = void 0; const GenericFunctions_1 = require("../GenericFunctions"); async function resourceAccount(operation, items, i) { let accessToken = this.getNodeParameter('accessToken', i, ''); let accountId = this.getNodeParameter('accountId', i, ''); if (!accountId) { const credentials = await this.getCredentials('chatWootTokenApi'); if (credentials) { accessToken = accessToken || credentials.accessToken; accountId = accountId || credentials.accountId; } } const headers = { 'api_access_token': accessToken, }; let responseData; if (operation === 'accountInformation') { let endpoint = '/api/v1/accounts/{{accountId}}'; endpoint = endpoint.replace('{{accountId}}', accountId); responseData = await GenericFunctions_1.apiRequest.call(this, 'GET', endpoint, {}, {}, headers); } return responseData; } exports.resourceAccount = resourceAccount; //# sourceMappingURL=AccountMethods.js.map