產品指南
基礎
自動化指南
集成指南
AI應用與模板指南
Open API
功能參考
自動化觸發器
自動化執行器
第三方集成
節點資源
數據表視圖
數據表字段
儀表板組件
智能任務
AI 向導
公式
空間站
Videos DEMO
更新日誌
Bika.ai's offical JavaScript use beautiful Object-Oriented Programming (OOP) style for your better use.
npm install bika.ai
# or
yarn add bika.ai
pnpm add bika.ai
Examples to use Bika.ai offical Node.js SDK. (TypeScript example)
Get Spaces:
import { Bika } from 'bika.ai';
const bika = new Bika({
token: '__PASTE_YOUR_API_TOKEN_FROM_USER_SETTING__',
// default is:
// baseURL: 'https://bika.ai/api/openapi/bika',
})
// firstly, fetch your spaces
const spaces = await bika.spaces.list();
// now we use your first space as our operations
const space = spaces[0];
Find Node Resources (Database, Automation, Folder, Documents, etc.):
// find node resources
const nodes = await space.nodes.list();
// get one node resource
const node = nodes[0];
const database = await node.asDatabase();
const automation = await node.asAutomation();
Here’s an example of Create, Read, Update, and Delete (CRUD) operations for databases.
Given that Bika.ai's database can handle billions of rows, you can use Bika.ai databases as a fully functional production database, such as for an order table, user table, and more.
// notice, use `asXXX`,depends on your node resource type, includes database, automation, folder, and so-on
const database = await node.asDatabase();
const records = await database.records.list();
const views = await database.views.list();
CRUD Automations:
const automation = await node.asAutomation();
const triggers = await automation.triggers.list();
const actions = await automation.actions.list();
Here are examples of registering global-scope or space-scope outgoing webhooks (Server Events in Bika.ai).
You can utilize outgoing webhooks to send HTTP POST requests to your callback URL whenever a specific event takes place in Bika.ai.
Use cases include contact synchronization, data synchronization, custom notifications, plugins, and more.
// Outoging Webhooks
// Register a Bika.ai server event, and send a HTTP POST request to your callback URL
const outgoingWebhook = await space.outgoingWebhooks.create({
eventType: 'ON_RECORD_CREATED',
name: 'Test Outgoing Webhook',
description: 'Test Outgoing Webhook Desc',
callbackURL: 'https://your-custom-callback-url.com',
});
const outgoingWebhooks = await space.outgoingWebhooks.list();
const delteOutgoingWebhook = await space.outgoingWebhooks.delete({id: outgoingWebhook.id});
Here are examples of embedding Bika.ai's UI into your own application.
If you want to incorporate Bika.ai's robust UI for databases, documents, and more, you can utilize the embed link API.
Generate an embed link to obtain a URL, and then use an <iframe>
in your application.
// Embed Links
// You can embed Bika.ai's UI into your own application
const embedLink = await space.embedLink.create({
objectType: 'NODE_RESOURCE',
objectId: '__NODE_RESOURCE_ID_YOU_WANT_TO_EMBED__',
})
const embedLinks = await space.embedLink.list();
const deleteEmbedLink = await space.embedLink.delete({id: embedLink.id});
// ...
Please checkout the Bika.ai API Reference for more API details.
Bika.ai support APITable compatible Open API interfaces.
That means you can use the APITable's SDK (JavaScript, Python, etc.) to interact with Bika.ai.
Quick start with APITable.js SDK for Bika.ai:
import { APITable } from "apitable";
// Get token from your Bika.ai user setting
const apitable = new APITable({ token: "_PASTE_YOUR_API_TOKEN_FROM_USER_SETTING", host: "https://bika.ai/api/openapi/apitable" });
// Get a list of spaces for the current user
const spaceListResp = await apitable.spaces.list()
if (spaceListResp.success) {
console.log(spaceListResp.data.spaces);
} else {
console.error(spaceListResp);
}
More SDK usage please refer to: