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 3

After configuring my Azure app and service bus I had to create some endpoint on the raspberry pi. Fortunately there is azure package for python so it wasn’t so hard to achieve my final goal – communication between slack and the board.

To install Azure packages simply type:

pip install azure-servicebus

and you’re ready to go.

Receiving messages from service bus queue is done by using receive_queue_message method on service bus object. You only have to define queue name. My receiver looks like this:

 msg = bs.receive_queue_message('officer', peek_lock=False)
 response = msg.body
 if msg.body is not None:
   indexStart = response.index("{")
   response = response[indexStart:]
   response = "".join([response.rsplit("}" , 1)[0] , "}"])
   print response
   parsed = json.loads(response)
   print parsed
   print "Nihil novi"

When you have your receiver you can write a simple “echo” response. To do it you’ll need slack incoming hook url ( It gives you a lot of customization options. Basically you’ll have to create a json payload object containing fields like text, username and channel. All you have to do is send it using regular post request to slack webhook given url. Sample payload looks like this:

    "username": "ghost-bot",
    "icon_emoji": ":ghost:",
    "text": "BOO!"

Now we can get some source data from the queue message. It’s stored inside of response object under Text index. You’ll have access to other informations like source channel name or username who executed your custom slack command.