case study

Automating Invoice Generation for TOKI: A Fully Digital Platform for Electricity Services in Bulgaria

May 3, 2023
Cloud Enablement

TOKI is a fully digital platform that aims to simplify the process of choosing an electricity supplier, switching suppliers, and managing electricity costs in Bulgaria.


Our services

  • Discovery: Conducting a thorough discovery process to understand client requirements and needs.
  • Audit: Reviewing the existing code to identify areas of improvement and optimize performance.
  • Consulting and Architecture: Designing a robust architecture for the new system, ensuring scalability and reliability.
  • Implementation: Developing a new system for generating invoices, fully automated and integrated with Google Cloud

Our deliverables 

  • Setting up projects and necessary APIs within Google Cloud for the client's system.
  • Developing scheduled or event-triggered Cloud functions to download, validate, and load customer and consumption data into BigQuery.
  • Creating an Apache Beam pipeline to transform the collected data into invoice data in JSON format, then loading it into BigQuery for further processing.

We used

  • Terraform 
  • Google Cloud Functions
  • Cloud Storage
  • Firestore
  • BigQuery
  • Pub/Sub
  • DataFlow
  • CircleCI
  • Python
  • Apache Beam

The Challenge 

TOKI, Bulgaria's first fully digital platform for providing electricity services, needed to automate its invoice generation process, which was not fault-tolerant, prone to errors, and involved a lot of manual triggering.


To achieve a new automated system that was designed to be more reliable and efficient, we created a system that involves creating projects and activating necessary APIs within these projects. We also created either scheduled or event-triggered cloud functions that handle downloading, validating, and loading the necessary customer and consumption data to BigQuery. Additionally, we created an Apache Beam pipeline that processes and transforms the collected data into necessary invoice data in json format, which is then loaded into BigQuery.

1Crew created scheduled cloud functions that downloaded and saved the files containing the consumption data to Cloud Storage. Saving the files to Cloud Storage then triggered functions that validated those files and loaded all correct data to BigQuery. An Apache Beam pipeline collected all necessary data for creating an invoice from BigQuery, transformed it, and generated an invoice JSON, which was exported to Bigquery. All of this was deployed and automated using Terraform and CircleCi.


1Crew delivered a fully operational system for automatically generating monthly invoices, automated and deployed in Google Cloud using Terraform and CircleCi. The new system was fault-tolerant, eliminated manual errors, and reduced the time spent on the invoicing process, enabling TOKI to scale its operations and focus on its core business.