@digitalstories/n8n-nodes-infomaniak
Version:
n8n nodes to interact with Infomaniak services (Kchat)
20 lines • 766 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getChannels = getChannels;
async function getChannels() {
const credentials = await this.getCredentials('infomaniakApi');
const baseURL = `https://${credentials.teamSlug}.kchat.infomaniak.com`;
const response = await this.helpers.requestWithAuthentication.call(this, 'infomaniakApi', {
method: 'GET',
url: `${baseURL}/api/v4/channels`,
json: true,
});
if (!response || !Array.isArray(response)) {
throw new Error('Erreur lors de la récupération des channels');
}
return response.map((channel) => ({
name: channel.display_name,
value: channel.id,
}));
}
//# sourceMappingURL=Infomaniak.methods.js.map