-
Notifications
You must be signed in to change notification settings - Fork 298
[Hubspot] Update hubspot custom event action to handle numeric strings #3523
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3523 +/- ##
===========================================
+ Coverage 31.86% 80.03% +48.17%
===========================================
Files 15 1249 +1234
Lines 747 23142 +22395
Branches 126 4607 +4481
===========================================
+ Hits 238 18522 +18284
- Misses 509 3759 +3250
- Partials 0 861 +861 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes a schema mismatch issue in the HubSpot custom event action where numeric string values (e.g., "123") were being inferred as numbers during schema creation, but HubSpot had the corresponding properties defined as strings, causing validation errors.
Changes:
- Adds logic to detect when a property is inferred as a number but HubSpot expects a string, and converts the value to a string before sending
- Implements conversion for both cache hit scenarios (using cached schema) and cache miss scenarios (fetching from HubSpot)
- Adds comprehensive test coverage for various numeric string scenarios including single properties, multiple properties, partial matches, and verification that actual numbers remain unconverted
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
types.ts |
Adds numericStrings array to SchemaDiff type to track properties requiring conversion |
index.ts |
Adds call to convertNumericStrings for cache hits and passes payload to getSchemaFromHubspot for conversion |
hubspot-event-schema-functions.ts |
Implements numeric-to-string conversion logic when fetching schema from HubSpot, distinguishing string mismatches from other type mismatches |
cache-functions.ts |
Adds numericStrings tracking in compareSchemas and implements convertNumericStrings utility function |
index.test.ts |
Adds comprehensive test suite covering cache hits, cache misses, multiple numeric strings, partial property matches, and validation that actual numbers aren't converted |
joe-ayoub-segment
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comment

In HubSpot custom event actions, numeric string values in properties were being inferred as numbers. When the corresponding property in HubSpot was actually defined as a string, this resulted in schema mismatch errors.
This PR updates the inference logic to correctly handle numeric strings. If a value is inferred as a number but the property type in HubSpot is a string, we convert the value back to a string before sending it.
JIRA -> https://twilio-engineering.atlassian.net/browse/STRATCONN-6467
Testing
Testing Document
Include any additional information about the testing you have completed to
ensure your changes behave as expected. For a speedy review, please check
any of the tasks you completed below during your testing.
Security Review
Please ensure sensitive data is properly protected in your integration.
type: 'password'