Skip to content
Jammerware edited this page May 1, 2015 · 21 revisions

Welcome to MargieBot

MargieBot is a simple bot framework for Slack, one of the coolest free chat and collaboration web applications around. MargieBot is written in C#.NET, and it's designed to make creating bots for Slack accessible to anyone who knows a little C# or VB and has a vision for bot interactions that are fun or helpful - sometimes even both.

Programmer-intuitive

MargieBot is designed to be easy to understand, quick to get started with, and fun to use.

Bot myBot = new Bot("<your bot's slack API token>");
myBot.RespondsTo("Hi Margie").With("Hey, friend!");
myBot.Connect();

Flexible & Powerful

If you can write it in C# or VB, MargieBot can bring it to life in Slack. Want to call a coworker a scruffy-looking nerf-herder every time he says the phrase "technical debt" in a public channel, but only if it's at the bottom of the hour? MargieBot has your back.

public class TechDebtResponseProcessor : IResponseProcessor
{
        public bool CanRespond(MargieContext context)
        {
            return
                Regex.IsMatch(context.Message.Text, "\btechnical debt\b") &&
                context.Message.ChatHub.Type == SlackChatHubType.Channel &&
                context.UserNameCache[context.Message.User] == "obnoxious coworker" &&
                DateTime.Now.Minute > 30;
        }

        public string GetResponse(MargieContext context)
        {
            return "God, " + context.Message.FormattedUser + ", you're such a scruffy-looking nerf-herder.";
        }
}

myBot.ResponseProcessors.Add(new TechDebtResponseProcessor());

To get started, check out our guide on configuring MargieBot's responses, our tips and tricks, or, if you're brand new to Slack and its bots, MargieBot from the ground up. Thanks for checking out MargieBot!