Поделиться через


HowLongHaveIGotBot - dev using the Bot Framework

Update: This is now public on Facebook if you would like to try it out: https://www.facebook.com/howlonghaveigotbot/

At the weekend I built my first bot.  I wanted to see exactly how easy it was to build one from scratch, deploy it and then hook it up to different media "channels".

Getting started is straightforward - I highly recommend reading the beginners guide here.  You'll need an idea for your bot, some kind of service and then it's just a case of coding the different responses.  Here, I went for simplicity, creating a bot that can work out how long you have until a target/due date.  As long as you pass in a valid datetime string, it calculates the duration until that target date in days, hours and minutes.  Once the logic was complete (pretty much 1 line of code..), I then deployed the solution locally and hooked it up to the Bot Framework Emulator.

localhost testing

Once I had exhausted my testing (many hours obviously..), it was time to ship it (as Azure API App under https), then hook it up with the different "bot channels".

Bot overall config

I started with Skype, this involved signing into the Skype Bot Portal and following the onscreen instructions to get the Skype Bot ID and Secret, then adding these to the Bot Framework - Skype config page.

skype config

Next up was the Facebook channel, this took a bit more effort as it required creating a Facebook Page first.  It's been quite a while since I've done any Facebook dev and the development portal has definitely changed since I last used it!  The hardest part configuring this channel was locating the Facebook Page ID, which was squirreled away under the About tab of the new page I had created.

facebook configfacebook page id

Then it was time for the Email channel, all you need is an O365 email account that your bot can respond on.  I didn't have one, so setup a new developer trial account here: https://dev.office.com/devprogram -  then aadded the credentials within the Bot Framework portal.

email config

Finally I setup the Web channel, this was the easiest to setup and just required generating a secret.

web config

What's next?  Well, I've still got the other channels to configure such as Slack, SMS etc and have already started to integrate LUIS into v2 of my bot to make it more intelligent :)

I'm still waiting the Skype and Facebook apps to accept my bot publication - but if you are interested in testing it in either of these channels then PM me.  Or watch the below video:

[video width="1280" height="720" mp4="https://msdnshared.blob.core.windows.net/media/2016/05/Skype-demo.mp4"][/video]

Meanwhile, you can interact directly with the HowLongHaveIGotBot here: https://howlonghavebot.azurewebsites.net/