Jakub Cerovský

Work · 2026

Premium payment email automation

An AI agent that reads inbound premium payment emails and records them in a legacy Perl core business system - securely.

Stack

PerlREST APIMicrosoft Copilot StudioOAuth2 / Entra IDCloudflare TunnelLinux

Overview

Insurance brokers receive a steady stream of premium payment notifications by email. Each one used to be read by a person, interpreted, and entered into the core business system by hand - slow, repetitive, and error-prone.

I built an AI agent in Microsoft Copilot Studio that parses these emails and calls a custom REST API I wrote on the Linux/Perl core business server to record the payments. The interesting problem wasn't the parsing - it was exposing an internal, on-premises Perl API to Microsoft's cloud without exposing it to the entire internet.

The solution: a Cloudflare Tunnel provides an outbound-only connection from the server (no inbound firewall changes), while Microsoft Entra ID handles authentication with two app registrations - one representing the API, one for the client - so every request carries a JWT that the Perl side validates before doing anything. A custom Power Platform connector ties it together.

Outcome

  • Payment emails are processed end-to-end without manual data entry.
  • The internal API is reachable by Power Platform but protected by OAuth2 - no open inbound ports, no shared secrets in flows.
  • The pattern (tunnel + Entra ID + custom connector) is reusable for future integrations against the same legacy system.

Related