Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
BeLi4L opened this issue Feb 12, 2025 · 1 comment
Open

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

BeLi4L opened this issue Feb 12, 2025 · 1 comment
Assignees
Labels
question Question about how to use the SDK

Comments

@BeLi4L
Copy link
Contributor

BeLi4L commented Feb 12, 2025

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
@BeLi4L BeLi4L added the question Question about how to use the SDK label Feb 12, 2025
@manchuck
Copy link
Contributor

@BeLi4L The SDK does not include types for webhook requests. The types you see are used to type how we send the requests to the API. With some of the requests, custom data cannot be easily typed, so we felt it was not necessary. However, since you're requesting webhook types, we can look into adding them. I'll leave this open so I can give you updates

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Question about how to use the SDK
Projects
None yet
Development

No branches or pull requests

4 participants