Skip to content
This repository was archived by the owner on Feb 18, 2026. It is now read-only.

Commit f33fd40

Browse files
committed
chore: dont log errors for webhooks we dont care about
1 parent b5036b7 commit f33fd40

2 files changed

Lines changed: 11 additions & 3 deletions

File tree

apps/platform/src/providers/text/TelnyxTextProvider.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,8 @@ export default class TelnyxTextProvider extends TextProvider {
9191
}
9292

9393
// https://www.twilio.com/docs/messaging/guides/webhook-request
94-
parseInbound(inbound: any): InboundTextMessage {
94+
parseInbound(inbound: any): InboundTextMessage | undefined {
95+
if (inbound.data.event_type !== 'message.received') return
9596
const payload = inbound.data.payload
9697
return {
9798
to: payload.to,

apps/platform/src/providers/text/TextProvider.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export type TextProviderName = 'nexmo' | 'plivo' | 'twilio' | 'logger'
1313

1414
export abstract class TextProvider extends Provider {
1515
abstract send(message: TextMessage): Promise<TextResponse>
16-
abstract parseInbound(inbound: any): InboundTextMessage
16+
abstract parseInbound(inbound: any): InboundTextMessage | undefined
1717

1818
static get group() { return 'text' as ProviderGroup }
1919

@@ -27,7 +27,14 @@ export abstract class TextProvider extends Provider {
2727
const channel = await loadTextChannel(provider.id)
2828
const project = await getProject(provider.project_id)
2929
const message = channel?.provider.parseInbound(ctx.request.body)
30-
if (!channel || !project || !message) ctx.throw(404)
30+
if (!channel || !project) ctx.throw(404)
31+
32+
// If undefined message, we can't parse the body but don't want to
33+
// keep getting the request
34+
if (!message) {
35+
ctx.status = 204
36+
return
37+
}
3138

3239
// Find the user from the inbound text message
3340
const user = await getUserFromPhone(provider.project_id, message.from)

0 commit comments

Comments
 (0)