Sinch Node.js SDK - v1.6.0
    Preparing search index...

    Class VoiceV2CallbackWebhooks

    Index

    Constructors

    Methods

    • Reviver for a Voice v2 webhook event. This method ensures the object can be treated as a Voice v2 webhook event and should be called before any action is taken to manipulate the object.

      Parameters

      • eventBody: any

        The event body containing the Voice v2 webhook notification.

      Returns WebhookRequest

      • The parsed webhook event object.
    • Serialize a webhook response body to JSON.

      Parameters

      • response: WebhookResponse

        The SVAML commands to return to the Voice platform.

      Returns string

      • The JSON payload to send as the HTTP 200 body.
    • Validate the Authorization header of a Voice v2 webhook request.

      Voice v2 signs callbacks with Authorization: service {serviceId}:{signature}. The signature is Base64(HMAC-SHA256(secretBytes, UTF8(stringToSign))) where secretBytes is the Base64-decoded service secret.

      Use the raw request body exactly as delivered — do not re-serialize JSON before validation.

      Parameters

      • headers: IncomingHttpHeaders

        Incoming request's headers

      • body: any

        Incoming request's raw body

      • path: string

        Incoming request's path (no scheme, host, query or fragment)

      • method: string

        Incoming request's HTTP method

      Returns boolean

      • true if the authorization header is valid
    • Static reviver for a Voice v2 webhook event.

      Parameters

      • eventBody: any

        The event body containing the Voice v2 webhook notification.

      Returns WebhookRequest

      • The parsed webhook event object.
    • Static serializer for a Voice v2 webhook response.

      Parameters

      • response: WebhookResponse

        The SVAML commands to return to the Voice platform.

      Returns string

      • The JSON payload to send as the HTTP 200 body.