UNPKG

@botonic/plugin-flow-builder

Version:

Botonic plugin for **Hubtype Flow Builder**: run and bridge flow-driven logic from bots on the **current** line.

32 lines 1.21 kB
import { __awaiter } from "tslib"; import { FlowBuilderJSONVersion } from '../types'; class FlowClient { constructor(botonicContext) { this.botonicContext = botonicContext; this.jsonVersion = FlowBuilderJSONVersion.DRAFT; } getFlow() { return __awaiter(this, void 0, void 0, function* () { const version = this.botonicContext.session.isTestIntegration ? FlowBuilderJSONVersion.DRAFT : this.jsonVersion; const requestUrl = `${this.botonicContext.settings.hubtypeApiUrl}/v1/bot_flows/${this.botonicContext.session.bot.id}/versions/${version}/`; try { const response = yield fetch(requestUrl, { method: 'GET', headers: { Authorization: `Bearer ${this.botonicContext.secrets.hubtypeAccessToken}`, }, }); const data = yield response.json(); return data; } catch (error) { console.error(error); throw error; } }); } } export default FlowClient; //# sourceMappingURL=flow-client.js.map