Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface IMessage

A chat message sent between a User and a Bot. Messages from the bot to the user come in two flavors:

  • reactive messages are messages sent from the Bot to the User as a reply to an incoming message from the user.
  • proactive messages are messages sent from the Bot to the User in response to some external event like an alarm triggering.

In the reactive case the you should copy the address field from the incoming message to the outgoing message (if you use the Message builder class and initialize it with the session this will happen automatically) and then set the text or attachments. For proactive messages you’ll need save the address from the incoming message to an external storage somewhere. You can then later pass this in to UniversalBot.beginDialog() or copy it to an outgoing message passed to UniversalBot.send().

Composing a message to the user using the incoming address object will by default send a reply to the user in the context of the current conversation. Some channels allow for the starting of new conversations with the user. To start a new proactive conversation with the user simply delete the conversation field from the address object before composing the outgoing message.

example

session.send({
     type: 'message',
     text: "Hello World!"
});

Hierarchy

Index

Properties

address

address: IAddress

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

agent

agent: string

SDK thats processing the event. Will always be 'botbuilder'.

Optional attachmentLayout

attachmentLayout: string

Hint for how clients should layout multiple attachments. The default value is 'list'.

Optional attachments

attachments: IAttachment[]

For incoming messages contains attachments like images sent from the user. For outgoing messages contains objects like cards or images to send to the user.

Optional entities

entities: any[]

Structured objects passed to the bot or user.

Optional inputHint

inputHint: string

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.

Optional localTimestamp

localTimestamp: string

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

source

source: string

The original source of the event (i.e. 'facebook', 'skype', 'slack', etc.)

sourceEvent

sourceEvent: any

The original event in the sources native schema. For outgoing messages can be used to pass source specific event data like custom attachments.

Optional speak

speak: string

Spoken message as Speech Synthesis Markup Language.aspx).

Optional summary

summary: string

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

Optional text

text: string

Message text.

Optional textFormat

textFormat: string

Format of text fields. The default value is 'markdown'.

Optional textLocale

textLocale: string

Identified language of the message text if known.

Optional timestamp

timestamp: string

UTC Time when message was sent (set by service.)

type

type: string

Defines type of event. Should be 'message' for an IMessage.

user

user: IIdentity

For incoming messages this is the user that sent the message. By default this is a copy of address.user but you can configure your bot with a lookupUser function that lets map the incoming user to an internal user id.

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