verifyTwilioRequest (delivery/twilio.ts)

OpenBot · server/src/delivery/twilio.ts · typescript · MIT
voice, Voice / Speech

Provides Twilio request verification and a transport for sending SMS and verification requests with error handling.

// Source: https://github.com/CopilotKit/OpenBot | License: MIT | Copyright 2026 CopilotKit
// Provided via justclaw.it.com; keep this notice with the code.
import { validateRequest } from "twilio";
import { DELIVERY_REQUEST_TIMEOUT_MS } from "../timeouts";
import {
  DeliveryProviderError,
  type ProviderFetch,
  providerJson,
} from "./types";
export function verifyTwilioRequest(input: {
  url: string;
  params: URLSearchParams;
  signature: string | null;
  token: string;
}): boolean {
  if (!input.signature || !/^[A-Za-z0-9+/]{27}=$/.test(input.signature))
    return false;
  const keys = [...input.params.keys()];
  if (new Set(keys).size !== keys.length) return false;
  return validateRequest(
    input.token,
    input.signature,
    input.url,
    Object.fromEntries(input.params),
 

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key