Inbound Message and Status Capabilities#3
Conversation
There was a problem hiding this comment.
Pull Request Overview
This pull request introduces significant improvements to the SendGrid email connector and Twilio SMS/WhatsApp connector by adding robust support for receiving messages and status updates via webhooks. The PR standardizes the HandleMessageState capability naming and updates channel schemas to reflect these capabilities, along with introducing new error codes for better webhook processing error handling.
- Comprehensive webhook support added to SendGrid Email Connector for receiving inbound emails and status updates
- WhatsApp JSON message source handling capabilities added to Twilio WhatsApp connector with extensive test coverage
- Capability name standardized from
HandlerMessageStatetoHandleMessageStateacross the codebase
Reviewed Changes
Copilot reviewed 27 out of 27 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| WhatsApp_Implementation_Summary.md | Documents comprehensive WhatsApp JSON handling implementation with 60 new tests |
| TwilioWhatsAppConnectorWebhookTests.cs | Tests webhook capabilities for form data and JSON message sources |
| TwilioWhatsAppConnectorJsonTests.cs | Core JSON functionality tests for WhatsApp message receiving |
| TwilioWhatsAppConnectorJsonEdgeCaseTests.cs | Edge case testing for malformed data and error scenarios |
| TwilioSmsConnectorJsonTests.cs | JSON message source handling tests for SMS connector |
| TwilioSmsConnectorJsonEdgeCaseTests.cs | Edge case tests for SMS JSON message processing |
| TwilioSchemaCapabilityTests.cs | Schema capability validation tests |
| SendGrid_Receive_Implementation_Summary.md | Documents SendGrid email receiving implementation |
| SendGridEmailConnectorWebhookTests.cs | Webhook tests for SendGrid email receiving |
| SendGridEmailConnectorJsonTests.cs | JSON webhook tests for SendGrid email processing |
| SendGridEmailConnectorJsonEdgeCaseTests.cs | Edge case tests for SendGrid JSON handling |
| TwilioWhatsAppConnector.cs | Core WhatsApp connector implementation with JSON support |
Comments suppressed due to low confidence (3)
src/Deveel.Messaging.Connectors/Messaging/ChannelRegistry.cs:299
- [nitpick] Consider using a more descriptive variable name than 'connector' since it's used in multiple scopes within the method. Something like 'channelConnector' would improve readability.
IChannelConnector? connector = null;
test/Deveel.Messaging.Connector.Twilio.XUnit/Messaging/TwilioSchemaCapabilityTests.cs:23
- Method name should be updated to reflect the corrected capability name: 'TwilioSmsSchema_HasHandleMessageStateCapability' (note 'Handle' instead of 'Handler').
public void TwilioSmsSchema_HasHandlerMessageStateCapability()
test/Deveel.Messaging.Connector.Twilio.XUnit/Messaging/TwilioSchemaCapabilityTests.cs:56
- Method name should be updated to reflect the corrected capability name: 'TwilioWhatsAppSchema_HasHandleMessageStateCapability' (note 'Handle' instead of 'Handler').
public void TwilioWhatsAppSchema_HasHandlerMessageStateCapability()
|
|
||
| // Act & Assert | ||
| Assert.True(schema.Capabilities.HasFlag(ChannelCapability.HandleMessageState), | ||
| "TwilioWhatsApp schema should have HandlerMessageState capability for receiving status updates via webhooks"); |
There was a problem hiding this comment.
The capability name in the assertion message should be 'HandleMessageState' not 'HandlerMessageState'.
| "TwilioWhatsApp schema should have HandlerMessageState capability for receiving status updates via webhooks"); | |
| "TwilioWhatsApp schema should have HandleMessageState capability for receiving status updates via webhooks"); |
This pull request introduces significant improvements to the SendGrid email connector and Twilio SMS/WhatsApp connector by adding robust support for receiving messages and status updates via webhooks. It also standardizes the naming and usage of the
HandleMessageStatecapability across the codebase and updates channel schemas for SendGrid and Twilio to reflect these capabilities. Additionally, new error codes are introduced for better error handling during webhook processing.Webhook handling and connector enhancements:
SendGridEmailConnector, enabling the receiving of inbound emails and status updates from SendGrid via both JSON and form data webhooks, with robust parsing, error handling, and mapping to internal message/status models.SendGridErrorCodesfor invalid webhook data, unsupported content types, and failures in receiving messages or statuses, improving error reporting and diagnostics.Channel capability and schema updates:
HandlerMessageStatetoHandleMessageStatein theChannelCapabilityenum and updated all relevant usages, ensuring consistency across the codebase. [1] [2]HandleMessageStatecapability as appropriate, ensuring accurate capability representation for each schema variant. [1] [2] [3] [4] [5] [6] [7]Other minor improvements:
using System;directive inSendGridEmailConnector.csto support new functionality.