Node.js API Client

The Buzzy API Node.js client provides a convenient way to interact with the Buzzy REST API from Node.js applications. This client handles authentication, request formatting, and response parsing, making it easier to use the API.

Installation

npm install buzzy-api-nodejs

Usage

import { 
  login, 
  insertMicroAppRow, 
  getMicroAppData 
} from 'buzzy-api-nodejs';

// Example: Login and get auth credentials
async function example() {
  const auth = await login({
    url: 'https://your-buzzy-instance.com',
    email: '[email protected]',
    password: 'password'
  });
  
  // Use auth credentials for other API calls
  const { token, userId } = auth;
  
  // Example: Get data from a MicroApp
  const rows = await getMicroAppData({
    microAppID: 'microAppID',
    authToken: token,
    userId: userId,
    url: 'https://your-buzzy-instance.com'
  });
  
  console.log(rows);
}

Comprehensive Examples: For detailed examples showing how to perform the same operations using the Node.js client, REST API, and BuzzyFrameAPI, see Common API Examples.

API Reference

login

Logs in a user and retrieves authentication token and user ID.

Parameters:

  • url (string): The base URL of your Buzzy instance

  • email (string): The user's email

  • password (string): The user's password

Returns:

  • Promise resolving to { token, userId }

logout

Logs out a user by removing their authentication token.

Parameters:

  • authToken (string): Authentication token

  • userId (string): User ID

  • url (string): Buzzy instance URL

Returns:

  • Promise resolving to logout response

Example:

getUserID

Finds a user ID based on an email address.

Parameters:

  • authToken (string): Authentication token

  • userId (string): User ID of the requesting user

  • url (string): The base URL of your Buzzy instance

  • email (string): The email to look up

Returns:

  • Promise resolving to an object containing the user ID

insertMicroAppRow

Inserts a new row into a specified MicroApp.

Parameters:

  • microAppID (string): The ID of the MicroApp

  • authToken (string): Authentication token

  • userId (string): User ID of the requesting user

  • url (string): The base URL of your Buzzy instance

  • rowData (object): The data to insert

  • embeddingRowID (string, optional): The ID of the embedding row

  • viewers (array, optional): Array of user IDs who can view this row

  • userID (string, optional): The ID of the creator

Returns:

  • Promise resolving to an object containing the inserted row ID

getMicroAppData

Retrieves data from a specified MicroApp.

Parameters:

  • microAppID (string): The ID of the MicroApp

  • authToken (string): Authentication token

  • userId (string): User ID of the requesting user

  • url (string): The base URL of your Buzzy instance

  • optSearchFilters (object, optional): Optional search filters

  • searchFilter (object, optional): Primary search filter

  • optViewFilters (object, optional): Optional view filters for filtering results, including geo/spatial queries using sortValGeometry (see geo/spatial query examples)

  • optIsVectorSearch (boolean, optional): Whether to use vector search

  • optVectorSearchString (string, optional): Vector search string

  • optLimit (number, optional): Number of results to return

Returns:

  • Promise resolving to an array of rows

getMicroAppDataRow

Retrieves a specific row from a MicroApp.

Parameters:

  • rowID (string): The ID of the row

  • authToken (string): Authentication token

  • userId (string): User ID of the requesting user

  • url (string): The base URL of your Buzzy instance

Returns:

  • Promise resolving to the row data

removeMicroAppRow

Removes a specific row from a MicroApp.

Parameters:

  • rowID (string): The ID of the row to remove

  • authToken (string): Authentication token

  • userId (string): User ID of the requesting user

  • url (string): The base URL of your Buzzy instance

Returns:

  • Promise resolving to the operation result

updateMicroAppDataRow

Updates a specific row in a MicroApp.

Parameters:

  • rowID (string): The ID of the row to update

  • authToken (string): Authentication token

  • userId (string): User ID of the requesting user

  • url (string): The base URL of your Buzzy instance

  • rowData (object): The new data for the row

  • creatorID (string, optional): The ID of the creator

Returns:

  • Promise resolving to a boolean indicating success

insertOrganization

Creates a new organization.

Parameters:

  • authToken (string): Authentication token

  • userId (string): User ID of the requesting user

  • url (string): The base URL of your Buzzy instance

  • organizationInfo (object): Information about the organization

Returns:

  • Promise resolving to the operation result

insertTeam

Creates a new team within an organization.

Parameters:

  • authToken (string): Authentication token

  • userId (string): User ID of the requesting user

  • url (string): The base URL of your Buzzy instance

  • teamInfo (object): Information about the team

  • adminID (string, optional): The ID of the admin user

Returns:

  • Promise resolving to the operation result

insertTeamMembers

Adds members to teams.

Parameters:

  • authToken (string): Authentication token

  • userId (string): User ID of the requesting user

  • url (string): The base URL of your Buzzy instance

  • teamIDs (array): Array of team IDs

  • emails (array, optional): Array of user emails

  • userIDs (array, optional): Array of user IDs

  • targetInitialApp (string, optional): Initial app for new users

  • targetInitialScreen (string, optional): Initial screen for new users

  • targetRoute (string, optional): Route for new users

Returns:

  • Promise resolving to the operation result

Advanced Team Management

enforceTeamMembership

Enforces team membership for a user by adding/removing them from specified teams.

Parameters:

  • authToken (string): Authentication token

  • userId (string): User ID making the request

  • url (string): Buzzy instance URL

  • userID (string): User ID to manage (optional if email provided)

  • email (string): Email to manage (optional if userID provided)

  • teamIDs (array): Array of team IDs to enforce membership for

Returns:

  • Promise resolving to enforcement response

Example:

getTeamMembers

Gets team members for specified teams.

Parameters:

  • authToken (string): Authentication token

  • userId (string): User ID

  • url (string): Buzzy instance URL

  • teamIDs (array): Array of team IDs to get members for

Returns:

  • Promise resolving to team members response with array of user IDs

Example:

AI-Powered App Creation

createAppWithPrompt

Creates an app using AI prompt.

Parameters:

  • url (string): Buzzy instance URL

  • apiKey (string): API key for authentication

  • userEmail (string): User's email

  • appPrompt (string): AI prompt for app creation

  • attachments (array, optional): Optional attachments array

Returns:

  • Promise resolving to app creation response with buzzID

Example:

Organization Management

readOrganization

Retrieves information about a specific organization.

Parameters:

  • authToken (string): Authentication token

  • userId (string): User ID of the requesting user

  • url (string): The base URL of your Buzzy instance

  • organizationID (string): The ID of the organization to read

Returns:

  • Promise resolving to the organization data

Example:

updateOrganization

Updates an existing organization's information.

Parameters:

  • authToken (string): Authentication token

  • userId (string): User ID of the requesting user

  • url (string): The base URL of your Buzzy instance

  • organizationID (string): The ID of the organization to update

  • organizationInfo (object): Updated organization information

Returns:

  • Promise resolving to the update result

Example:

deleteOrganization

Deletes an organization.

Parameters:

  • authToken (string): Authentication token

  • userId (string): User ID of the requesting user

  • url (string): The base URL of your Buzzy instance

  • organizationID (string): The ID of the organization to delete

Returns:

  • Promise resolving to the deletion result

Example:

Team Management

readTeam

Retrieves information about a specific team.

Parameters:

  • authToken (string): Authentication token

  • userId (string): User ID of the requesting user

  • url (string): The base URL of your Buzzy instance

  • teamID (string): The ID of the team to read

Returns:

  • Promise resolving to the team data

Example:

updateTeam

Updates an existing team's information.

Parameters:

  • authToken (string): Authentication token

  • userId (string): User ID of the requesting user

  • url (string): The base URL of your Buzzy instance

  • teamID (string): The ID of the team to update

  • teamInfo (object): Updated team information

Returns:

  • Promise resolving to the update result

Example:

deleteTeam

Deletes a team.

Parameters:

  • authToken (string): Authentication token

  • userId (string): User ID of the requesting user

  • url (string): The base URL of your Buzzy instance

  • teamID (string): The ID of the team to delete

Returns:

  • Promise resolving to the deletion result

Example:

readTeamMember

Retrieves information about a specific team member.

Parameters:

  • authToken (string): Authentication token

  • userId (string): User ID of the requesting user

  • url (string): The base URL of your Buzzy instance

  • teamID (string): The ID of the team

  • userID (string): The ID of the team member

Returns:

  • Promise resolving to the team member data

Example:

updateTeamMember

Updates a team member's role or information.

Parameters:

  • authToken (string): Authentication token

  • userId (string): User ID of the requesting user

  • url (string): The base URL of your Buzzy instance

  • teamID (string): The ID of the team

  • userID (string): The ID of the team member to update

  • role (string): The new role for the team member ('admin' or 'member')

Returns:

  • Promise resolving to the update result

Example:

deleteTeamMember

