Options
All
  • Public
  • Public/Protected
  • All
Menu

Index

Functions

createRouterForBot

  • createRouterForBot(routerName: string, options?: RouterOptions): any
  • Create a new router for a module. Once created, use them to register new endpoints. Routers created with this method are accessible via the url /mod/{routernName}

    example

    const router = bp.http.createRouterForBot('myModule')

    example

    router.get('/list', ...)

    example

    axios.get('/mod/myModule/list')

    Parameters

    • routerName: string

      The name of the router

    • Optional options: RouterOptions

      Additional options to apply to the router

    Returns any

createShortLink

  • createShortLink(name: string, destination: string, params?: any): void
  • Create a shortlink to any destination

    example

    bp.http.createShortLink('chat', '/lite', {m: 'channel-web', v: 'fullscreen' })

    example

    http://localhost:3000/s/chat

    Parameters

    • name: string

      The name of the link, must be unique

    • destination: string

      The URL to redirect to. It can be relative or absolute

    • Optional params: any

      An optional query string to add at the end of the url. You may specify an object

    Returns void

deleteShortLink

  • deleteShortLink(name: any): void
  • Delete any previously created short link

    Parameters

    • name: any

      The name of the link to remove

    Returns void

getAxiosConfigForBot

  • Returns the required configuration to make an API call to another module by specifying only the relative path.

    Parameters

    • botId: string

      The ID of the bot for which to get the configuration

    Returns Promise<AxiosBotConfig>

    The configuration to use

Generated using TypeDoc