New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@botmock/export

Package Overview
Dependencies
Maintainers
4
Versions
77
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@botmock/export

Exports data from Botmock API to development platforms.

  • 0.2.1
  • npm
  • Socket score

Version published
Maintainers
4
Created
Source

@botmock/export

Exports data from Botmock API to development platforms.

Install

npm install @botmock/export

Supported platforms

  • Dialogflow
  • Luis
  • Rasa
  • Watson
  • Skills Kit
  • Lex

Quickstart

The export package exposes a unique class for each supported platform.

The example in this quickstart guide will use DialogflowExporter class.

The output from the main export method on DialogflowExporter class is a JSON object representation of the file structure suited for the particular platform.

Using FileWriter with DialogflowExporter

FileWriter is a class suited to transform the object returned by the *Exporter classes into files and directories.

This example shows how to create .json files in ./output using DialogflowExporter in conjunction with FileWriter.

import "dotenv/config";
import { DialogflowExporter, FileWriter, Kind } from "@botmock/export";
// @ts-ignore
import { zipSync } from "cross-zip";
import { basename } from "path";

const pathToOutputDirectory = "./output";
const writer = new FileWriter({ dir: pathToOutputDirectory });
const exporter = new DialogflowExporter({ token: process.env.TOKEN as string });

async function main(): Promise<void> {
  // Get data object describing some project
  const { data } = await exporter.export({
    teamId: process.env.TEAM_ID as string,
    projectId: process.env.PROJECT_ID as string,
    boardId: process.env.BOARD_ID as string,
  });
  // Unpack this data object into the directory passed to `FileWriter`
  const res = await writer.unpackAllResources({ data });
  if (res.kind === Kind.OK) {
    zipSync(pathToOutputDirectory, `${basename(pathToOutputDirectory)}.zip`);
  } else {
    console.error("problem!");
  }
}

process.on("unhandledRejection", () => { });
process.on("uncaughtException", () => { });

main().catch((err: Error) => {
  console.error(err.stack as string);
});

FAQs

Package last updated on 05 May 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc