Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • Message
    • MessageEvent

Implements

  • IIsMessage

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 MessageEvent

Properties

Protected data

data: IMessage

Internal message object being built.

Methods

addAttachment

  • addAttachment(attachment: AttachmentType): Message
  • Adds an attachment to the message. See IAttachment for examples.

    Parameters

    • attachment: AttachmentType

      The attachment to add.

    Returns Message

addEntity

  • addEntity(obj: Object): Message
  • Adds an entity to the message.

    Parameters

    • obj: Object

    Returns Message

address

  • address(adr: IAddress): Message
  • Address routing information for the message. Save this field to external storage somewhere to later compose a proactive message to the user.

    Parameters

    • adr: IAddress

    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

  • attachments(list: AttachmentType[]): Message
  • Cards or images to send to the user.

    Parameters

    • list: AttachmentType[]

    Returns Message

code

  • code(value: string): Message
  • Code indicating why the conversation has ended.

    Parameters

    • value: string

    Returns Message

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
  • DEPRECATED use compose() instead.

    Parameters

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

    Returns Message

entities

  • entities(list: Object[]): Message
  • Structured objects passed to the bot or user.

    Parameters

    • list: Object[]

    Returns Message

inputHint

  • inputHint(hint: string): Message
  • 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

name

  • name(name: string): Message
  • Name of the operation to invoke or the name of the event.

    Parameters

    • name: string

    Returns Message

nspeak

  • nspeak(ssml: TextType, ssml_plural: TextType, count: number): Message
  • Conditionally set the speak field of the message given a specified count.

    Parameters

    • ssml: TextType
    • ssml_plural: TextType
    • count: number

    Returns Message

ntext

  • ntext(msg: TextType, msg_plural: TextType, count: number): Message
  • Conditionally set the message text given a specified count.

    Parameters

    • msg: TextType
    • msg_plural: TextType
    • count: number

    Returns Message

originalEvent

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

    Parameters

    • event: any

    Returns Message

relatesTo

  • relatesTo(adr: IAddress): Message
  • Reference to another conversation or message.

    Parameters

    • adr: IAddress

    Returns Message

setChannelData

  • setChannelData(data: any): Message
  • DEPRECATED use sourceEvent() instead.

    Parameters

    • data: any

    Returns Message

setLanguage

  • setLanguage(language: string): Message
  • DEPRECATED use local() instead.

    Parameters

    • language: string

    Returns Message

setNText

  • setNText(session: Session, msg: string, msg_plural: string, count: number): Message
  • DEPRECATED use ntext() instead.

    Parameters

    • session: Session
    • msg: string
    • msg_plural: string
    • count: number

    Returns Message

setText

  • setText(session: Session, prompt: TextType, ...args: any[]): Message
  • DEPRECATED use text() instead.

    Parameters

    • session: Session
    • prompt: TextType
    • Rest ...args: any[]

    Returns Message

sourceEvent

  • sourceEvent(sourceEvent: any): this
  • Parameters

    • sourceEvent: any

    Returns this

speak

  • speak(ssml: TextType, ...args: any[]): Message
  • Sets the speak field of the message as Speech Synthesis Markup Language (SSML).aspx). This will be spoken to the user on supported devices.

    Parameters

    • ssml: TextType
    • Rest ...args: any[]

    Returns Message

suggestedActions

  • suggestedActions(suggestedActions: ISuggestedActions | IIsSuggestedActions): Message
  • Optional suggested actions to send to the user. Suggested actions will be displayed only on the channels that support suggested actions.

    Parameters

    • suggestedActions: ISuggestedActions | IIsSuggestedActions

    Returns Message

summary

  • summary(text: TextType, ...args: any[]): Message
  • Text to be displayed by as fall-back and as short description of the message content in e.g. list of recent conversations.

    Parameters

    • text: TextType
    • Rest ...args: any[]

    Returns Message

text

  • text(text: TextType, ...args: any[]): Message
  • Sets the message text.

    Parameters

    • text: TextType
    • Rest ...args: any[]

    Returns Message

textFormat

  • textFormat(style: string): Message
  • Format of text fields.

    Parameters

    • style: string

    Returns Message

textLocale

  • textLocale(locale: string): Message
  • Language of the message.

    Parameters

    • locale: string

    Returns Message

timestamp

  • timestamp(time?: string): Message
  • Set by connectors service. Use localTimestamp() instead.

    Parameters

    • Optional time: string

    Returns Message

toMessage

  • toMessage(): IMessage
  • Returns the JSON for the message.

    Returns IMessage

value

  • value(param: any): Message
  • Open-ended value.

    Parameters

    • param: any

    Returns Message

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