Additional menu
Contact information
If you have any questions or you just think that we do a good job - feel free to contact us - we <3 feedback from you!

E-mail: office[at]


Slack – Azure – Raspberry Pi – episode 2

I’ve started my journey with downloading some sample code from Igal Tabachnik – xkcd slackbot ( Because I had no: experience in C#, visual studio on my computer, any idea how should it be deployed, I thought it will be fun. And it indeed was.

After getting sources of Igal’s bot, I’ve looked into the structure of (?) project. To make it working I needed some server environment. I’ve created new app service on my azure account. After that I had to rewrite xkcd bot to connect with my previously created azure service bus. To do it, I’ve used my favourite text editor (Sublime) and refactored Igal’s code. I had to edit all those configs etc manually, without visual studio’s help 😉
It was fun because I couldn’t test the solution on my local machine. After few tries I’ve managed that I can deploy my app using git directly on azure.

 git push azure master

And we’re home 😉 Here’s the final code of my controller with pushing call from slack to service bus queue (which is used by my pythin script on raspberry pi ;)):

using System;
using System.Configuration;
using System.Linq; 
using System.Net;
using System.Text;
using System.Threading.Tasks; 
using System.IO;
using System.Xml.Serialization;
using Nancy;
using Nancy.ModelBinding;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Microsoft.ServiceBus.Messaging;
namespace SlackAzureServiceBus
 public class SlackRequest
 public string Token { get; set; }
 public string Command { get; set; }
 public string Text { get; set; }
 public string Channel_Name { get; set; }
 public string User_Name { get; set; }
 public class SlackAzureServiceBusModule : NancyModule
 public SlackAzureServiceBusModule() : base("/officer")
 StaticConfiguration.DisableErrorTraces = false;
 Post["/", runAsync: true] = async (_, ct) =>
 var request = this.Bind<SlackRequest>();
 if (request.Token != ConfigurationManager.AppSettings["SLACK_SLASH_COMMAND_TOKEN"])
 return 403;
if (request.Command != "/officer") return 400;
var connectionString = ConfigurationManager.AppSettings["SERVICE_BUS_CONNECTION"];
 var queue = QueueClient.CreateFromConnectionString(connectionString, ConfigurationManager.AppSettings["SERVICE_BUS_QUEUE"]);
 var payload = Newtonsoft.Json.JsonConvert.SerializeObject(request);
var payloadStream = new MemoryStream(Encoding.UTF8.GetBytes(payload));
 queue.Send(new BrokeredMessage(payloadStream,true));

return 200;

Last things I had to add to my azure app were the custom configuration fields.

Zrzut ekranu 2016-04-03 21.40.12

To access custom fields you can simply use:


It was quite easy to manage how to make azure app work (and it was my first time). This part of project has taught me a lot 😉

Slack – Azure – Raspberry Pi – episode 1

Hi there, long time – no see 🙂

I’ve been very busy lately and had not enough time to take care of my project. Today I would like to tell you something about the architecture of Officer Pi. Let me show you my idea packed into a compressed graphic file 😉


So, as you can see, basic communication between slack commands and raspberry Pi running Officer’s scripts is based on Azure service bus queue. I’ve decide to do make it happen using Azure services. As a total Microsoft-Cloud-And-All-Others-Based-Solutions-Noob© I had a really tough start. I’ve downloadaded random program from random Github Repositiory. Some of you may know, I’m working on a mac, so I don’t have a windows instance on my computer and therefore, no Visual Studio here. To build .net code I’ve used the sources and my intuition – after few hours packed with eternity spent on testing my solution on live Azure, it started working.

I’ll write more about technical aspects of this part in the next two blog posts (soon!). This is a really important milostone in my project!

Don’t count your chickens before they’re hatched

I’ve started the celebration too early. Unfortunately connection between a Raspberry Pi and my mac stopped working. I was looking for a reason for several hours and tried almost every possible configuration. I am lucky because when I was a kid, I used to use linux as my operating system, so white letters on black background hadn’t scared me off 😉

To make things working again I had to turn off the dhcpcd on a R-Pi and set everything with the static values. That was the first step. After making the boards connected I couldn’t reach any outside-local-network servers – that was a problem related to DNS. I was setting everything up using this instruction:  but one thing was missing. The blog post might be a little outdated and some things in  the Raspbian may have changed – my resolv.conf (responsible for resolving hostnames) was empty. I had to add a  DNS related line in  my /etc/networking/interfaces file:

auto eth0
iface eth0 inet static

Now my raspberry Pi has an internet connection and I can finally start some serious programming 😉
See you soon!

ps. Connecting Raspberry Pi with an ethernet cable to a Mac is not a piece of cake 😉