Tag Archives: chat

Create and Deploy a Chat Bot to AWS Lambda in Five Minutes

Post Syndicated from Bryan Liston original https://aws.amazon.com/blogs/compute/create-and-deploy-a-chat-bot-to-aws-lambda-in-five-minutes/

This is a guest post by Gojko Adzic, creator of ClaudiaJS

 

The new Claudia.JS Bot Builder project helps JavaScript developers to easily create chat-bots for Facebook, Telegram, Skype, and Slack, and deploy them to AWS Lambda and Amazon API Gateway in minutes.

The key idea behind this project is to remove all the boilerplate code and common infrastructure tasks, so you can focus on writing the really important part of the bot — your business workflows. Everything else is handled by the Claudia Bot Builder.

The Claudia Bot Builder library simplifies messaging workflows, automatically sets up the correct web hooks, and guides you through configuration steps, so you don’t have to research individual implementation protocols. It automatically converts the incoming messages from various platforms into a common format, so you can handle them easily. It also automatically packages the responses into the correct templates, so you do not have to worry about different message response formats. This means that you can write and deploy a single bot with just a few lines of code, and operate it on various bot platforms using AWS Lambda. Check out the two-minute video Create chat-bots easily using Claudia Bot Builder to see how easy it is to set up a bot on AWS using the new tool.

Here’s a simple example:

Prerequisites

The Claudia Bot Builder works with the Node.JS 4.3.2 AWS Lambda installation. It requires using the Claudia.JS deployment tool, which you can install using NPM:

npm install claudia -g

If you already have Claudia installed, make sure it’s up to date. The Claudia Bot Builder support requires version 1.4.0 or later.

Creating a simple text bot

First, create an empty folder, and a new NPM project inside it. Make sure to give it a descriptive name:

npm init

Then, add the claudia-bot-builder library as a project dependency:

npm install claudia-bot-builder -S

For this particular bot, generate some dynamic content using the huh excuse generator. Add that as a project dependency:

npm install huh -S

Now create the bot. Create a file called bot.js and paste the following content:

var botBuilder = require('claudia-bot-builder'),
    excuse = require('huh');

module.exports = botBuilder(function (request) {
  return 'Thanks for sending ' + request.text  + 
      '. Your message is very important to us, but ' + 
      excuse.get();
});

That’s pretty much it. You can now deploy the bot to AWS and configure it for Facebook Messenger, by using Claudia:

claudia create --region us-east-1 --api-module bot --configure-fb-bot

Now would be a good time to configure a new Facebook page and a messenger application, as explained in the Facebook Messenger Getting Started Guide. The bot installer prints the web hook URL and the verification token, which you can copy to your Facebook Messenger configuration page. You can then generate the page access token from Facebook. Copy that back to Claudia when asked, and you’re almost done.

In a few moments, your bot will be live, and you can talk to it from the page you created. That was easy, wasn’t it?

If you’d like other Facebook users to talk to it as well, submit it for application review from the Facebook App Developer page.

Deploying to other platforms

The Claudia Bot Builder can also help you set up this bot for all the other platforms. Just run claudia update and provide the additional configuration option:

  • For Slack slash commands, use –configure-slack-slash-command
  • For Skype, use –configure-skype-bot
  • For Telegram, use –configure-telegram-bot

More complex workflows

The example bot just responds with silly excuses so for homework, do something more interesting with it.

The request object passed into the message handling function contains the entire message in the text field, but it also has some other pieces of data for more complex work. The sender field identifies the user sending the message, so you can create threads of continuity and sessions. The type field contains the identifier of the bot endpoint that received the message (for example, skype or facebook) so you can respond differently to different bot systems. The originalRequest field contains the entire unparsed original message, so you can handle platform-specific requests and go beyond simple text.

For examples, check out:

  • Fact Bot, which looks up facts about topics on WikiData and creates Facebook Messenger menus.
  • Space Explorer Bot, A small FB Messenger chat bot using NASA API

Although it’s enough just to return a string value for simple cases, and the Bot Builder packages it correctly for individual bot engines, you can return a more complex object and get platform-specific features, for example, Facebook buttons. In that case, make sure to use the type field of the request to decide on additional features.

For asynchronous workflows, send back a Promise object, and resolve it with the response later. The convention is the same: if the promise gets resolved with a string, the Claudia Bot Builder automatically packages it into the correct template based on the bot endpoint that received a message. Reply with an object instead of a string, and the Bot Builder will not do any specific parsing, letting you take advantage of more advanced bot features for individual platforms. Remember to configure your Lambda function for longer execution if you plan to use asynchronous replies; by default, AWS limits this to 3 seconds.

Try it out live

You can see this bot in action and play with it live from the GitHub Claudia Examples repository.

More information

For more information on the Claudia Bot Builder, and some nice example projects, check out the Claudia Bot Builder GitHub project repository. For questions and suggestions, visit the Claudia project chat room on Gitter.

DevOps Cafe Episode 67 – Mark Imbriaco

Post Syndicated from DevOpsCafeAdmin original http://devopscafe.org/show/2016/6/8/devops-cafe-episode-67-mark-imbriaco.html

Chatting about Ops

Mark Imbriaco (Operable) returns to discuss the changing role of Operations, ChatOps, and more.   

 

  

Direct download

Follow John Willis on Twitter: @botchagalupe
Follow Damon Edwards on Twitter: @damonedwards 
Follow Mark Imbriaco on Twitter: @markimbriaco

Notes:

 

Please leave comments or questions below and we’ll read them on the show!

DevOps Cafe Episode 64 – Nicole Forsgren

Post Syndicated from DevOpsCafeAdmin original http://devopscafe.org/show/2015/11/18/devops-cafe-episode-64-nicole-forsgren.html

… it’s full of science!

John and Damon chat with researcher, data scientist, and IT operational performance expert, Dr. Nicole Forsgren. Nicole answers John and Damon’s questions about the 2015 State of DevOps Report, highlights the areas that are groundbreaking, and gives advice on how to leverage the report when you need to make the case for DevOps.


   

  

Direct download

Follow John Willis on Twitter: @botchagalupe
Follow Damon Edwards on Twitter: @damonedwards
Follow Nicole Forsgren on Twitter: @nicolefv

Notes:

 

Please leave comments or questions below and we’ll read them on the show!

DevOps Cafe Episode 63 – Josh Corman

Post Syndicated from DevOpsCafeAdmin original http://devopscafe.org/show/2015/9/2/devops-cafe-episode-63-josh-corman.html

The world just might need a philosopher superhero.

Josh Corman (Sonatype, Rugged DevOps, I am the Cavalry) joins John and Damon for a chat about why security means more than preventing theft and can’t be separated from quality, why the software supply chain can literally be about life or death, wanting to be a superhero, burnout, and more.


  

  

Direct download

Follow John Willis on Twitter: @botchagalupe
Follow Damon Edwards on Twitter: @damonedwards
Follow Josh Corman on Twitter: @joshcorman

 Notes:

 

Please leave comments or questions below and we’ll read them on the show!

UX Insights: User Interviews

Post Syndicated from Blogs on Grafana Labs Blog original https://grafana.com/blog/2015/08/06/ux-insights-user-interviews/

I’ve been conducting a series of chats with UX professionals in the Open Source community with the intention of publishing their perspectives and methods. My first chat was with the UX Lead at a very popular config management company.
Unfortunately, he never got back to me with approval, so I’ll refer to him as an anonymous source. I can say that the company described in this post is one I’ve admired for a long time, and has been doing exciting things for several years.

I wonder …

Post Syndicated from Lennart Poettering original http://0pointer.net/blog/projects/send-file.html

… whether the guys behind this know about this?

It’s a pleasure to see as many projects as possible making use of Avahi.
OTOH I believe that all solutions should speak the same protocol. Using
Apple’s somewhat standardized link-local iChat/XMPP protocol (which is what Telekinesis does) seems to be the
best option to me: because you get MacOSX interoperability for free and
many IM clients (including many on Windows) already contain support for this as
well.