A simple project using a Raspberry Pi, a Thermal Printer, some ruby code and an integration into Slack so that messages sent around the internet can be printed as a written record by simply adding a 'reaction' to those messages.
Tilly works by creating a RealTime client connection to Slack via the ruby-slack-client library, and watches for 'reaction_added' events containing a :printer: emoji.
Because those event messages only include a reference to the message item being reacted to, another WebClient connection is required to perform a item lookup against Slack's channel history.
Once we have the message data, we _then_ get information on the user and channel metadata so that the printed event includes a bit more friendly information (eg Who/Where).
It's not a very beautiful implementation, however it is unlikely to get considerable use after the initial novelty wears out and it becomes a record of jokes, bad language, and other entertainment
Any version with Ethernet or Wifi will probably work
CSN A2 Thermal Printer
I use TTY for my connectivity, but USB should work with some fiddling
5v 2amp power supply
Barrel Jack connectors
For attaching to the power leads on the printer
Toby Jackson •
04/16/2017 at 11:43 •
After some trial and error... and aboutl 30 feet of print failures, I've been able to incorporate the escpos-image library so that I'm able to print images embedded into messages.
Had to make some modifications to the library to support resizing, rotation and formatting but initial results are looking great.
At this point, Tilly is able to;
- Print simple text messages
- Print multi-media messages
- GIF's take the first frame
- JPG/PNG are printed properly
- Resizes to 360px wide (Up/Down as required)
Can't yet print emoji, and will probably be a long-time before thats possible as all text would need to be 'rendered' onto a bitmap rather than as ascii text over serial.
Attachment's can't be printed yet either as Slack puts them in a strange place (Not on a channel technically...) so more work required there.
Toby Jackson •
04/14/2017 at 20:09 •
So in a rare case of completionism, I've managed to build a viable 'finished' article of a printer connected to Slack.
Its rough around the edges - the power supply is pretty rubbish (USB to the RPi and a separate wall-wart for the printer itself), the external wiring is a bit messy (three cables rather than two) and the code is a little unruly but it works.
Next things to solve;
- Power supply - Can I run the Pi and Printer from one source?
- Images/Multi-Media - How can I print image embeds or avatars as part of the output
View all 2 project logs
Enjoy this project?