Skip to content

Hubspot sync for SCIM created users#3269

Draft
cp-at-mit wants to merge 4 commits intomainfrom
10032-mitxonlinehubspot-integration-is-omitting-user-names-and-profiles
Draft

Hubspot sync for SCIM created users#3269
cp-at-mit wants to merge 4 commits intomainfrom
10032-mitxonlinehubspot-integration-is-omitting-user-names-and-profiles

Conversation

@cp-at-mit
Copy link
Contributor

@cp-at-mit cp-at-mit commented Feb 4, 2026

What are the relevant tickets?

https://github.com/mitodl/hq/issues/10032

Description (What does it do?)

When user's are created via SCIM (the user creates their account via Learn), then they're not synced with Hubspot from MITx Online.

How can this be tested?

Add two pytest tests in hubspot_sync/api_test.py for make_contact_sync_message_from_user: one verifies a minimal user (no legal_address or user_profile) still yields name and email and omits country/state/profile fields; the other verifies an empty name is preserved as an empty string in the properties. Both tests patch upsert_custom_properties and use django_db.
@github-actions
Copy link

github-actions bot commented Feb 4, 2026

OpenAPI Changes

Show/hide ## Changes for v0.yaml:
## Changes for v0.yaml:
6 changes: 2 error, 0 warning, 4 info
error	[api-path-removed-without-deprecation] at base/openapi/specs/v0.yaml	
	in API GET /api/v3/program_enrollments/
		api path removed without deprecation

error	[api-path-removed-without-deprecation] at base/openapi/specs/v0.yaml	
	in API GET /api/v3/program_enrollments/{program_id}/
		api path removed without deprecation

info	[api-schema-removed] 	
	in components/schemas
		removed the schema 'V3ProgramCertificate'

info	[api-schema-removed] 	
	in components/schemas
		removed the schema 'V3SimpleProgram'

info	[api-schema-removed] 	
	in components/schemas
		removed the schema 'V3UserProgramEnrollment'

info	[response-property-enum-value-removed] at head/openapi/specs/v0.yaml	
	in API POST /api/v0/b2b/enroll/{readable_id}/
		removed the 'b2b-error-not-enrollable' enum value from the 'result/allOf[#/components/schemas/ResultEnum]/' response property for the response status '200'



## Changes for v1.yaml:
6 changes: 2 error, 0 warning, 4 info
error	[api-path-removed-without-deprecation] at base/openapi/specs/v1.yaml	
	in API GET /api/v3/program_enrollments/
		api path removed without deprecation

error	[api-path-removed-without-deprecation] at base/openapi/specs/v1.yaml	
	in API GET /api/v3/program_enrollments/{program_id}/
		api path removed without deprecation

info	[api-schema-removed] 	
	in components/schemas
		removed the schema 'V3ProgramCertificate'

info	[api-schema-removed] 	
	in components/schemas
		removed the schema 'V3SimpleProgram'

info	[api-schema-removed] 	
	in components/schemas
		removed the schema 'V3UserProgramEnrollment'

info	[response-property-enum-value-removed] at head/openapi/specs/v1.yaml	
	in API POST /api/v0/b2b/enroll/{readable_id}/
		removed the 'b2b-error-not-enrollable' enum value from the 'result/allOf[#/components/schemas/ResultEnum]/' response property for the response status '200'



## Changes for v2.yaml:
6 changes: 2 error, 0 warning, 4 info
error	[api-path-removed-without-deprecation] at base/openapi/specs/v2.yaml	
	in API GET /api/v3/program_enrollments/
		api path removed without deprecation

error	[api-path-removed-without-deprecation] at base/openapi/specs/v2.yaml	
	in API GET /api/v3/program_enrollments/{program_id}/
		api path removed without deprecation

info	[api-schema-removed] 	
	in components/schemas
		removed the schema 'V3ProgramCertificate'

info	[api-schema-removed] 	
	in components/schemas
		removed the schema 'V3SimpleProgram'

info	[api-schema-removed] 	
	in components/schemas
		removed the schema 'V3UserProgramEnrollment'

info	[response-property-enum-value-removed] at head/openapi/specs/v2.yaml	
	in API POST /api/v0/b2b/enroll/{readable_id}/
		removed the 'b2b-error-not-enrollable' enum value from the 'result/allOf[#/components/schemas/ResultEnum]/' response property for the response status '200'



Unexpected changes? Ensure your branch is up-to-date with main (consider rebasing).

@cp-at-mit cp-at-mit changed the title Add tests for contact sync message edge cases Hubspot sync for SCIM created users Feb 4, 2026
Remove direct HubSpot sync from the ApisixRemoteUser backend and add a dedicated post_save signal to sync newly created User instances. users.apps.UsersConfig now imports users.signals in ready(), and users.signals defines sync_user_to_hubspot_on_create (with a dispatch_uid) to call hubspot_sync.task_helpers.sync_hubspot_user when a User is created. This decouples HubSpot syncing from the authentication backend and avoids duplicate or premature syncs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant