Announcing Bot Framework SDK for Go

By January 20, 2020chatops
Microsoft-Bot-Framework-SDK-for-Go-thumbnail

Announcing Bot Framework SDK for Go

Consequent to a great feedback to BotKube, an application for messengers like Slack and Mattermost to monitor and debug Kubernetes deployments, we have got interests from Microsoft Teams users for an integration. An integration, which would help them monitor their Kubernetes cluster from a Teams client. Since BotKube is architecturally designed to work independently of a messaging platform, it seemed a viable thing to integrate it with Teams.

Microsoft Teams uses the Microsoft Bot Framework to allow users to write bot applications. The Bot Framework is a set of tools, SDKs, templates and services to build conversational bot applications. The official SDKs are available for Python, C#.NET, Java and Javascript. Since BotKube is built in Go, there was a need of an interface to the Bot Framework services in Go, for a seamless integration of BotKube to Teams. This encouraged us to write a Go SDK that wraps the services of the Bot Framework.

Today, we are excited to announce the first release of the Bot Framework SDK for Go; an SDK written in Go that enables users to build bot applications over the Bot Framework in Golang. The SDK enables application developers to build conversational bots for Microsoft Teams.

A bot application built using this SDK can send text, interactive cards and attachments in a conversation with a user. Apart from a receive-reply conversation, developers can build bot applications to push messages in a conversation to Teams client.

SDK

The SDK’s architecture is inspired by the official SDKs and thus follows all the guidelines of the Bot Framework. It takes care of the authentication for conversation requests between a bot application and a Teams client, as per the guidelines. All the requests to and responses from the Bot Framework service adhere to the API definitions as specified. The SDK provides users the flexibility to create messages sent to the Teams client.  The code for the SDK is publicly available on GitHub.

The GitHub repository of the SDK includes an example bot, glimpsed below. The bot just echoes whatever is sent by the user.

Echobot

The below snippet from the example shows how a handler, which is a way to command the SDK on an event trigger, is created. And then a call to an SDK function is made to send a reply. The complete explanation can be found here.

 

While the above snippet sends text, an attachment can be sent by modifying the activity:

Integration with BotKube

The SDK is being used to make BotKube interact with Teams. After the integration, users will be able to work with their Kubernetes clusters using a Teams client. The client can monitor, debug and run checks on Kubernetes cluster(s).  The user interaction will be quite similar to how BotKube offers for Slack or Mattermost today.

Further work

The SDK is being enhanced for performance and new features are being added which are supported by the Bot Framework. The required work is tracked on the GitHub repository’s issues page. It’ll be our pleasure to welcome any contribution to the SDK.

(image credits)

Sahil Lakhwani

Author Sahil Lakhwani

More posts by Sahil Lakhwani

Leave a Reply