Using Microsoft Bot builder without Azure Subscription
Hi,
I have developed a bot service using Microsoft BotBuilder. When Bot Framework emulator is making a call to my service (running on "http://localhost:3978/"), it is getting response successfully. But, when my own chatbot (running on "http://localhost:54240") is making the call, service is throwing exception.
I am not getting the details of the exception, but it is just saving:
AggregateException_ctor_DefaultMessage (Operation returned an invalid status code 'NotFound')
I believe, this because of the service url. I want to know is this required to use Azure for any reason, for implementing it? I DON'T want to use Azure at all. Is there a way to do that? Can someone please tell me what's wrong in this code? Or if someone can provide me a simple javascript code to connect and call the Bot Service?
try {
const response = await fetch('http://localhost:3978/api/messages', {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
type: "conversationUpdate",
membersAdded: [
{ id: memberBotId, name: "Bot" },
{ id: memberUserId, name: "User" }
],
membersRemoved: [],
channelId: "emulator",
conversation: { id: `${uuidv4() }|livechat` },
id: `${uuidv4()}`,
localTimestamp: getLocalTimestamp(),
recipient: { id: memberBotId, name: "Bot", role: "bot" },
timestamp: getUTCTimestamp(),
from: { id: memberUserId, name: "User", role: "user" },
locale: "en-US",
serviceUrl: "http://localhost:54240"
})
});
if (response.ok) {
const data = await response.json();
// Handle bot's response
chatContent.innerHTML += `<div class="bot-message"><b>Bot:</b> ${data.text || "Welcome! How can I assist you today?"}</div>`;
} else {
throw new Error(`Error: ${response.statusText}`);
}
} catch (error) {
console.error("Error initializing the bot:", error);
chatContent.innerHTML += `<div class="bot-message"><b>Bot:</b> Oops! Something went wrong. Please try again later.</div>`;
}
Thanks