Facebook become the biggest social website, and facebook is real-name system. It doesn’t allow user to publish comments anonymously. Real-name system is suitable for most of conditions. However, to people, it is still easier to speak truth anonymously. This app can allow user to post comments anonymously to facebook page.
This app is not the first one with this kind of function. However, most of apps are not open-source. Some apps even are questioned about their user privacy. People suspect that the apps would store user’s IP, and this may break its anonymization. Hence I tried to develop an open-source version for who may have concern.
Post through this app would be attached with facebook hashtags. The hashtags can help users to organize or address posts. Admin can modify these settings in back-end. In addition, admin can also choose to allow posting user’s message to facebook page immediately or not. If admin disable auto posting, posts need to be reviewed by admin.
To post message automatically, this app would do server-side user token exchange between admin and facebook. With long-term user token, this app can get page token without expiration. The app would store the page token to database. It would use the page token to post user’s message by facebook graph API.
Key techniques:
-
Front-end framework and icon: materialize-sass, jquery-turbolinks, font-awesome
A beautiful front-end framework based on Google’s material design. jquery-turbolinks fix issue of jquery not working with turbolink. Icon of the app is from font-awesome. -
Settings: rails-settings-cached
I use rails-settings-cached to store settings as key-value pairs at database and fetch them into low-level cache. -
OAuth: omniauth-facebook
OAuth is an open standard for authorization. However, most of websites didn’t follow the standard. omniauth-facebook implement a facebook version OAuth. Hence, I can get access token for page management through it. -
Facebook graph API: koala
I use koala to do server-side token exchange. Koala also provides supporting of facebook graph API to publish messages to facebook page. -
Service Object:
Service object is a classic pattern to refactor Rails. I use service object to encapsulate facebook-related operations. In addition, I also add singleton pattern to service object. There is no need for multiple instances of facebook service object in this app.
Links: