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

login({ url, email, password })

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

logout({ authToken, userId, url })

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:

const result = await logout({
  authToken: 'your-auth-token',
  userId: 'user-id',
  url: 'https://your-buzzy-instance.com'
});

getUserID

getUserID({ authToken, userId, url, email })

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

insertMicroAppRow({
  microAppID,
  authToken,
  userId,
  url,
  rowData,
  embeddingRowID,
  viewers,
  userID
})

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

getMicroAppData({
  microAppID,
  authToken,
  userId,
  url,
  optSearchFilters,
  searchFilter,
  optViewFilters,
  optIsVectorSearch,
  optVectorSearchString,
  optLimit
})

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

getMicroAppDataRow({ rowID, authToken, userId, url })

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

removeMicroAppRow(rowID, authToken, userId, url)

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

updateMicroAppDataRow({
  rowID,
  authToken,
  userId,
  url,
  rowData,
  creatorID
})

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

insertOrganization({ authToken, userId, url, organizationInfo })

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

insertTeam({ authToken, userId, url, teamInfo, adminID })

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

insertTeamMembers({
  authToken,
  userId,
  url,
  teamIDs,
  emails,
  userIDs,
  targetInitialApp,
  targetInitialScreen,
  targetRoute
})

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

enforceTeamMembership({ authToken, userId, url, userID, email, teamIDs })

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:

const result = await enforceTeamMembership({
  authToken: 'your-auth-token',
  userId: 'admin-user-id',
  url: 'https://your-buzzy-instance.com',
  email: '[email protected]',
  teamIDs: ['team-id-1', 'team-id-2']
});

getTeamMembers

getTeamMembers({ authToken, userId, url, teamIDs })

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:

const result = await getTeamMembers({
  authToken: 'your-auth-token',
  userId: 'user-id',
  url: 'https://your-buzzy-instance.com',
  teamIDs: ['team-id-1', 'team-id-2']
});

AI-Powered App Creation

createAppWithPrompt

createAppWithPrompt({ url, apiKey, userEmail, appPrompt, attachments })

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:

const result = await createAppWithPrompt({
  url: 'https://your-buzzy-instance.com',
  apiKey: 'your-api-key',
  userEmail: '[email protected]',
  appPrompt: 'Create a task management app with user assignments',
  attachments: []
});

S3 File Operations

copyS3File

copyS3File({ authToken, userId, url, sourceResourceID, destinationResourceID, fileKey, newFileKey })

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:

const result = await copyS3File({
  authToken: 'your-auth-token',
  userId: 'user-id',
  url: 'https://your-buzzy-instance.com',
  sourceResourceID: 'source-resource-id',
  destinationResourceID: 'dest-resource-id',
  fileKey: 'path/to/file.pdf'
});

uploadFileToS3

uploadFileToS3({ authToken, userId, url, resourceID, fieldID, fileUrl, filename })

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:

const result = await uploadFileToS3({
  authToken: 'your-auth-token',
  userId: 'user-id',
  url: 'https://your-buzzy-instance.com',
  resourceID: 'resource-id',
  fieldID: 'field-id',
  fileUrl: 'https://example.com/document.pdf',
  filename: 'document.pdf'
});

Last updated