Skip to content

Fix unknown user auto-creation in messaging webhooks#82

Open
MRiabov wants to merge 1 commit into
mainfrom
fix-unknown-user-auto-creation-025-15567271081987070927
Open

Fix unknown user auto-creation in messaging webhooks#82
MRiabov wants to merge 1 commit into
mainfrom
fix-unknown-user-auto-creation-025-15567271081987070927

Conversation

@MRiabov
Copy link
Copy Markdown
Owner

@MRiabov MRiabov commented Feb 11, 2026

This PR implements the requirement from Spec 025 (Clerk Authentication) to prevent automatic user creation for unknown numbers messaging the CRM. Instead of creating a new business and user immediately, the system now replies with a registration link.

Changes:

  • src/services/auth_service.py: Added create argument (default True) to get_or_create_user and get_or_create_user_by_identity.
  • src/config/__init__.py: Added clerk_sign_up_url setting.
  • src/api/routes.py: Updated messaging webhooks to check for user existence without creation. If the user does not exist, a registration prompt is sent via MessagingService.
  • tests/test_twilio_webhook.py: Updated mock expectations.

Verified with reproduction test (deleted) and existing tests.


PR created automatically by Jules for task 15567271081987070927 started by @MRiabov

- Modify `AuthService.get_or_create_user` and `get_or_create_user_by_identity` to accept `create` flag.
- Update `src/api/routes.py` (WhatsApp, Twilio, Generic, TextGrid webhooks) to invoke `get_or_create_user(..., create=False)`.
- Implement registration prompt flow: if user is unknown, send a reply with `clerk_sign_up_url` instead of creating an account.
- Add `clerk_sign_up_url` to `Settings`.
- Update tests to reflect new behavior.

Co-authored-by: MRiabov <108194191+MRiabov@users.noreply.github.com>
@google-labs-jules
Copy link
Copy Markdown

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

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