Site icon Glific

WhatsApp Polls in Glific: Quick Decisions, Seamless Conversations

For NGOs, staying connected isn’t just important—it’s essential. Whether it’s coordinating volunteers, sharing updates, or making quick decisions, WhatsApp is the go-to platform. That’s why we built WhatsApp Groups in Glific, making it easier for NGOs to bring their teams together in one place. Now, creating and managing WhatsApp groups happens seamlessly within Glific, keeping conversations organized and efficient.

And to take it a step further, we’ve introduced WhatsApp Polls in Glific—because sometimes, a quick poll is all it takes to make the right call.

Here’s a look at the features available in WhatsApp polls:

Create and Sending polls:

We can create a WhatsApp poll from the UI by clicking on the Create button.

After clicking, we will be redirected to the creation page, where we can:

There is a checkbox labeled “Allow multiple options”:

Managing Created Polls

Why is there no Edit option?

Sending WhatsApp Polls

After some discussion and back-and-forth, we decided to send WhatsApp polls using the Webhook Node instead of creating a separate node for polls.

Creating the Flow for WhatsApp Polls

  1. Call the Webhook Function
    • Start by adding a  Call Webhook Node in the flow.
    • In the dropdown, choose Function and set the name to send_wa_group_poll.
  1. Define the Function Body
    • Pass the poll UUID as a key and paste the copied UUID from the Group Polls tab as its value, and another key, wa_groups set its value to @wa_group.
  2. @wa_group will internally expand to this map as follows:

Starting the Poll Flow

  Challenges We Faced During Development

  1. Underestimating Timelines – The Sneaky Surprise
    • When we started planning WhatsApp group support, we thought it would be quick—especially the webhook function.
    • We later realized that Glific’s older flow code didn’t support WhatsApp groups. The webhook function was designed to handle only contact variables — for example, using @contact.name would replace it with the contact’s actual name, but it wouldn’t work for whatsapp group-specific data.
    • But there was no equivalent support for WhatsApp groups, which completely caught us off guard. 
  1. Code Refactoring – The Necessary Evil
    • The first version of Glific was pretty straightforward—it mostly just created and sent messages without touching the core system.
    • Previously, send_message also worked through flows, but the code related to WhatsApp groups wasn’t generic. This time, we integrated WhatsApp groups directly into flows — tackling one of the most complex and critical parts of Glific — while adding support for multiple nodes and making the code fully generic.
    • We couldn’t just add new code—we had to refactor and restructure existing code to fit the new functionality. This meant being extra careful not to break anything while making things better. It was like trying to upgrade a moving train without derailing it!
  1. Glific’s Codebase – A Giant Maze
    • To be honest, Glific’s codebase is massive—a real jungle of logic and functions.
    • Understanding every line took time (and coffee). 
    • But once we figured it out, things started to click (well, mostly).

We have covered the unit test cases and Cypress tests for this feature.

The major learning from this experience is the importance of estimating timelines correctly and performing a basic feasibility check beforehand. We have already started implementing this approach in our new features and issue resolutions after working on WhatsApp polls.

They say ‘Never assume’—and now, after digging through old code, we know why. Lesson learned: Always check before you wreck

Exit mobile version