Facebook Data Slackbot

Project Background

I was working on the Digital Marketing team and at the time my teammates and I often felt like even outside of work we were tethered to our computers to check the profits on our ads. Some coworkers felt like they could not leave home becasue they had to be close to their computers to keep checking constantly. With my skills in JavaScript and past experience working with the Facebook API I thought I could figure out some way of automatically sending Facebook ad data out to the Marketing team to their phones so they could feel safe to leave their homes.

I began playing with different methods of sending data from the Facebook API. I experimented with texts and emails, but thought that texts were too intrusive and emails would be too difficult to constantly check outside of work hours. I then asked the team how they would prefer to be sent the information and they came back and said they were excited for the data, and would like it via Slack if I could figure it out.

I read through the documentation for the Slack API and it was something I figured I could work with. After experimenting with methods of using the Slack API to send messages I finally settled on creating a private channel with myself, the marketer and a SlackBot. This way each team member had their own channel and could mute it or turn off notifications as needed and I could monitor the SlackBot to make sure it was working correctly.

Finally I wrote code to output the Facebook data in a format that was easy to read for the marketer's sake as the data from the Facebook API isn't very clean or easy to read. I finished the script and shipped it out for use by the team. I then had the script be run on a CronJob on a server to run every hour between 6am - 12am so the marketers could see updated data often enough to feel safe, but not too often to feel bombarded with Slack messages. The team was thankful to have the ability to see important KPI's outside of work, without the feeling of needing to be so close to their computers outside of the office.

The code I wrote to create the SlackBot can be found at my github here. It is stripped of any identifying info such as Facebook API token and Slack token, and those changes are noted in the comments found in the code.

Example of what the Slack messages from the bot would look like:

Interested in hiring me for your project?

Looking for an experienced RPA developer to automate your business processes? To start an initial chat, just drop me an email at at josh.w.caton@gmail.com
Choose Colour