Using Google Apps Script to Automate Glific Flows

Fawas Chemba

SEPTEMBER 17, 2026

Share

Google Apps Script can be used to automate several flow related tasks in Glific, such as creating flows, triggering flows, and deleting flows based on specific requirements.

This blog covers two use cases where Apps Script was implemented with Glific:

  • ABBF(Adventures Beyond Barriers Foundation) –  Automating the creation and deletion of event registration flows
  • Gyan Prakash Foundation – Automating flow triggers based on attendance data

The two use cases are different, but both demonstrate how Apps Script can connect Glific with external data sources such as Google Sheets and automate repetitive tasks.


1. Apps Script for Flow Creation and Deletion – ABBF

Flows in Glific can normally be created through the flow editor or by importing a flow JSON. However, the ABBF use case required a different approach.

Context

  • ABBF uses ABBY Bot (Glific chatbot) to help users register for inclusive sports events, along with providing access to other offerings.
  • For each sports event, registration is available only during a specific period, with a defined start date and end date.
  • When registration opens, the ABBF team shares a QR code or link for that particular event. Users can scan the QR code or open the link and directly access the registration flow for that event.

Requirement

  • The requirement was to allow users to directly access the registration flow for a specific event without having to select the event from a common list.
  • For example, when a user scans the QR code for Event A, they should directly enter the registration flow for Event A.

Challenge

  • Creating a separate flow manually for every event would not be practical.
  • Another option was to use a common flow with event-specific keywords. However, this would require the ABBF team to manually:
    • Add the keyword when registration opens.
    • Remove the keyword when registration closes.
  • This could create problems if a keyword was not added on time, preventing users from accessing the registration flow. Similarly, if a keyword was not removed after registration closed, users could continue accessing an inactive registration flow.

Solution

  • We created a template flow containing the basic structure required to identify the event and redirect the user to the main registration flow.
  • The event details are maintained in a Google Sheet, including:
    • Event name
    • Keyword
    • Registration start date
    • Registration end date
  • When registration starts: Apps Script creates the event-specific flow.
  • When registration closes: Apps Script deletes the flow.
  • The flow_status and flow_id columns will be populated automatically when a new flow is created.

Apps Script uses this information to automatically manage the flow:

  • The flow name and keyword are generated based on the event details in the Google Sheet.
  • This means the ABBF team only needs to maintain the event details in the sheet. The flow creation and deletion are handled automatically.

Flows will be deleted automatically on the event’s close date, and the details of the deleted flows will be stored in a separate tab within the same Google Sheet.


2. Apps Script for Flow Triggering – Gyan Prakash Foundation

Glific provides a Trigger Flow functionality that allows flows to be triggered for users. For the Gyan Prakash Foundation project, Apps Script was used to automate this process based on attendance data maintained outside Glific.

Context

There are more than 1,000 Sevikas, managed across four District Coordinators, making manual processing of this attendance data difficult.

  • The second phase of the Gyan Prakash project expanded the chatbot’s use to include Sevikas (Anganwadi Workers), parents, and District Coordinators.
  • District Coordinators conduct monthly orientations for Sevikas. These orientations cover the Monthly Parent Sessions (MPS) that Sevikas are expected to conduct with parents.
  • The District Coordinators maintain the orientation attendance in a Google Sheet, marking whether each Sevika attended the session.

Requirement

The Gyan Prakash team wanted to send a message to Sevikas who attended the monthly orientation.

The message is used to:

  • Collect feedback about the orientation session.
  • Ask when the Sevika plans to conduct the upcoming MPS session with parents.

This process needs to happen every month based on the attendance recorded by the District Coordinators.

Challenge

  • The attendance data is maintained in a Google Sheet outside Glific.
  • To trigger a flow only for Sevikas who attended the orientation, the attendance information would need to be transferred into Glific or used to identify the relevant users before triggering the flow.
  • Doing this manually every month would be time-consuming, especially with more than 1,000 Sevikas.

Solution

  • Apps Script was implemented directly in the Google Sheet used by the District Coordinators to record attendance.
  • The script runs daily and checks the attendance and date conditions.
    • When:
      • The Sevika’s attendance is marked as true, and
      • The date matches the configured date,
  • Apps Script triggers the required Glific flow for that Sevika.
  • This removes the need to manually create a collection of attendees or trigger the flow from Glific each month.

The sheet below is used by the district coordinators to mark attendance.


We also explored another use case for Gyan Prakash: using Apps Script to create a web app form for recording parent attendance during Monthly Parent Sessions.

The proposed workflow is:

  1. Parents attend the Monthly Parent Session.
  2. Their attendance is recorded through a web app form.
  3. The attendance data is stored in a Google Sheet.
  4. Apps Script identifies the parents who attended.
  5. A Glific flow is triggered for those parents.

This approach can help connect attendance data collected outside Glific with automated communication through Glific.


How to Add Apps Script

You can add Apps Script directly to the Google Sheet used for the workflow.

Step 1: Open the Google Sheet

  • Open the Google Sheet where you want to add the automation.

Step 2: Open Apps Script

  • From the menu, go to Extensions -> Apps Script.

Step 3: Add the Script

  • In the Apps Script editor, open the Code section and paste the required script.

Step 4: Run and Test

  • Click Run to execute the script and test whether it is working as expected.

Note: The first time you run the script, Google may ask you to grant the required permissions.

Step 5: Set Up the Trigger

  • Once the script is tested, go to Triggers in the Apps Script editor and create a trigger.
  • Configure the trigger based on your requirement, for example, to run the script daily at a specific time.
  • Once the trigger is configured, the script will run automatically according to the selected schedule.

Try It Yourself

To experiment with similar use cases, you can use the Apps Script Generator to generate the required script based on your use case.

Note: This tool generates scripts only for the use cases mentioned above.

Leave a Reply

Discover more from Glific

Subscribe now to keep reading and get access to the full archive.

Continue reading