CrystalQore
DevelopersRecipes

Click to dial from a CRM

Place a CrystalQore call when a user clicks a phone number in your CRM.

Click to dial from a CRM

Use this when a sales or support record has a phone number and you want the agent's CrystalQore extension to ring, then connect to the customer.

What you need

  • API key with click2dial (and users if you resolve agents by email)
  • Tenant UUID
  • The agent's CrystalQore login email (X-User-Email)
  • A registered phone on that agent's extension

Map the CRM user to a CrystalQore email. Store the mapping in your CRM; do not guess extensions from the API key.

POST click-to-dial with the customer's number as destination.

Handle 409 / 429 — PHONE_NOT_REGISTERED means the desk phone or app is offline; CALL_IN_PROGRESS means wait; RATE_LIMIT_EXCEEDED means back off.

export async function dialFromCrm({ agentEmail, destination }) {
  const res = await fetch("https://app.crystalqore.com/api/v1/click2dial", {
    method: "POST",
    headers: {
      "X-API-Key": process.env.CRYSTALQORE_API_KEY,
      "X-Tenant-Id": process.env.CRYSTALQORE_TENANT_ID,
      "X-User-Email": agentEmail,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({ destination }),
  });
 
  const body = await res.json();
  if (!body.success) {
    throw new Error(`${body.error.code}: ${body.error.message}`);
  }
  return body.data; // callId, from, to, status
}

Call this from your backend. Do not put the API key in the CRM browser. The playground is for operators, not for embedding in a customer-facing page.

On this page