Inspiration

It was a conversation with one of my college seniors during a different business competition. We were talking about a startup idea that helps people organize events with less efforts and more flexibility. However, during that time I didn't put much effort into that.

What it does

There is a whole bigger picture behind it. The messenger app/bot can be used for a tool for retrieving user event credentials easily.

You get into the app, type in your verification token given to you by the main website, then the app verifies you as an user and binds your facebook_user_id to the database and other information.

You can then access your information through it. You can find your events as well as event tickets or passes. Basically the event pass/tickets will be generated digitally in IMAGE format and assigned to your database automatically. All you have to do is tell the app to fetch it for you.

How I built it

At first, I wanted to use Flask for the backend as I had previously worked a little bit with the messenger API. But then due to the flexibility of Django, I switched to it. I used Heroku for deployment. The backend uses PostgreSQL database.

The backend receives the JSON sent by Messenger API. Then it classifies the message-type sent by the API. Using iteration and type checking, the app sends different PAYLOAD, REPLY TEXT to the API that the user receives.

I made a menu system using the "Quick Reply" feature. The menu contains 4 options, each of them send respective and unique PAYLOAD value. In the backend, I used if-else to check for the PAYLOAD and reply to them accordingly.

To use the admin panel for my site, use this login- username: root password: toor

Dummy User Tokens: ZYX_TOKEN|456456456 ZYX_TOKEN|999999999 ZYX_TOKEN|45ABCDEFG

Challenges I ran into

Connecting the app to Facebook Messenger API has been a pain. Django was receiving a form reply from the API without a CSRF token. Due to the security I didn't want to remove the CSRFMiddleware. So, I had to recast the method to receive a CSRF less data.

I am thankful to Justin Mitchel for his this blog: https://www.codingforentrepreneurs.com/blog/facebook-messenger-bot-with-django. This one blog has saved me at last after hours of debugging.

There were also some JSON and Dictionary related challenges that I faced. Previously in Flask, I worked with pymessenger module. It made work easy and I was also familiar with Flask's request object and attribute. Switching to Django, I had to learn the request object again and had to implement the response object thoroughly.

Also, the main challenge was to write clean and organized code. Code organizing is a pain when you work with dictionary. There are longer lines of codes. So, cutting them into smaller pieces and connecting them was a challenger, yeah. I wish we had a framework for this, ugh.

Soon I wish to make a python module/library for that. Apart from these, there weren't much challenges.

Accomplishments that I'm proud of

I hadn't heard about the hackathon until 4-5 days ago. Delivering a minimal app with completeness is something that I am proud of.

What I learned

I learned creating a messenger bot using Django. I learned some basic tips for working with Dictionary Objects. I learned about deploying Django into Heroku and the errors that come with it.

What's next for ZYX - an event entry management tool

In my todo list, I wish

  • to add more "Quick Replies" feature
  • to add greeting message and basic reply feature without external framework
  • create a web view for sending messages to users manually (for development)

  • complete the web interface

  • learn REST API to add endpoint for mobile applications

Built With

Share this project:

Updates