Skip to content

How Do I: Type the Webhook events I receive from Vonage #985

Open
@BeLi4L

Description

How do I

type the webhook events I receive from Vonage

API/Product

Accounts

Code Sample

Context

I'm working on integrating "Silent Auth" into our product, and I'm writing an HTTP endpoint to receive Vonage webhook events.
I need to know the types of the events I can receive.

Problem

I see there's a SilentAuthCallback type but it does NOT match the reality of what we receive.

Indeed, some objects I received looked like:

{
  "request_id": "...",
  "triggered_at": "2025-02-04T14:49:47.893Z",
  "channel": "silent_auth",
  "status": "failed",
  "type": "event"
}

where "action" is missing, or:

{
  "request_id": "...",
  "submitted_at": "2025-02-04T14:49:42.000Z",
  "finalized_at": "2025-02-04T14:49:47.000Z",
  "status": "failed",
  "workflow": [
    {
      "channel": "silent_auth",
      "status": "failed",
      "initiated_at": "2025-02-04T14:49:43.332Z"
    }
  ],
  "channel_timeout": 180,
  "type": "summary"
}

which is not at all a SilentAuthCallback object.

Potential solution(s)

  • Improve typings by specifying all possible event types, e.g.
    export type SilentAuthCallback =
      | SilentAuthSucceededCallback
      | SilentAuthFailedCallback
      | SilentAuthSummaryCallback
      | SilentAuthExpiredCallback // and so on for all types of event...
    
    export type SilentAuthFailedCallback = {
      request_id: string;
      triggered_at: string;
      channel: "silent_auth";
      status: "failed";
      type: "event";
    }
    
    // ...
  • Also adding a union type or an enum for the "type" field

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Labels

questionQuestion about how to use the SDK

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions