Security News
PyPI’s New Archival Feature Closes a Major Security Gap
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
@botmock/client
Advanced tools
Botmock client package is used to unlock data from Botmock projects.
Let's take a deeper dive and see what are those public methods that are exposed by Botmock Client and also what to expect from the response from these public methods.
The package is available to install on npm. It is written in TypeScript, and comes bundled with type definitions.
npm install @botmock/client
Resources are all the nuts and bolts of a given project. Resources includes project information, a board is part of a project, so its information which includes the information about blocks and its connections. A project belongs to a team so resources also give us team information. Our intents, entities and variables are essential part of a board, so resources also contains information about these three.
Each of the following methods is publicly available on an instance of the named export Client
:
const client = new Client({ token: process.env.TOKEN });
const project = await client.getProject(process.env.TEAM_ID, process.env.projectId);
getProject(teamId: string, projectId: string): FetchResult
This method takes two parameters: teamId
as a string and projectId
which is also a string and then returns JSON for the information about the project as shown in a sample JSON below:
{
"id": "16f1c520-05c6-11e7-bc31-5554df9b496b",
"name": "Kindly",
"created_at": "2017-03-10 19:16:40",
"updated_at": "2017-09-15 14:15:59",
"type": "mock",
"platform": "facebook"
}
getProjects(ProjectOptions[]): FetchResults
This method takes an array of objects containing a teamId
property as a string and projectId
property which is also a string. It then returns an array of JSON for the information about the projects as shown in a sample JSON below:
[
{
"id": "16f1c520-05c6-11e7-bc31-5554df9b496b",
"name": "Kindly",
"created_at": "2017-03-10 19:16:40",
"updated_at": "2017-09-15 14:15:59",
"type": "mock",
"platform": "facebook"
}
]
getTeam(teamId: string): FetchResult
This method takes in one parameter of teamId
as string and returns the team information as shown in the following JSON below:
{
"id": 38881,
"name": "First Team",
"photo": "https://www.gravatar.com/avatar/00f062fb089de61b9a7e8033bc40109a.jpg?s=200&d=identicon",
"created_at": {
"date": "2017-01-10 20:45:21.000000",
"timezone_type": 3,
"timezone": "UTC"
}
}
getTeams(teamIds: Array<string>): FetchResults
This method takes in a teamIds
array that contains the team IDs as strings and returns the information for each team as shown in the following JSON below:
[
{
"id": 38881,
"name": "First Team",
"photo": "https://www.gravatar.com/avatar/00f062fb089de61b9a7e8033bc40109a.jpg?s=200&d=identicon",
"created_at": {
"date": "2017-01-10 20:45:21.000000",
"timezone_type": 3,
"timezone": "UTC"
}
},
{
"id": 38743,
"name": "Second Team",
"photo": "https://www.gravatar.com/avatar/00f062fb089de61b9a7e8033bc40109a.jpg?s=200&d=identicon",
"created_at": {
"date": "2017-01-20 20:45:21.000000",
"timezone_type": 3,
"timezone": "UTC"
}
}
]
getBoard(teamId: string, projectId: string, boardId: string): FetchResult
GetBoard is a method that can be used to get all the board information if provided correct teamId, projectId, boardId
all these parameters are expected to be strings. The sample JSON response is shown below:
{
"board": {
"root_messages": [
"16f1c520-05c6-11e7-bc31-5554df9b496b"
],
"messages": [
{
"message_id": "16f1c520-05c6-11e7-bc31-5554df9b496b",
"message_type": "response",
"next_message_ids": [
{
"message_id": "16f1c520-05c6-11e7-bc31-5554df9b496b",
"action": "*",
"intent": "",
"conditional": false
}
],
"previous_message_ids": [],
"is_root": true,
"payload": {
"en": {
"facebook": {
"blocks": [
[]
]
}
}
}
},
{
"message_id": "16f1c520-05c6-11e7-bc31-5554df9b496b",
"message_type": "response",
"next_message_ids": [
{
"message_id": "16f1c520-05c6-11e7-bc31-5554df9b496b",
"action": "*",
"intent": "",
"conditional": false
}
],
"previous_message_ids": [
{
"message_id": "16f1c520-05c6-11e7-bc31-5554df9b496b",
"action": "*"
}
],
"is_root": false,
"payload": {
"en": {
"facebook": {
"blocks": [
{
"component_type": "text",
"nodeName": "Bot Says",
"text": "Your bot reply goes here...",
"buttons": [],
"delay": 2000,
"workflow_index": 0
}
]
}
}
}
},
]
},
"slots": {
"34cb53e0-898e-11ea-a937-3f5c9b13d9b8": []
},
"variables": [],
"created_at": {
"date": "2020-04-28 20:24:05.000000",
"timezone_type": 3,
"timezone": "UTC"
},
"updated_at": {
"date": "2020-04-30 17:02:40.000000",
"timezone_type": 3,
"timezone": "UTC"
}
}
getBoards(teamId: string, projectId: string, boardId: string): FetchResult
This method can be used in the same way as the getBoard
method, but this method allows for retrieving multiple boards from a single project. You must pass it a teamId
as a string, a projectId
string, and boardIds
as an array of strings. The sample JSON response is shown below:
[
{
"board": {
"root_messages": [
"16f1c520-05c6-11e7-bc31-5554df9b496b"
],
"messages": [
{
"message_id": "16f1c520-05c6-11e7-bc31-5554df9b496b",
"message_type": "response",
"next_message_ids": [
{
"message_id": "16f1c520-05c6-11e7-bc31-5554df9b496b",
"action": "*",
"intent": "",
"conditional": false
}
],
"previous_message_ids": [],
"is_root": true,
"payload": {
"en": {
"facebook": {
"blocks": [
[]
]
}
}
}
},
{
"message_id": "16f1c520-05c6-11e7-bc31-5554df9b496b",
"message_type": "response",
"next_message_ids": [
{
"message_id": "16f1c520-05c6-11e7-bc31-5554df9b496b",
"action": "*",
"intent": "",
"conditional": false
}
],
"previous_message_ids": [
{
"message_id": "16f1c520-05c6-11e7-bc31-5554df9b496b",
"action": "*"
}
],
"is_root": false,
"payload": {
"en": {
"facebook": {
"blocks": [
{
"component_type": "text",
"nodeName": "Bot Says",
"text": "Your bot reply goes here...",
"buttons": [],
"delay": 2000,
"workflow_index": 0
}
]
}
}
}
},
]
},
"slots": {
"34cb53e0-898e-11ea-a937-3f5c9b13d9b8": []
},
"variables": [],
"created_at": {
"date": "2020-04-28 20:24:05.000000",
"timezone_type": 3,
"timezone": "UTC"
},
"updated_at": {
"date": "2020-04-30 17:02:40.000000",
"timezone_type": 3,
"timezone": "UTC"
}
}
]
getIntents(teamId: string, projectId: string): FetchResult
This method takes in a teamId
and projectId
and returns all the intents of a specific project. It returns an array of intent object and each object consists of an intent id
, name
, list of utterances
and some meta information like created_at
and updated_at
[
{
"id": "16f1c520-05c6-11e7-bc31-5554df9b496b",
"name": "Order Pizza",
"utterances": {
"en": [
{
"text": "I want to order pizza",
"variables": []
},
{
"text": "Order pizza",
"variables": []
}
]
},
"created_at": {
"date": "2020-04-28 20:24:05.000000",
"timezone_type": 3,
"timezone": "UTC"
},
"updated_at": {
"date": "2020-04-28 20:24:05.000000",
"timezone_type": 3,
"timezone": "UTC"
},
"is_global": false,
"slots": []
}
]
getEntities(teamId: string, projectId: string): FetchResult
This method takes in same as getIntents method a teamId
and projectId
and returns all the entities of a specific project. The sample JSON is shown below.
[
{
"id": "16f1c520-05c6-11e7-bc31-5554df9b496b",
"name": "orderTime",
"data": {
"en": [
{
"value": "lunch",
"synonyms": [
"brunch"
]
},
{
"value": "breakfast",
"synonyms": []
}
]
},
"created_at": {
"date": "2020-04-30 17:36:10.000000",
"timezone_type": 3,
"timezone": "UTC"
},
"updated_at": {
"date": "2020-04-30 17:36:10.000000",
"timezone_type": 3,
"timezone": "UTC"
}
}
]
An Enum
containing all resource names can be imported as follows:
import { Resource } from "@botmock/client";
export enum Resource {
PROJECT = "project",
TEAM = "team",
BOARD = "board",
INTENTS = "intents",
VARIABLES = "variables",
ENTITIES = "entities",
}
This import gives us access to names of all available resources. When we call getResources
its on us which resources we need. so we need to pass then in the parameters of getResources
method as shown below. It can all but it can also be a few on them.
getResources
methodThis public method can be used to fetch an array of resource names from a given project:
import { Client } from "@botmock/client";
const client = new Client({ token: process.env.TOKEN });
(async () => {
// It can be passed a single options object, and will return an object with the project's resources
const { intents, project } = await client.getResources({
resources: [Resource.INTENTS, Resource.PROJECT], // Here we are going to only get two resources
teamId: "1",
projectId: "1",
boardId: "1",
});
// Or it can be passed an array of options, and will return an array of resource objects
const [firstProjectResources, secondProjectResources] = await client.getResources(
[
{
resources: [Resource.INTENTS, Resource.PROJECT],
teamId: "1",
projectId: "1",
boardId: "1",
},
{
resources: [Resource.INTENTS, Resource.PROJECT],
teamId: "2",
projectId: "2",
boardId: "2",
}
]
);
})();
client.getResources
promise resolves with an object containing keys for each of the elements of resources
array.
If you would like to report an issue please feel free to send an email to help@botmock.com
Thanks for using Botmock! Happy Prototyping 😎 😎 👩🏻🎨 👨🏻🎨 😎 😎
FAQs
## Overview
The npm package @botmock/client receives a total of 9 weekly downloads. As such, @botmock/client popularity was classified as not popular.
We found that @botmock/client demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
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.
Security News
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
Research
Security News
Malicious npm package postcss-optimizer delivers BeaverTail malware, targeting developer systems; similarities to past campaigns suggest a North Korean connection.
Security News
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.