Options
All
  • Public
  • Public/Protected
  • All
Menu

Index

Functions

createOrUpdateContentElement

  • createOrUpdateContentElement(botId: string, contentTypeId: string, formData: string, contentElementId?: undefined | string): Promise<string>
  • Parameters

    • botId: string
    • contentTypeId: string
    • formData: string
    • Optional contentElementId: undefined | string

    Returns Promise<string>

getAllContentTypes

  • getAllContentTypes(botId?: undefined | string): Promise<ContentType[]>

getContentElement

  • getContentElement(botId: string, id: string): Promise<ContentElement>
  • Returns a single Content Element

    Parameters

    • botId: string

      The ID of the bot

    • id: string

      The element id

    Returns Promise<ContentElement>

    A content element

getContentElements

  • getContentElements(botId: string, ids: string[]): Promise<ContentElement[]>

listContentElements

renderElement

  • renderElement(contentId: string, args: any, eventDestination: EventDestination): Promise<any[]>
  • Content Types can produce multiple payloads depending on the channel and the type of message. This method can generate payloads for a specific content element or generate them for a custom payload. They can then be sent to the event engine, which sends them through the outgoing middlewares, straight to the user

    example

    const eventDestination = { target: 'user123', botId: 'welcome-bot', channel: 'web', threadId: 1 }

    example

    const payloads = await bp.cms.renderElement('builtin_text', {type: 'text', text: 'hello'}, eventDestination)

    example

    await bp.events.replyToEvent(eventDestination, payloads)

    Parameters

    • contentId: string

      Can be a ContentType (ex: "builtin_text") or a ContentElement (ex: "!builtin_text-s6x5c6")

    • args: any

      Required arguments by the content type (or the content element)

    • eventDestination: EventDestination

      The destination of the payload (to extract the botId and channel)

    Returns Promise<any[]>

    An array of payloads

Generated using TypeDoc