Static ReadonlyContinueactivity.valueType that indicates additional key/values for the ContinueConversation event.
Continues a stored conversation by executing the given handler within the context of that conversation, looking it up by ID.
See the Conversation overload for full details.
The channel adapter used to continue the conversation.
The ID of a conversation previously stored via storeConversation.
The route handler to execute within the continued conversation context.
OptionalautoSignInHandlers: string[]Optional list of OAuth connection names whose tokens should be acquired before invoking the handler.
OptionalcontinuationActivity: Partial<Activity>Optional activity fields merged into the continuation activity,
making them available on ctx.activity inside the handler (e.g. value, valueType).
Continues an existing conversation by executing the given handler within the context of the provided Conversation reference. The handler receives a TurnContext and a freshly loaded TurnState scoped to the original conversation, enabling the agent to respond as if replying to an incoming activity.
The channel adapter used to continue the conversation.
A Conversation instance created via its constructor or
ConversationBuilder.
The route handler to execute within the continued conversation context.
OptionalautoSignInHandlers: string[]Optional list of OAuth connection names whose tokens should be acquired before invoking the handler.
OptionalcontinuationActivity: Partial<Activity>Optional activity fields merged into the continuation activity,
making them available on ctx.activity inside the handler (e.g. value, valueType).
Exceptions thrown inside the handler are captured and re-thrown after the adapter callback completes, since the adapter would otherwise silently swallow them.
If autoSignInHandlers are supplied and the application has user authorization configured,
tokens are acquired before the handler is called. If not all tokens are available and
proactiveOptions.failOnUnsignedInConnections is not false, an error is thrown.
// Continue a conversation with a custom value payload
const conv = await app.proactive.getConversationOrThrow(convId)
await app.proactive.continueConversation(
adapter,
conv,
async (ctx, state) => {
const payload = ctx.activity.value as { alertType: string }
await ctx.sendActivity(`Alert triggered: ${payload.alertType}`)
},
undefined,
{ value: { alertType: 'threshold-exceeded' }, valueType: Proactive.ContinueConversationValueType }
)
Creates a new conversation using the specified channel adapter and conversation options.
The channel adapter used to create the conversation. Must implement
createConversationAsync() (i.e. a CloudAdapter instance).
Details required to create the conversation, including identity, channel,
service URL, OAuth scope, and ConversationParameters. Build with
CreateConversationOptionsBuilder.
Optionalhandler: RouteHandler<TState>Optional route handler executed immediately after the conversation is created.
The newly created Conversation.
This wraps CloudAdapter.createConversationAsync(), which requires real network connectivity
and authentication. The provided adapter must implement
createConversationAsync(); a TypeError is thrown if it does not.
If createOptions.storeConversation is true, the resulting Conversation is
automatically stored via storeConversation so it can be retrieved by ID later.
If a handler is provided it is executed within the newly created conversation, giving the
agent a chance to send an initial message or load state.
// Initiate a new 1:1 conversation with a Teams user and send a welcome message
const opts = CreateConversationOptionsBuilder
.create(process.env.APP_ID!, 'msteams')
.withUser('user-aad-object-id')
.withTenantId('tenant-id')
.storeConversation(true)
.build()
const conv = await app.proactive.createConversation(adapter, opts, async (ctx, state) => {
await ctx.sendActivity('Hi! I have an update for you.')
})
console.log('New conversation ID:', conv.reference.conversation.id)
Deletes the stored conversation reference for the given conversation ID.
The unique identifier of the conversation whose reference should be deleted.
Retrieves the stored Conversation associated with the given conversation ID.
The unique identifier of the conversation to retrieve.
The stored Conversation, or undefined if no record exists for that ID.
Retrieves the stored Conversation for the given ID, throwing if no record is found.
The unique identifier of the conversation to retrieve.
The stored Conversation.
Sends an activity to a stored conversation, looking it up by ID.
The channel adapter used to send the activity.
The ID of a conversation previously stored via storeConversation.
The activity to send. If type is not set it defaults to 'message'.
A ResourceResponse with the ID of the sent activity.
Sends an activity to an existing conversation using the provided Conversation reference.
The channel adapter used to send the activity.
A Conversation instance created via its constructor or
ConversationBuilder.
The activity to send. If type is not set it defaults to 'message'.
A ResourceResponse with the ID of the sent activity.
Stores the current conversation reference from a live TurnContext in proactive storage.
The context object for the current turn, containing activity and conversation information.
The conversation ID that can be used to retrieve the reference in future operations.
Stores an explicit Conversation object in proactive storage.
The conversation reference record to store.
The conversation ID that can be used to retrieve the reference in future operations.
Provides methods for storing, retrieving, and managing conversation references to enable proactive messaging scenarios. Supports sending activities and continuing conversations outside the standard request/response flow using stored conversation references.
Remarks
Use the
Proactiveclass to implement scenarios where an agent needs to initiate conversations or send messages to users without an incoming activity, such as notifications or scheduled alerts. Some operations require that conversation references be stored using storeConversation before they can be used.Access via
app.proactiveafter configuringproactivein AgentApplicationOptions.