This repository was archived by the owner on Feb 18, 2026. It is now read-only.
File tree Expand file tree Collapse file tree
apps/platform/src/providers/text Expand file tree Collapse file tree Original file line number Diff line number Diff 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 ,
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ export type TextProviderName = 'nexmo' | 'plivo' | 'twilio' | 'logger'
1313
1414export 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 )
You can’t perform that action at this time.
0 commit comments