npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@botmock-api/client

v1.2.0

Published

nodejs client for interacting with the botmock api

Downloads

5

Readme

@botmock-api/client

Build Status

nodejs client for interacting with the botmock api

1.x

master now tracks version 1.x of the package. For 0.1.x see branch legacy.

Table of Contents

Installation

Note: In order to get started with this client, you'll need to get your access token from https://app.botmock.com. After you sign in, go to the Account Settings page by clicking on your profile picture on the top right. Then click on "Developer API" from the dropdown menu. Give your token a name, check the box, and hit "Create". Remember to note down your token since it will not be shown after it is generated.

npm i @botmock-api/client

API

Batcher

import { Batcher } from "@botmock-api/client";

const config = {
  token: process.env.BOTMOCK_TOKEN,
  teamId: process.env.BOTMOCK_TEAM_ID,
  projectId: process.env.BOTMOCK_PROJECT_ID,
  boardId: process.env.BOTMOCK_BOARD_ID,
};

const { data } = await new Batcher(config).batchRequest([
  "project",
  "board",
  "intents",
  "entities",
  "variables",
]);
batchRequest

batcher.batchRequest(string[]): Promise<null | { data: JSONResponse }>

Fetches an array of Botmock project resources using the fetcher

Botmock

import { Botmock } from "@botmock-api/client";

const client = new Botmock({ token: process.env.BOTMOCK_TOKEN });
Methods

client.getProject(opt): Promise<any>

Gets project from a teamId and projectId within opt

const project = await client.getProject({ teamId, projectId });

client.getTeam(teamId): Promise<any>

Gets team from a teamId

const team = await client.getTeam(teamId);

client.getBoard(opt): Promise<any>

Gets board data from a teamId, projectId and boardId

const board = await client.getBoard({ teamId, projectId, boardId });

client.getIntents(opt): Promise<any>

Gets all intents from a teamId and projectId

const intents = await client.getIntents({ teamId, projectId });

client.getVariables(opt): Promise<any>

Gets all variables from a teamId and projectId

const variables = await client.getVariables({ teamId, projectId });

client.getEntities(opt): Promise<any>

Gets all entities from a teamId and projectId

const entities = await client.getEntities({ teamId, projectId });

Error Handling

Events containing errors and also successes can be listened to in the following ways.

const client = new Botmock({ token: process.env.BOTMOCK_TOKEN });

client.on("error", ({ error, endpoint }: { error: FetchError, endpoint: string }) => {
  console.error(error, endpoint);
});

client.on("success", ({ endpoint, timestamp }: { endpoint: string, timestamp: number }) => {
  console.error(endpoint, timestamp);
});

Development Guidelines

To test the package, simply enter the command below into the command line:

npm test