Automated Billing

Integrating WhatsApp with AWS services to receive daily billing reports and connect to support center agent over chatbot or a call.

Considering customers’ expectations and the demands ACME has built up a solution which helps customer to interact with their AWS Services efficiently to achieve their objective. Customers want easy and simple way to receive their hourly, daily, weekly and monthly billing reports along with inventory details.

Customers also want to connect to support team to report issues or to get help from the support engineer to resolve their issues. Taking these things into consideration ACME has built a platform which facilitates the process and help customer achieve their objective.

Every customer is now using channels like WhatsApp, a popular communication choice. With the introduction of the WhatsApp API for business, enterprises engage with customers through WhatsApp for text communication to increase reachability.

This post outlines steps for enhancing the customer experience by linking WhatsApp with Amazon Lex for text. It then links with an Amazon Connect contact center for seamless voice transfer using the Amazon Connect API and the Twilio WhatsApp API and it also links WhatsApp with billing via AWS Lex and lambda function.

The following components are used for this integration:

  • Amazon Connect contact center
  • Amazon Lex chatbot
  • The Twilio Sandbox for WhatsApp
  • AWS SNS service
  • AWS CloudWatch Events
  • AWS Lambda function

Integrating WhatsApp with AWS Lex, Cost explorer and AWS Connect

The following diagram depicts a high-level integration architecture between the WhatsApp API provided by Twilio, Amazon Lex, AWS Lambda, and Amazon Connect, AWS Cost explorer and AWS SNS.


How it works?

Generating billing reports:

Users starts chat conversation with WhatsApp, the initial support is provided by an Amazon Lex chatbot integrated with WhatsApp using the Twilio WhatsApp API. When user initiates requests to receive billing report AWS Lex invokes Outbound API request to AWS Cost Explorer via Lambda function which in turn collects the report and send back to customer over WhatsApp, Also on daily basis without clients requests automated reports will be generated and sent to customer over mail, this process involves time based CloudWatch events to trigger lambda function which collects billing data and format into CSV file and send it to client over email using AWS SNS service.

Below screenshots depicts how Billing and inventory reports are generated as per request.

Billing automation


Lambda function


To receive inventory details



Lambda function


Connecting to support Engineer

Moreover, when a user initiates a request to speak to a customer service agent, Amazon Lex invokes Lambda function to validate the inputs and auto reply will be sent to users, In case users want to connect to agent over a call then Lex bot will trigger Lambda function which will send an outbound API call request to Amazon Connect. Finally, Amazon Connect initiates a contact flow to place an outbound call to a customer. In case customer don’t want to use AWS Connect for outbound call, an agent can place manual calls using tele phone


Lex Bot


Notification to support Engineer: