Add message text logging to SMS webhook handler

- Log the message text for regular SMS: "Received text" with text content
- Log "Received image" for MMS messages without the content
- Includes masked phone number and message ID in both cases

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Khalid A
2026-04-17 18:26:48 -05:00
parent 84121b46ae
commit 3a151f3832

View File

@@ -46,10 +46,13 @@ async function handleInbound(body: unknown, deps: WebhookSmsRouterDeps) {
// MMS check
if (hasMedia) {
logger.info({ event: 'sms.received_image', from: maskPhone(from), messageId }, 'Received image');
await sendSms(from, to, SMS_TEMPLATES.MMS_NOT_SUPPORTED());
return;
}
logger.info({ event: 'sms.received_text', from: maskPhone(from), text, messageId }, 'Received text');
// Rate limit
const maxPerHour = parseInt(process.env.SMS_RATE_LIMIT_PER_HOUR || '10', 10);
if (!checkSmsRateLimit(phoneHash, maxPerHour)) {