Developer API
A step-by-step guide for developers on connecting an Australian phone system to a Cloudflare Worker using the Click2Call API and webhooks.
Building modern business software often means integrating voice capabilities. Whether you're building a custom CRM, an automated support desk, or an AI voice agent, you need a reliable way to connect real phone calls to your code. Traditionally, this meant dealing with complex SIP trunks, PBX hardware, and telecom protocols.
Today, the landscape has changed. Using the Click2Call API and Cloudflare Workers, you can deploy a fully functional, serverless voice integration in an afternoon. This guide walks you through the process of connecting an Australian phone system to a Cloudflare Worker, allowing you to handle calls programmatically with zero infrastructure overhead.
Cloudflare Workers are an ideal environment for handling voice API webhooks. They offer:
The first step is telling Click2Call where to send data when a call event occurs. In your Click2Call portal, navigate to the API > Webhooks section.
Create a new webhook and configure it to point to your Cloudflare Worker URL (e.g., https://voice-handler.yourdomain.workers.dev). You can select which events should trigger the webhook:
For a basic integration, selecting "Ringing Event" and "Ended Event" is a great starting point.
Content-Type: application/json
Authorization: your-secret-token
Content:
{
"event": "ringing",
"call_id": "123456789",
"caller_id": "+61400000000",
"called_number": "+61280000000",
"timestamp": "2026-04-16T10:00:00Z"
}
Now, let's write the Worker code to handle these incoming webhooks. We'll create a simple script that logs the call details and can be easily extended to trigger other actions, like sending a Slack notification or querying a database.
export default {
async fetch(request, env, ctx) {
// Only accept POST requests
if (request.method !== 'POST') {
return new Response('Method Not Allowed', { status: 405 });
}
// Verify the authorization token
const authHeader = request.headers.get('Authorization');
if (authHeader !== env.CLICK2CALL_SECRET) {
return new Response('Unauthorized', { status: 401 });
}
try {
const payload = await request.json();
// Handle different event types
switch (payload.event) {
case 'ringing':
console.log(`Incoming call from ${payload.caller_id}`);
// Add your custom logic here (e.g., CRM lookup)
break;
case 'ended':
console.log(`Call ${payload.call_id} ended`);
break;
case 'transcription_ready':
console.log(`Transcription available for ${payload.call_id}`);
// Send transcription to an LLM for summarization
break;
}
return new Response('Webhook received', { status: 200 });
} catch (error) {
console.error('Error processing webhook:', error);
return new Response('Bad Request', { status: 400 });
}
}
};
Webhooks are great for receiving data, but what if you want to take action? The Click2Call API allows your Worker to actively manage calls and account settings.
For example, when a call ends, your Worker could use the API to fetch the call recording or transcription, then pass that data to Claude or ChatGPT to generate a summary and push it to your CRM.
"By combining Click2Call's robust API with the serverless power of Cloudflare Workers, developers can build enterprise-grade voice applications without touching a single piece of telecom hardware."
Integrating a real Australian phone system into your custom software has never been easier. With Click2Call's developer-friendly API and comprehensive webhook support, you can focus on writing code, not managing infrastructure.
Every Click2Call account includes full API access. Explore the Developer API to see what else you can build.
Written by
Royce Clark
Royce is a technical writer and developer advocate specializing in cloud communications and AI integrations.