Skip to content

Inbound Message and Status Capabilities#3

Merged
tsutomi merged 2 commits into
mainfrom
receive-capabilities
Aug 6, 2025
Merged

Inbound Message and Status Capabilities#3
tsutomi merged 2 commits into
mainfrom
receive-capabilities

Conversation

@tsutomi

@tsutomi tsutomi commented Aug 6, 2025

Copy link
Copy Markdown
Member

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 HandleMessageState capability 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:

  • Added comprehensive webhook support to 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.
  • Introduced new error codes in SendGridErrorCodes for invalid webhook data, unsupported content types, and failures in receiving messages or statuses, improving error reporting and diagnostics.

Channel capability and schema updates:

  • Standardized the capability name from HandlerMessageState to HandleMessageState in the ChannelCapability enum and updated all relevant usages, ensuring consistency across the codebase. [1] [2]
  • Updated SendGrid and Twilio channel schemas to include or remove the HandleMessageState capability as appropriate, ensuring accurate capability representation for each schema variant. [1] [2] [3] [4] [5] [6] [7]

Other minor improvements:

  • Added a missing using System; directive in SendGridEmailConnector.cs to support new functionality.

@tsutomi tsutomi requested a review from Copilot August 6, 2025 08:27
@tsutomi tsutomi self-assigned this Aug 6, 2025
@tsutomi tsutomi added the enhancement New feature or request label Aug 6, 2025

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 HandlerMessageState to HandleMessageState across 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()

Comment thread src/Deveel.Messaging.Connector.Twilio/Messaging/TwilioWhatsAppConnector.cs Outdated

// Act & Assert
Assert.True(schema.Capabilities.HasFlag(ChannelCapability.HandleMessageState),
"TwilioWhatsApp schema should have HandlerMessageState capability for receiving status updates via webhooks");

Copilot AI Aug 6, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The capability name in the assertion message should be 'HandleMessageState' not 'HandlerMessageState'.

Suggested change
"TwilioWhatsApp schema should have HandlerMessageState capability for receiving status updates via webhooks");
"TwilioWhatsApp schema should have HandleMessageState capability for receiving status updates via webhooks");

Copilot uses AI. Check for mistakes.
@tsutomi tsutomi merged commit 57a6354 into main Aug 6, 2025
6 checks passed
@tsutomi tsutomi deleted the receive-capabilities branch August 6, 2025 08:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants