Bot Framework without Azure possible?
Asked Answered
S

5

59

If i'm building a bot with the Microsoft Bot Framework, do i need to deploy my bot to Azure in order to register my bot HERE in order to configure the channels for the bot? Or can i simply deploy my bot to a normal (for example) IIS Server?

I couldnt find any information on this toppic and i dont want to use Azure.

Subaqueous answered 30/11, 2016 at 12:33 Comment(3)
Are u looking for running the bot in a development environment or would you like make your bot available to others and not using Azure for that?Anastomosis
I would like to have my bot available to others (it should be an E-Mail-Bot) and not use Azure.Subaqueous
Did you ever find a replacement for Azure Bot Service? :(Piotrowski
A
60

Yes, it should be possible to run your bot on IIS or in any other hosting service (including cloud hostings besides Azure) as explained here. You will have to make sure that your bot has an internet-accessible endpoint and a valid HTTPS cert.

Regarding the requirements for the HTTPS cert, I'm copying the info for this thread for your reference:

The Bot Framework requires that the x.509v3 certificate exposed by your endpoint be current and valid. Most of the checks for "current and valid" are standard checks for server certs: the CN must match the hostname, it must not be expired, it must not be listed in a CRL, it must have the correct set of EKUs, etc.

Most importantly, your cert must chain to a root certificate authority trusted by Microsoft. The latest list of these CAs is available here.

Also, you can register your bot and even enable the channels without deploying to Azure or any other hosting. You can temporarily use ngrok to create a secure tunnel to your localhost environment and test the bot in your email channel before exposing it to other users. BTW, you don't need to Publish your bot in the BotFramework portal, just register it. Publishing is just for those bots that would like to appear in the Bot Directory.

Anastomosis answered 30/11, 2016 at 13:11 Comment(6)
edit: With IIS i dont mean some cloud service, i mean a normal Webserver.Subaqueous
Yes, I know what IIS is :) but I wanted to be generic in the answer to address your specific request (IIS) and also potential other similar type of questionsAnastomosis
But now it seems the only way for registering a bot is by creating an Azure service.Ilsa
@Ilsa this is true however I believe that you don't have to host it with azure if you create a Bot Channels Registration Bot and host it else where. It is also free to send messages with Standard channels: azure.microsoft.com/en-gb/pricing/details/bot-serviceDardani
It's ok. Botframework does not need to be hosted on azure, but you need to configure bot channel registration in azure. There's no getting away from it. Is correct?Bruner
I want to add my own hosted bot to skype group chat, can I do it without azure ?Difficult
P
6

You need an account at Azure, but you don't need to host your bot directly at Azure. There are three options when you login to Azure dashboard: Web App Bot, Functions Bot and the Bot Channels Registration. Choose the Bot Channels Registration and type your bot's https URL (where you deployed it) there in settings.

Or if you want to debug your bot directly from the messenger (not emulator) you can download ngrok, then type in command line

ngrok.exe http <your port> -host-header="localhost:<your port>

then enter the ngrok proxy URL (without port) to Bot Channels Registration settings. Within several hours that temporary address will forward to your localhost.

Plague answered 19/9, 2018 at 11:25 Comment(0)
O
3

Yes the developing a bot is totally possible without using Azure Cloud portal.

Onomastics answered 24/5, 2018 at 7:30 Comment(1)
Hi Sarhk , Do we have any other free channel to register the Bot apart from Azure ot serviceTare
D
2

Yes your bot is like an API that is consumed by a chat frontend like Facebook Messenger, Skype etc. Check out this medium blog explaining how to host on Heroku https://medium.com/@chinnatiptaemkaeo/create-fb-bot-with-heroku-nodejs-microsoft-bot-framework-687bd2893238

Dardani answered 13/11, 2017 at 12:16 Comment(0)
B
2

It is totally possible.

I ran it 2 ways. 1st - restify service in a docker container - run locally with and ngrok and on AWS

// Create HTTP server.
const server = restify.createServer();
server.listen(process.env.port || process.env.PORT || 3978, () => {
    console.log(`\n${server.name} listening to ${server.url}`);
});

async function main(req: WebRequest, context: TurnContext) {
    logger.json("Request ->", req.body);
    try {
        for (const bot of allBots) {
            await bot.run(context);
        }
    } catch (error) {
        logger.error("Error processing request[server.ts]");
        logger.error(error);
    }
}
// Listen for incoming requests.
server.post("/api/messages", (req: WebRequest, res: WebResponse) => {
    adapter.processActivity(req, res, async (context: TurnContext) => {
        await main(req, context);
    });
});

2nd - run on AWS Lambda with Serverless framework. Here is the adapter.

export function lambda(bots: ActivityHandler[]) {
    const handler: Handler = async (event: any, _: Context, callback: Callback) => {
        logger.json("Event to bot framework: ", event);
        const reqWrapper: WebRequest = {
            body: event.body,
            headers: event.headers,
            method: event.method,
            query: event.query,
            on: (_1: string, ..._2: any[]): any => {
                // it needs to be empty
            },
        };
        let statusCode: number;
        const resWrapper: WebResponse = {
            status: (code: number) => {
                statusCode = code;
            },
            send: (body) => {
                callback(null, {statusCode, body});
            },
            end: () => {
                callback(null, { statusCode });
            },
        };

        const adapter = await getAdapter();

        adapter.processActivity(reqWrapper, resWrapper, async (context: TurnContext) => {
            await main(context, bots);
        });
    };
    return handler;
}
Basrhin answered 5/3, 2020 at 3:9 Comment(1)
Is it possible to explain this a bit more, especially the configuration part on the webchatSilures

© 2022 - 2024 — McMap. All rights reserved.