Conversation
… on cauldron with Salesforce sandbox
… testing on cauldron with Salesforce sandbox" This reverts commit 973d3a8.
There was a problem hiding this comment.
Pull request overview
Adds the user’s interface language to the Salesforce “chatbot opt-in” webhook payload so English vs Hebrew users can be segmented for Library Assistant marketing.
Changes:
- Extend
send_chatbot_opt_in_webhook/dispatch_chatbot_opt_in_webhookto accept aninterface_languageargument and include it in the webhook JSON (interfaceLanguage). - Plumb
interface_languagefromUserProfile.settings["interface_language"]when firing the webhook on experiment opt-in/out changes. - Update unit/integration tests to pass/expect the new language field in webhook payloads and dispatch calls.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
sefaria/helper/crm/tasks.py |
Adds interface_language parameter and sends it to Salesforce in the webhook payload. |
sefaria/helper/crm/chatbot_webhook_test.py |
Updates webhook tests to include/assert interfaceLanguage; updates dispatch tests to call with the new argument. |
reader/tests/experiments_admin_test.py |
Updates expectations for webhook dispatch calls to include the interface language. |
reader/models.py |
Reads interface_language from the user profile and forwards it into webhook dispatch. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| dispatch_chatbot_opt_in_webhook("user@example.com", True) | ||
| dispatch_chatbot_opt_in_webhook("user@example.com", True, "english") | ||
|
|
||
| mock_task.apply_async.assert_called_once() |
There was a problem hiding this comment.
test_dispatch_celery_enabled_uses_apply_async currently only asserts that apply_async was called, but not that the new interface_language argument is actually forwarded. Since this PR adds interface_language support, this test should assert apply_async was called with the expected args (including the interface language) and queue, to prevent regressions where the new field silently stops being sent when Celery is enabled.
| mock_task.apply_async.assert_called_once() | |
| mock_task.apply_async.assert_called_once() | |
| _, kwargs = mock_task.apply_async.call_args | |
| assert kwargs["args"] == ["user@example.com", True, "english"] | |
| assert "queue" in kwargs | |
| assert kwargs["queue"] |
Description
Sends the user's interface language to Salesforce so English and Hebrew users can be differentiated for marketing campaigns related to the Library Assistant