Created
February 11, 2025 05:00
-
-
Save rido-min/1a742d35face19d68a557dfbc93e444f to your computer and use it in GitHub Desktop.
test-with-expect-replies
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { Activity, ActivityTypes, DeliveryModes } = require('@microsoft/agents-activity-schema') | |
const activity = new Activity(ActivityTypes.Message) | |
activity.deliveryMode = DeliveryModes.ExpectReplies | |
activity.text = 'Hello, World!' | |
activity.recipient = { id: 'bot' } | |
activity.conversation = { id: 'user' } | |
activity.channelId = 'test' | |
activity.serviceUrl = 'bot://bot' | |
const sendMessage = async activity => { | |
const response = await fetch('http://localhost:3978/api/messages', { | |
method: 'POST', | |
headers: { | |
'Content-Type': 'application/json' | |
}, | |
body: JSON.stringify(activity) | |
}) | |
if (!response.ok) { | |
throw new Error(`HTTP error! status: ${response.status}`) | |
} | |
return await response.json() | |
} | |
const main = async () => { | |
const data = await sendMessage(activity) | |
console.log(JSON.stringify(data, null, 2)) | |
} | |
main().then(() => console.log('done')).catch(console.error) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment