Using ChatGPT, Claude, and Gemini
You can drive Aigeon from any AI assistant that supports function calling or tool use. The pattern is the same regardless of the model: define Aigeon endpoints as tools, let the model decide when to call them, and execute the calls against the REST API.
OpenAI / ChatGPT (function calling)
Define the tools in your assistant configuration:
{
"tools": [
{
"type": "function",
"function": {
"name": "aigeon_add_contacts",
"description": "Add one or more contacts to an Aigeon list",
"parameters": {
"type": "object",
"properties": {
"group_id": { "type": "string" },
"members": {
"type": "array",
"items": {
"type": "object",
"properties": {
"email": { "type": "string" },
"first_name": { "type": "string" },
"tags": { "type": "array", "items": { "type": "string" } }
},
"required": ["email"]
}
}
},
"required": ["group_id", "members"]
}
}
}
]
}
When the model returns a tool_call, execute it:
async function executeTool(name: string, args: Record<string, unknown>) {
if (name === "aigeon_add_contacts") {
const res = await fetch(
"https://api.aigeon.ai/public/api/v1/contacts/add-group-members",
{
method: "POST",
headers: {
"X-Api-Token": process.env.AIGEON_API_KEY!,
"Content-Type": "application/json",
},
body: JSON.stringify(args),
},
);
return res.json();
}
}
Anthropic / Claude (tool use)
Define the same tool in Claude's format and handle tool_use content blocks:
import Anthropic from "@anthropic-ai/sdk";
const client = new Anthropic();
const response = await client.messages.create({
model: "claude-opus-4-7",
max_tokens: 1024,
tools: [
{
name: "aigeon_send_flow",
description: "Trigger an Aigeon flow for a contact",
input_schema: {
type: "object" as const,
properties: {
flow_id: { type: "string" },
contact_email: { type: "string" },
context: { type: "object" },
},
required: ["flow_id", "contact_email"],
},
},
],
messages: [
{
role: "user",
content: "Trigger the welcome flow for alice@example.com with order_id ord_999",
},
],
});
for (const block of response.content) {
if (block.type === "tool_use" && block.name === "aigeon_send_flow") {
await fetch(
"https://api.aigeon.ai/public/api/v1/flow/send-email-through-flow",
{
method: "POST",
headers: {
"X-Api-Token": process.env.AIGEON_API_KEY!,
"Content-Type": "application/json",
},
body: JSON.stringify(block.input),
},
);
}
}
Google Gemini (function calling)
import google.generativeai as genai
import requests, os
genai.configure(api_key=os.environ["GOOGLE_API_KEY"])
add_contacts_fn = genai.protos.FunctionDeclaration(
name="aigeon_add_contacts",
description="Add contacts to an Aigeon list",
parameters=genai.protos.Schema(
type=genai.protos.Type.OBJECT,
properties={
"group_id": genai.protos.Schema(type=genai.protos.Type.STRING),
"emails": genai.protos.Schema(
type=genai.protos.Type.ARRAY,
items=genai.protos.Schema(type=genai.protos.Type.STRING),
),
},
required=["group_id", "emails"],
),
)
model = genai.GenerativeModel(
"gemini-2.5-pro",
tools=[add_contacts_fn],
)
chat = model.start_chat()
response = chat.send_message("Add alice@example.com to list sg_beta_testers")
for part in response.parts:
if fn := part.function_call:
if fn.name == "aigeon_add_contacts":
members = [{"email": e} for e in fn.args["emails"]]
requests.post(
"https://api.aigeon.ai/public/api/v1/contacts/add-group-members",
headers={"X-Api-Token": os.environ["AIGEON_API_KEY"]},
json={"group_id": fn.args["group_id"], "members": members},
)
Simplest path: MCP
If you use Claude Desktop, Claude Code CLI, or Cursor, the MCP server handles all of the above automatically — no tool definitions to write, no execution logic. Just describe what you want and the MCP server maps it to the correct Aigeon API call.
For code-writing agents: Agent Skills
If your AI is writing code that calls the Aigeon API (as opposed to calling it live from a chat), install the aigeon-skills plugin instead of (or alongside) any of the above. It ships the payload shapes, auth rules, scope guidance, and common-pitfall notes the agent needs to produce correct code on the first try. See Agent Skills.
