Options
All
  • Public
  • Public/Protected
  • All
Menu

Message builder class that simplifies building complex messages with attachments.

Hierarchy

  • Message

Implements

Index

Constructors

constructor

  • Creates a new Message builder.

    Parameters

    • Optional session: Session

      (Optional) will be used to populate the messages address and localize any text.

    Returns Message

Properties

Protected data

data: IMessage

Internal message object being built.

Methods

addAttachment

addEntity

address

  • Address routing information for the message. Save this field to external storage somewhere to later compose a proactive message to the user.

    Parameters

    Returns Message

attachmentLayout

  • attachmentLayout(style: string): Message
  • Hint for how clients should layout multiple attachments. The default value is 'list'.

    Parameters

    • style: string

    Returns Message

attachments

compose

  • compose(prompts: string[], ...args: any[]): Message
  • Composes a complex and randomized reply to the user.

    Parameters

    • prompts: string[]
    • Rest ...args: any[]

    Returns Message

composePrompt

  • composePrompt(session: Session, prompts: string[], ...args: any[]): Message

entities

  • entities(list: Object[]): Message

inputHint

  • Hint for clients letting them know if the bot is expecting further input or not. The built-in prompts will automatically populate this value for outgoing messages.

    Parameters

    • hint: string

    Returns Message

localTimestamp

  • localTimestamp(time?: string): Message
  • Local time when message was sent (set by client or bot, Ex: 2016-09-23T13:07:49.4714686-07:00.)

    Parameters

    • Optional time: string

      (Optional) time expressed as an ISO string. Defaults to new Date().toISOString().

    Returns Message

nspeak

ntext

originalEvent

  • originalEvent(event: any): Message
  • Message in original/native format of the channel for incoming messages.

    Parameters

    • event: any

    Returns Message

setChannelData

  • setChannelData(data: any): Message

setLanguage

  • setLanguage(language: string): Message

setNText

  • setNText(session: Session, msg: string, msg_plural: string, count: number): Message

setText

sourceEvent

speak

suggestedActions

summary

  • Text to be displayed by as fall-back and as short description of the message content in e.g. list of recent conversations.

    Parameters

    Returns Message

text

textFormat

  • textFormat(style: string): Message

textLocale

  • textLocale(locale: string): Message

timestamp

  • timestamp(time?: string): Message

toMessage

Static composePrompt

  • composePrompt(session: Session, prompts: string[], args?: any[]): string
  • Combines an array of prompts into a single localized prompt and then optionally fills the prompts template slots with the passed in arguments.

    Parameters

    • session: Session

      Session object used to localize the individual prompt parts.

    • prompts: string[]

      Array of prompt lists. Each entry in the array is another array of prompts which will be chosen at random. The combined output text will be space delimited.

    • Optional args: any[]

      (Optional) array of arguments used to format the output text when the prompt is a template.

    Returns string

Static randomPrompt

  • randomPrompt(prompts: TextType): string
  • Selects a prompt at random.

    Parameters

    • prompts: TextType

      Array of prompts to choose from. When prompts is type string the prompt will simply be returned unmodified.

    Returns string

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method