import { Account } from './models/account.js'; import { MentionEntity } from './models/entity/mention-entity.js'; import { QuotedReplyEntity } from './models/entity/quoted-reply-entity.js'; import { InputHint } from './models/input-hint.js'; import { TextFormat } from './models/text-format.js'; import { Attachment } from './models/attachment/attachment.js'; import { CardAttachmentType, CardAttachmentTypes } from './models/attachment/card-attachment.js'; import { AttachmentLayout } from './models/attachment/attachment-layout.js'; import { SuggestedActions } from './models/suggested-actions.js'; import { Importance } from './models/importance.js'; import { DeliveryMode } from './models/delivery-mode.js'; import { IActivity, IActivityInput, Activity, ActivityInput } from './activities/activity.js'; import { ITypingActivity } from './activities/typing.js'; import { IMessageUpdateActivity } from './activities/message/message-update.js'; /** * any activity type that has a `text` property */ type TextActivity = IMessageActivity | IMessageUpdateActivity | ITypingActivity; type StripMentionsTextOptions = { /** * the account to remove mentions for * by default, all at-mentions listed in `entities` are removed. */ accountId?: string; /** * when `true`, the inner text of the tag * will not be removed * Eg. input: Hello my-bot! How are you? * output: Hello my-bot! How are you? */ tagOnly?: boolean; }; /** * remove "\...\" text from an activity * @param activity the activity */ declare function stripMentionsText(activity: TActivity, { accountId, tagOnly }?: StripMentionsTextOptions): TActivity['text']; interface IMessageActivity extends IActivity<'message'> { /** * The text content of the message. */ text: string; /** * The text to speak. * @deprecated This will be removed by end of summer 2026. */ speak?: string; /** * Indicates whether your bot is accepting, * expecting, or ignoring user input after the message is delivered to the client. Possible * values include: 'acceptingInput', 'ignoringInput', 'expectingInput' * @deprecated This will be removed by end of summer 2026. */ inputHint?: InputHint; /** * The text to display if the channel cannot render cards. */ summary?: string; /** * Format of text fields Default:markdown. Possible values include: 'markdown', 'plain', 'xml', 'extendedmarkdown'. See {@link TextFormat} for all values */ textFormat?: TextFormat; /** * The layout hint for multiple attachments. Default: list. Possible values include: 'list', * 'carousel' */ attachmentLayout?: AttachmentLayout; /** * Attachments */ attachments?: Attachment[]; /** * The suggested actions for the activity. */ suggestedActions?: SuggestedActions; /** * The importance of the activity. Possible values include: 'low', 'normal', 'high' * @deprecated This will be removed by end of summer 2026. */ importance?: Importance; /** * A delivery hint to signal to the recipient alternate delivery paths for the activity. * The default delivery mode is "default". Possible values include: 'normal', 'notification' */ deliveryMode?: DeliveryMode; /** * The time at which the activity should be considered to be "expired" and should not be * presented to the recipient. * @deprecated This will be removed by end of summer 2026. */ expiration?: Date; /** * A value that is associated with the activity. */ value?: any; /** * remove "\...\" text from an activity */ stripMentionsText(options?: StripMentionsTextOptions): IMessageActivity; /** * is the recipient account mentioned */ isRecipientMentioned(): boolean; /** * get a mention by the account id if exists */ getAccountMention(accountId: string): MentionEntity | undefined; /** * get all quoted reply entities from this message */ getQuotedMessages(): QuotedReplyEntity[]; } /** * OUTBOUND message activity — what the app SENDS. * * All server-populated base fields optional (via {@link IActivityInput}) and the * message-specific fields optional too, so both a plain `{ type: 'message', text }` * literal and a {@link MessageActivityInput} builder instance are assignable. The message * fields are copied here instead of derived from {@link IMessageActivity}, keeping the * outbound input shape independent from the inbound activity interface. Use * {@link MessageActivityInputOptions} to include unmodeled extension fields when constructing * a {@link MessageActivityInput}. */ interface IMessageActivityInput extends IActivityInput<'message'> { /** * Message text. */ text?: string; /** * Format of the message text. */ textFormat?: TextFormat; /** * Layout hint for multiple attachments. */ attachmentLayout?: AttachmentLayout; /** * Attachments sent with the message. */ attachments?: Attachment[]; /** * Suggested actions presented with the message. */ suggestedActions?: SuggestedActions; } /** * Constructor fields for {@link MessageActivityInput}. * * This accepts modeled outbound message fields plus channel/service extension fields that * should serialize at the top level of the outbound activity payload. The constructor owns * the `type` discriminator and message `text`; pass text as the first constructor argument * or set it with {@link MessageActivityInput.withText}. */ type MessageActivityInputOptions = Omit, 'type' | 'text'> & Record; /** * Builder for outbound message activities. */ declare class MessageActivityInput extends ActivityInput<'message'> implements IMessageActivityInput { /** * Message text. */ text?: string; /** * Format of the message text. */ textFormat?: TextFormat; /** * Layout hint for multiple attachments. */ attachmentLayout?: AttachmentLayout; /** * Attachments sent with the message. */ attachments?: Attachment[]; /** * Suggested actions presented with the message. */ suggestedActions?: SuggestedActions; /** * Create an outbound message activity input. * @param text - Initial message text. * @param value - Initial modeled input fields and unmodeled extension fields to serialize. */ constructor(text?: string, value?: MessageActivityInputOptions); /** * Copy outbound-safe fields from a message-like activity input. * @param activity - Message input to copy. */ static from(activity: IMessageActivity): MessageActivityInput; static from(activity: IMessageActivityInput): MessageActivityInput; static from(activity: IMessageActivity | IMessageActivityInput): MessageActivityInput; /** * Set the message text. * @param value - Message text. */ withText(value: string): this; /** * Append text to the message. * @param value - Text to append. */ addText(value: string): this; /** * Set the message text format. * @param value - Text format. */ withTextFormat(value: TextFormat): this; /** * Set the attachment layout. * @param value - Attachment layout. */ withAttachmentLayout(value: AttachmentLayout): this; /** * Set suggested actions for the message. * @param value - Suggested actions. */ withSuggestedActions(value: SuggestedActions): this; /** * Add attachments to the message. * @param value - Attachments to add. */ addAttachments(...value: Attachment[]): this; /** * Add a card attachment to the message. * @param type - Card attachment type. * @param content - Card content. */ addCard(type: T, content: CardAttachmentTypes[T]['content']): this; /** * Add a mention entity and optionally append mention text. * @param account - Account being mentioned. * @param options - Mention options. */ addMention(account: Account, options?: AddMentionOptions): this; /** * Mark the message as the final activity in a stream. */ addStreamFinal(): this; /** * Add a quoted message reference and append a `` placeholder to text. * Teams renders the quoted message as a preview bubble above the response text. * If text is provided, it is appended to the quoted message placeholder. * @param messageId - The ID of the message to quote * @param text - Optional text, appended to the quoted message placeholder * @returns this instance for chaining */ addQuote(messageId: string, text?: string): this; /** * Prepend a quotedReply entity and `` placeholder * before existing text. Used by reply()/quote() for quote-above-response. * @param messageId - The IC3 message ID of the message to quote */ prependQuote(messageId: string): this; } declare class MessageActivity extends Activity<'message'> implements IMessageActivity { /** * The text content of the message. */ text: string; /** * The text to speak. * @deprecated This will be removed by end of summer 2026. */ speak?: string; /** * Indicates whether your bot is accepting, * expecting, or ignoring user input after the message is delivered to the client. Possible * values include: 'acceptingInput', 'ignoringInput', 'expectingInput' * @deprecated This will be removed by end of summer 2026. */ inputHint?: InputHint; /** * The text to display if the channel cannot render cards. */ summary?: string; /** * Format of text fields Default:markdown. Possible values include: 'markdown', 'plain', 'xml', 'extendedmarkdown'. See {@link TextFormat} for all values */ textFormat?: TextFormat; /** * The layout hint for multiple attachments. Default: list. Possible values include: 'list', * 'carousel' */ attachmentLayout?: AttachmentLayout; /** * Attachments */ attachments?: Attachment[]; /** * The suggested actions for the activity. */ suggestedActions?: SuggestedActions; /** * The importance of the activity. Possible values include: 'low', 'normal', 'high' * @deprecated This will be removed by end of summer 2026. */ importance?: Importance; /** * A delivery hint to signal to the recipient alternate delivery paths for the activity. * The default delivery mode is "default". Possible values include: 'normal', 'notification' */ deliveryMode?: DeliveryMode; /** * The time at which the activity should be considered to be "expired" and should not be * presented to the recipient. * @deprecated This will be removed by end of summer 2026. */ expiration?: Date; /** * A value that is associated with the activity. */ value?: any; constructor(text?: string, value?: Omit, 'type'>); /** * initialize from interface */ static from(activity: IMessageActivity): MessageActivity; /** * convert to interface */ toInterface(): IMessageActivity; /** * copy to a new instance */ clone(options?: Omit, 'type'>): MessageActivity; /** * The text content of the message. */ withText(value: string): this; /** * The text to speak. * @deprecated This will be removed by end of summer 2026. */ withSpeak(value: string): this; /** * Indicates whether your bot is accepting, * expecting, or ignoring user input after the message is delivered to the client. Possible * values include: 'acceptingInput', 'ignoringInput', 'expectingInput' * @deprecated This will be removed by end of summer 2026. */ withInputHint(value: InputHint): this; /** * The text to display if the channel cannot render cards. */ withSummary(value: string): this; /** * Format of text fields Default:markdown. Possible values include: 'markdown', 'plain', 'xml', 'extendedmarkdown'. See {@link TextFormat} for all values */ withTextFormat(value: TextFormat): this; /** * The layout hint for multiple attachments. Default: list. Possible values include: 'list', * 'carousel' */ withAttachmentLayout(value: AttachmentLayout): this; /** * The suggested actions for the activity. */ withSuggestedActions(value: SuggestedActions): this; /** * The importance of the activity. Possible values include: 'low', 'normal', 'high' * @deprecated This will be removed by end of summer 2026. */ withImportance(value: Importance): this; /** * A delivery hint to signal to the recipient alternate delivery paths for the activity. * The default delivery mode is "default". Possible values include: 'normal', 'notification' */ withDeliveryMode(value: DeliveryMode): this; /** * The time at which the activity should be considered to be "expired" and should not be * presented to the recipient. * @deprecated This will be removed by end of summer 2026. */ withExpiration(value: Date): this; /** * Append text */ addText(text: string): this; /** * Attachments */ addAttachments(...value: Attachment[]): this; /** * `@mention` an account * @param account the account to mention * @param options options to customize the mention */ addMention(account: Account, options?: AddMentionOptions): this; /** * Add a card attachment */ addCard(type: T, content: CardAttachmentTypes[T]['content']): this; /** * remove "\...\" text from an activity */ stripMentionsText(options?: StripMentionsTextOptions): this; /** * is the recipient account mentioned */ isRecipientMentioned(): boolean; /** * get a mention by the account id if exists */ getAccountMention(accountId: string): MentionEntity | undefined; /** * get all quoted reply entities from this message */ getQuotedMessages(): QuotedReplyEntity[]; /** * Add stream info, making * this a final stream message */ addStreamFinal(): this; /** * Set the recipient of this message, optionally marking it as a targeted (ephemeral) message. * Targeted messages are only visible to the specified recipient in a shared conversation. * @param account - The recipient account * @param isTargeted - If true, marks this as a targeted message visible only to the recipient * @returns this instance for chaining * * Diagnostic: ExperimentalTeamsTargeted */ withRecipient(account: Account, isTargeted?: boolean): this; /** * Add a quoted message reference and append a `` placeholder to text. * Teams renders the quoted message as a preview bubble above the response text. * If text is provided, it is appended to the quoted message placeholder. * @param messageId - The ID of the message to quote * @param text - Optional text, appended to the quoted message placeholder * @returns this instance for chaining */ addQuote(messageId: string, text?: string): this; /** * Prepend a quotedReply entity and `` placeholder * before existing text. Used by reply()/quote() for quote-above-response. * @param messageId - The IC3 message ID of the message to quote */ prependQuote(messageId: string): this; } /** * options for adding a mention * to an activity */ type AddMentionOptions = { /** * if `true`, append the mention `text` to the `activity.text` * @default true */ readonly addText?: boolean; /** * the `text` to use for the mention * * @default `account.name` * @remark * this text should not include `` or `` */ readonly text?: string; }; export { type AddMentionOptions as A, type IMessageActivity as I, MessageActivity as M, type StripMentionsTextOptions as S, type IMessageActivityInput as a, MessageActivityInput as b, type MessageActivityInputOptions as c, stripMentionsText as s };