Removes a member from a team.

Parameters:

  • authToken (string): Authentication token

  • userId (string): User ID of the requesting user

  • url (string): The base URL of your Buzzy instance

  • teamID (string): The ID of the team

  • userID (string): The ID of the team member to remove

Returns:

  • Promise resolving to the deletion result

Example:

enforceTeamMembership

Enforces team membership for a user by adding them to specified teams.

Parameters:

  • authToken (string): Authentication token

  • userId (string): User ID of the requesting user

  • url (string): The base URL of your Buzzy instance

  • email (string): Email of the user to add to teams

  • teamIDs (array): Array of team IDs to add the user to

Returns:

  • Promise resolving to the enforcement result

Example:

getTeamMembers

Retrieves all members for specified teams.

Parameters:

  • authToken (string): Authentication token

  • userId (string): User ID of the requesting user

  • url (string): The base URL of your Buzzy instance

  • teamIDs (array): Array of team IDs to get members for

Returns:

  • Promise resolving to an array of team members

Example:

MicroAppChild Operations

MicroAppChild operations allow you to manage file attachments and child items within MicroApp data structures. These operations are essential for handling file uploads, attachments, and hierarchical data relationships.

createMicroAppChild

Creates a new MicroAppChild entry, typically used for file attachments or child data items.

Parameters:

  • authToken (string): Authentication token

  • userId (string): User ID of the requesting user

  • url (string): The base URL of your Buzzy instance

  • microAppResourceID (string): ID of the MicroApp resource

  • appID (string): ID of the parent app item

  • fieldID (string): ID of the parent field

  • content (object): Content data for the child item

Returns:

  • Promise resolving to an object containing the created child ID

Example:

getChildItemsByField

Retrieves all MicroAppChild items for a specific parent app item and field.

Parameters:

  • authToken (string): Authentication token

  • userId (string): User ID of the requesting user

  • url (string): The base URL of your Buzzy instance

  • appID (string): ID of the parent app item

  • fieldID (string): ID of the parent field

Returns:

  • Promise resolving to an array of child items

Example:

readMicroAppChild

Reads a specific MicroAppChild item by its ID.

Parameters:

  • authToken (string): Authentication token

  • userId (string): User ID of the requesting user

  • url (string): The base URL of your Buzzy instance

  • childID (string): ID of the child item to read

Returns:

  • Promise resolving to the child item data

Example:

updateMicroAppChild

Updates the content of an existing MicroAppChild item.

Parameters:

  • authToken (string): Authentication token

  • userId (string): User ID of the requesting user

  • url (string): The base URL of your Buzzy instance

  • childID (string): ID of the child item to update

  • content (object): New content data for the child item

Returns:

  • Promise resolving to the update result

Example:

removeMicroAppChild

Deletes a MicroAppChild item.

Parameters:

  • authToken (string): Authentication token

  • userId (string): User ID of the requesting user

  • url (string): The base URL of your Buzzy instance

  • childID (string): ID of the child item to delete

Returns:

  • Promise resolving to the deletion result

Example:

AI-Powered App Creation

createAppWithPrompt

Creates a new app using AI based on a natural language prompt.

Parameters:

  • authToken (string): Authentication token

  • userId (string): User ID of the requesting user

  • url (string): The base URL of your Buzzy instance

  • prompt (string): Natural language description of the app to create

  • organizationID (string): ID of the organization to create the app in

Returns:

  • Promise resolving to the created app information

Example:

S3 File Operations

copyS3File

Copies a file between S3 locations.

Parameters:

  • authToken (string): Authentication token

  • userId (string): User ID

  • url (string): Buzzy instance URL

  • sourceResourceID (string): Source resource ID

  • destinationResourceID (string): Destination resource ID

  • fileKey (string): File key to copy

  • newFileKey (string, optional): Optional new file key

Returns:

  • Promise resolving to copy response with signed URL

Example:

uploadFileToS3

Uploads a file to S3 from a URL.

Parameters:

  • authToken (string): Authentication token

  • userId (string): User ID

  • url (string): Buzzy instance URL

  • resourceID (string): Resource ID

  • fieldID (string): Field ID

  • fileUrl (string): URL of file to upload

  • filename (string): Filename for the upload

Returns:

  • Promise resolving to upload response with URL

Example:

Comprehensive Examples

File Attachment Workflow

Here's a complete example showing how to create, manage, and delete file attachments using MicroAppChild operations:

Organization and Team Management Lifecycle

Last updated