route_concierge
Route a lead through ChiliPiper Concierge to return the booking calendar URL for an inbound router.
Instructions
Route a lead via the ChiliPiper Concierge fire endpoint. Returns the booking calendar URL for an inbound router.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| router_slug | Yes | The inbound Concierge router URL slug | |
| Yes | Lead's email address | ||
| first_name | No | Lead's first name | |
| last_name | No | Lead's last name | |
| company | No | Lead's company | |
| phone | No | Lead's phone | |
| extra_fields | No | Additional fields as key-value pairs |
Implementation Reference
- index.js:126-179 (registration)Registration of the 'route_concierge' tool with server.tool(), including its description and schema definition.
// --- Tool: Route via Concierge fire endpoint --- server.tool( "route_concierge", "Route a lead via the ChiliPiper Concierge fire endpoint. Returns the booking calendar URL for an inbound router.", { router_slug: z .string() .describe("The inbound Concierge router URL slug"), email: z.string().describe("Lead's email address"), first_name: z.string().optional().describe("Lead's first name"), last_name: z.string().optional().describe("Lead's last name"), company: z.string().optional().describe("Lead's company"), phone: z.string().optional().describe("Lead's phone"), extra_fields: z .record(z.string()) .optional() .describe("Additional fields as key-value pairs"), }, async ({ router_slug, email, first_name, last_name, company, phone, extra_fields, }) => { const body = { PersonEmail: email, ...(first_name && { FirstName: first_name }), ...(last_name && { LastName: last_name }), ...(company && { Company: company }), ...(phone && { Phone: phone }), ...(extra_fields || {}), }; try { const result = await cpFetch( `${FIRE_URL}/concierge-router/${router_slug}/rest`, { method: "POST", body: JSON.stringify(body), } ); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }], }; } catch (err) { return { content: [{ type: "text", text: `Error: ${err.message}` }], }; } } ); - index.js:130-143 (schema)Zod schema defining input parameters for route_concierge: router_slug, email, first_name, last_name, company, phone, extra_fields.
{ router_slug: z .string() .describe("The inbound Concierge router URL slug"), email: z.string().describe("Lead's email address"), first_name: z.string().optional().describe("Lead's first name"), last_name: z.string().optional().describe("Lead's last name"), company: z.string().optional().describe("Lead's company"), phone: z.string().optional().describe("Lead's phone"), extra_fields: z .record(z.string()) .optional() .describe("Additional fields as key-value pairs"), }, - index.js:144-178 (handler)Handler function that POSTs lead data to the ChiliPiper Concierge fire endpoint at FIRE_URL/concierge-router/{router_slug}/rest and returns the booking calendar URL.
async ({ router_slug, email, first_name, last_name, company, phone, extra_fields, }) => { const body = { PersonEmail: email, ...(first_name && { FirstName: first_name }), ...(last_name && { LastName: last_name }), ...(company && { Company: company }), ...(phone && { Phone: phone }), ...(extra_fields || {}), }; try { const result = await cpFetch( `${FIRE_URL}/concierge-router/${router_slug}/rest`, { method: "POST", body: JSON.stringify(body), } ); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }], }; } catch (err) { return { content: [{ type: "text", text: `Error: ${err.message}` }], }; } } - index.js:13-29 (helper)The cpFetch helper used by the handler to make authenticated API calls to ChiliPiper.
async function cpFetch(url, options = {}) { const headers = { "Content-Type": "application/json", ...(API_KEY ? { "x-api-token": API_KEY } : {}), ...options.headers, }; const res = await fetch(url, { ...options, headers }); const text = await res.text(); if (!res.ok) { throw new Error(`ChiliPiper API ${res.status}: ${text}`); } try { return JSON.parse(text); } catch { return text; } }