← Volver a Recursos

PRODUCTO · 7 MIN

API pública: integra con Stripe y Slack.

La API pública de Orquiva es REST + JSON, autenticación OAuth 2.0 client_credentials, rate limit de 1.000 req/min en Pro y 10.000 en Enterprise. Documentación en docs.orquiva.com. Aquí dos integraciones reales que pedimos a menudo: notificar nuevas altas a Slack y crear clientes en Stripe automáticamente.

POR DANIEL GARCÍA · CO-FUNDADOR · CTO @ ORQUIVA ACTUALIZADO 4 DE FEBRERO DE 2026 6 MIN DE LECTURA
POST /v1/employees · WEBHOOK employee.created api.orquiva v1 · OAUTH2 200 # Slack postMessage #welcomes S Stripe customers.create T Teams channels.notify

Autenticación

Crea un cliente OAuth en /admin/api-clients. Recibes client_id y client_secret. Cambia por token con vida de 1 hora:

curl -X POST https://api.orquiva.com/oauth/token \
  -d grant_type=client_credentials \
  -d client_id=$ORQ_ID \
  -d client_secret=$ORQ_SECRET

Receta 1 — Notificar altas a Slack

Suscribe un webhook al evento employee.created. Cada nueva alta llegará a tu endpoint en JSON. Procesa y publica en Slack:

// /api/orquiva-webhook
import { WebClient } from "@slack/web-api";
const slack = new WebClient(process.env.SLACK_TOKEN);

export async function POST(req) {
  const event = await req.json();
  if (event.type !== "employee.created") return new Response("ok");

  await slack.chat.postMessage({
    channel: "#bienvenidas",
    text: `Bienvenido/a ${event.data.fullName} a ${event.data.department}.`,
  });
  return new Response("ok");
}

Receta 2 — Crear cliente en Stripe al alta

Si tu empresa usa Stripe para reembolsos o beneficios, crear un Stripe Customer en cada alta evita pasos manuales:

import Stripe from "stripe";
const stripe = new Stripe(process.env.STRIPE_SECRET);

async function onHire(event) {
  const customer = await stripe.customers.create({
    email: event.data.email,
    name: event.data.fullName,
    metadata: { orquiva_id: event.data.id },
  });
  await fetch(`https://api.orquiva.com/employees/${event.data.id}`, {
    method: "PATCH",
    headers: { Authorization: `Bearer ${token}` },
    body: JSON.stringify({ external_refs: { stripe_id: customer.id } }),
  });
}

Buenas prácticas

  • Verifica la firma HMAC del webhook (header X-Orq-Signature).
  • Idempotencia: cada evento tiene event.id, ignora duplicados.
  • Backoff exponencial si recibes 429.
  • No guardes el token, pide uno nuevo cuando caduque.
Empieza gratis con Orquiva →

SIGUE LEYENDO