Skip to content

Instantly share code, notes, and snippets.

@rido-min
Created February 11, 2025 05:00
Show Gist options
  • Save rido-min/1a742d35face19d68a557dfbc93e444f to your computer and use it in GitHub Desktop.
Save rido-min/1a742d35face19d68a557dfbc93e444f to your computer and use it in GitHub Desktop.
test-with-expect-replies
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