Skip to content
Jammerware edited this page Aug 6, 2016 · 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.

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

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 TechDebtResponder : IResponder
{
        public bool CanRespond(ResponseContext 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 BotMessage GetResponse(ResponseContext context)
        {
            return new BotMessage() {
                Text = "God, " + context.Message.FormattedUser + ", you're such a scruffy-looking nerf-herder.";
            }
        }
}

myBot.Responders.Add(new TechDebtResponder());

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!