Skip to content

Commit ef996e8

Browse files
authored
Add traceActivities sample (#518)
1 parent 3b32212 commit ef996e8

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

samples/basic/traceActivities.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
4+
import { startServer } from '@microsoft/agents-hosting-express'
5+
import { AgentApplication, MemoryStorage, TurnContext, TurnState } from '@microsoft/agents-hosting'
6+
7+
const agent = new AgentApplication<TurnState>({ storage: new MemoryStorage() })
8+
9+
agent.onConversationUpdate('membersAdded', async (context: TurnContext) => {
10+
await context.sendActivity('Welcome to the Trace Activities sample, send a message to see the feature in action.\nTrace activities are only shown in the Emulator channel.')
11+
})
12+
13+
agent.onActivity('message', async (context: TurnContext) => {
14+
await context.sendTraceActivity('Testing Trace', 'This is a trace activity')
15+
await context.sendActivity('I sent you a Trace activity. Check the inspection panel')
16+
})
17+
18+
startServer(agent)

0 commit comments

Comments
 (0)