Options
All
  • Public
  • Public/Protected
  • All
Menu

Module monitoring

Monitoring API

Provides a basic utility for monitoring a running bot process. It is configurable, with options to notify a maintainer if the bot goes down, automatically retry logins for stale processes, and restart the bot process entirely if all else fails.

Index

Functions

Const cancelMonitoring

  • cancelMonitoring(): void
  • Cancels the monitoring of the current bot process.

    Returns void

Const criticalError

  • criticalError(msg: string): void
  • Safe function to call from other packages that will alert the maintainer if monitoring is on, and no-op otherwise.

    Parameters

    • msg: string

      Message for the maintainer about the issue

    Returns void

Const monitor

  • monitor(apiInstance: API, maintainerId: string, botName: string, credentialsObj: LoginCredentials, botProcessRef: Process, retryLoginCallback: (api: API) => void, pingIntervalInMinutes?: number): void
  • Begins monitoring a specified API instance.

    Parameters

    • apiInstance: API

      An instance of the facebook-chat-api to monitor

    • maintainerId: string

      User ID of the maintainer to notify on failures

    • botName: string

      Name of the bot running

    • credentialsObj: LoginCredentials

      Object containing the user credentials

    • botProcessRef: Process

      Node.js process to monitor (optional)

    • retryLoginCallback: (api: API) => void

      A callback to send a new API instance to if login failed and a re-attempted login succeeded (optional – omitting this callback is equivalent to disabling the retry login feature)

        • (api: API): void
        • Parameters

          • api: API

          Returns void

    • pingIntervalInMinutes: number = 10

    Returns void

Generated using TypeDoc