chatwoot icon indicating copy to clipboard operation
chatwoot copied to clipboard

Pre Chat Form will ask for full name even it is already provided with `setUser()`

Open lwagner-getmomo opened this issue 2 years ago • 5 comments

Describe the bug

The Pre Chat Form on the Website will still ask for fullName even though setUser() has been called correctly. In this case the contact being created by setUser() has a fullName populated, taken from the name tribute passed into setUser() (as expected).

Hiding the emailAddress Pre Chat Form field for logged in users works as expected.

To Reproduce

Steps to reproduce the behavior:

  1. Set up a live chat as described in https://www.chatwoot.com/docs/product/channels/live-chat/sdk/setup/. Make sure to also set up setUser() and make sure to pass at least an email and a name
  2. Chatwoot Backend: In the settings of the associated inbox go to the tab "Pre Chat Form"
  3. Chatwoot Backend: Enable the feature by selecting Yes from the "Enable pre chat form" dropdown.
  4. Chatwoot Backend: Enable the form fields with the following keys: emailAddress, fullName
  5. Chatwoot Backend: Press the "Update" button
  6. On the Website: Start a chat. When setUser() has not been called, everything should work as expected. However, when setUser() has been called, the pre chat form still asks for the full name (note, the property in setUser() is called name, but we tried supplementing that with fullName with the same result). The email address is being omitted as expected.
  7. On the Website: Putting anything into full name will be ignored. If it's required, the user will still be forced to provide a full name.

Expected behavior

When setUser() has been called with a name provided, the fullName should be omitted in the pre chat form.

Screenshots

Screeshot of field settings in mailbox settings: Screen Shot 2022-09-12 at 15 40 59

Screeshot of chatwoot window when logged in: Screen Shot 2022-09-12 at 15 58 57

Screeshot of chatwoot window when logged out: Screen Shot 2022-09-12 at 16 01 13

Browser logs

None

Server logs

Sep 12 03:52:29 PM  I, [2022-09-12T13:52:29.236651 #1]  INFO -- : source=rack-timeout id=9c6b35c2-57fe-4d30-a6b0-1170c4a0c6c9 wait=0ms timeout=15000ms state=ready
Sep 12 03:52:29 PM  I, [2022-09-12T13:52:29.237394 #1]  INFO -- : [9c6b35c2-57fe-4d30-a6b0-1170c4a0c6c9] Started GET "/api/v1/accounts/2/contacts/152" for 172.71.98.130 at 2022-09-12 13:52:29 +0000
Sep 12 03:52:29 PM  I, [2022-09-12T13:52:29.239305 #1]  INFO -- : source=rack-timeout id=9c57fd53-f35a-4730-a8d9-885ff587d97a wait=0ms timeout=15000ms state=ready
Sep 12 03:52:29 PM  I, [2022-09-12T13:52:29.240435 #1]  INFO -- : [9c6b35c2-57fe-4d30-a6b0-1170c4a0c6c9] Processing by Api::V1::Accounts::ContactsController#show as JSON
Sep 12 03:52:29 PM  I, [2022-09-12T13:52:29.240723 #1]  INFO -- : [9c6b35c2-57fe-4d30-a6b0-1170c4a0c6c9]   Parameters: {"account_id"=>"2", "id"=>"152"}
Sep 12 03:52:29 PM  I, [2022-09-12T13:52:29.243248 #1]  INFO -- : [9c57fd53-f35a-4730-a8d9-885ff587d97a] Started GET "/api/v1/accounts/2/conversations/30/messages?before=155" for 172.71.98.180 at 2022-09-12 13:52:29 +0000
Sep 12 03:52:29 PM  I, [2022-09-12T13:52:29.245231 #1]  INFO -- : source=rack-timeout id=a7cf7c80-83e3-4456-84e3-5cc0cdaab43d wait=0ms timeout=15000ms state=ready
Sep 12 03:52:29 PM  I, [2022-09-12T13:52:29.246531 #1]  INFO -- : [9c57fd53-f35a-4730-a8d9-885ff587d97a] Processing by Api::V1::Accounts::Conversations::MessagesController#index as JSON
Sep 12 03:52:29 PM  I, [2022-09-12T13:52:29.246919 #1]  INFO -- : [9c57fd53-f35a-4730-a8d9-885ff587d97a]   Parameters: {"before"=>"155", "account_id"=>"2", "conversation_id"=>"30"}
Sep 12 03:52:29 PM  I, [2022-09-12T13:52:29.247856 #1]  INFO -- : [a7cf7c80-83e3-4456-84e3-5cc0cdaab43d] Started GET "/api/v1/accounts/2/conversations/30/labels" for 172.71.98.42 at 2022-09-12 13:52:29 +0000
Sep 12 03:52:29 PM  I, [2022-09-12T13:52:29.252513 #1]  INFO -- : [a7cf7c80-83e3-4456-84e3-5cc0cdaab43d] Processing by Api::V1::Accounts::Conversations::LabelsController#index as JSON
Sep 12 03:52:29 PM  I, [2022-09-12T13:52:29.255019 #1]  INFO -- : [a7cf7c80-83e3-4456-84e3-5cc0cdaab43d]   Parameters: {"account_id"=>"2", "conversation_id"=>"30"}
Sep 12 03:52:29 PM  I, [2022-09-12T13:52:29.254053 #1]  INFO -- : source=rack-timeout id=5a201b75-ec1c-4fac-a02e-2bca0ca49662 wait=0ms timeout=15000ms state=ready
Sep 12 03:52:29 PM  I, [2022-09-12T13:52:29.259234 #1]  INFO -- : [5a201b75-ec1c-4fac-a02e-2bca0ca49662] Started GET "/api/v1/accounts/2/assignable_agents?inbox_ids[]=4" for 172.71.98.42 at 2022-09-12 13:52:29 +0000
Sep 12 03:52:29 PM  I, [2022-09-12T13:52:29.263588 #1]  INFO -- : [5a201b75-ec1c-4fac-a02e-2bca0ca49662] Processing by Api::V1::Accounts::AssignableAgentsController#index as JSON
Sep 12 03:52:29 PM  I, [2022-09-12T13:52:29.264242 #1]  INFO -- : [5a201b75-ec1c-4fac-a02e-2bca0ca49662]   Parameters: {"inbox_ids"=>["4"], "account_id"=>"2"}
Sep 12 03:52:29 PM  I, [2022-09-12T13:52:29.273377 #1]  INFO -- : source=rack-timeout id=75b730a8-8e1d-442c-aa8f-016518243ec5 wait=0ms timeout=15000ms state=ready
Sep 12 03:52:29 PM  I, [2022-09-12T13:52:29.281262 #1]  INFO -- : [75b730a8-8e1d-442c-aa8f-016518243ec5] Started GET "/api/v1/accounts/2/contacts/152/contactable_inboxes" for 172.71.98.102 at 2022-09-12 13:52:29 +0000
Sep 12 03:52:29 PM  I, [2022-09-12T13:52:29.290392 #1]  INFO -- : [75b730a8-8e1d-442c-aa8f-016518243ec5] Processing by Api::V1::Accounts::ContactsController#contactable_inboxes as JSON
Sep 12 03:52:29 PM  I, [2022-09-12T13:52:29.292897 #1]  INFO -- : [75b730a8-8e1d-442c-aa8f-016518243ec5]   Parameters: {"account_id"=>"2", "id"=>"152"}
Sep 12 03:52:29 PM  I, [2022-09-12T13:52:29.347444 #1]  INFO -- : [a7cf7c80-83e3-4456-84e3-5cc0cdaab43d]   Rendered api/v1/accounts/conversations/labels/index.json.jbuilder (Duration: 0.2ms | Allocations: 28)
Sep 12 03:52:29 PM  I, [2022-09-12T13:52:29.361693 #1]  INFO -- : [a7cf7c80-83e3-4456-84e3-5cc0cdaab43d] Completed 200 OK in 106ms (Views: 4.7ms | ActiveRecord: 66.0ms | Allocations: 20373)
Sep 12 03:52:29 PM  I, [2022-09-12T13:52:29.362814 #1]  INFO -- : source=rack-timeout id=a7cf7c80-83e3-4456-84e3-5cc0cdaab43d wait=0ms timeout=15000ms service=118ms state=completed
Sep 12 03:52:29 PM  I, [2022-09-12T13:52:29.375060 #1]  INFO -- : [9c6b35c2-57fe-4d30-a6b0-1170c4a0c6c9]   Rendered api/v1/accounts/contacts/show.json.jbuilder (Duration: 53.3ms | Allocations: 12421)
Sep 12 03:52:29 PM  I, [2022-09-12T13:52:29.390275 #1]  INFO -- : [9c6b35c2-57fe-4d30-a6b0-1170c4a0c6c9] Completed 200 OK in 149ms (Views: 25.7ms | ActiveRecord: 84.8ms | Allocations: 31384)
Sep 12 03:52:29 PM  I, [2022-09-12T13:52:29.393404 #1]  INFO -- : source=rack-timeout id=9c6b35c2-57fe-4d30-a6b0-1170c4a0c6c9 wait=0ms timeout=15000ms service=157ms state=completed
Sep 12 03:52:29 PM  I, [2022-09-12T13:52:29.435970 #1]  INFO -- : [9c57fd53-f35a-4730-a8d9-885ff587d97a]   Rendered api/v1/accounts/conversations/messages/index.json.jbuilder (Duration: 82.5ms | Allocations: 14047)
Sep 12 03:52:29 PM  I, [2022-09-12T13:52:29.441315 #1]  INFO -- : [9c57fd53-f35a-4730-a8d9-885ff587d97a] Completed 200 OK in 193ms (Views: 29.5ms | ActiveRecord: 123.9ms | Allocations: 35565)
Sep 12 03:52:29 PM  I, [2022-09-12T13:52:29.444131 #1]  INFO -- : source=rack-timeout id=9c57fd53-f35a-4730-a8d9-885ff587d97a wait=0ms timeout=15000ms service=205ms state=completed
Sep 12 03:52:29 PM  I, [2022-09-12T13:52:29.442873 #1]  INFO -- : [75b730a8-8e1d-442c-aa8f-016518243ec5]   Rendered api/v1/accounts/contacts/contactable_inboxes.json.jbuilder (Duration: 0.1ms | Allocations: 33)
Sep 12 03:52:29 PM  I, [2022-09-12T13:52:29.450055 #1]  INFO -- : [75b730a8-8e1d-442c-aa8f-016518243ec5] Completed 200 OK in 157ms (Views: 5.4ms | ActiveRecord: 107.5ms | Allocations: 28075)
Sep 12 03:52:29 PM  I, [2022-09-12T13:52:29.451381 #1]  INFO -- : source=rack-timeout id=75b730a8-8e1d-442c-aa8f-016518243ec5 wait=0ms timeout=15000ms service=178ms state=completed
Sep 12 03:52:29 PM  I, [2022-09-12T13:52:29.463944 #1]  INFO -- : [5a201b75-ec1c-4fac-a02e-2bca0ca49662]   Rendered api/v1/accounts/assignable_agents/index.json.jbuilder (Duration: 107.4ms | Allocations: 18055)
Sep 12 03:52:29 PM  I, [2022-09-12T13:52:29.466466 #1]  INFO -- : [5a201b75-ec1c-4fac-a02e-2bca0ca49662] Completed 200 OK in 200ms (Views: 48.7ms | ActiveRecord: 120.1ms | Allocations: 35738)
Sep 12 03:52:29 PM  I, [2022-09-12T13:52:29.467235 #1]  INFO -- : source=rack-timeout id=5a201b75-ec1c-4fac-a02e-2bca0ca49662 wait=0ms timeout=15000ms service=213ms state=completed
Sep 12 03:52:29 PM  I, [2022-09-12T13:52:29.530994 #1]  INFO -- : source=rack-timeout id=5f98c3ef-bd6c-4c3a-9832-b676ee9ac285 wait=0ms timeout=15000ms state=ready
Sep 12 03:52:29 PM  I, [2022-09-12T13:52:29.532229 #1]  INFO -- : [5f98c3ef-bd6c-4c3a-9832-b676ee9ac285] Started POST "/api/v1/accounts/2/conversations/30/update_last_seen" for 172.71.98.130 at 2022-09-12 13:52:29 +0000
Sep 12 03:52:29 PM  I, [2022-09-12T13:52:29.534967 #1]  INFO -- : [5f98c3ef-bd6c-4c3a-9832-b676ee9ac285] Processing by Api::V1::Accounts::ConversationsController#update_last_seen as JSON
Sep 12 03:52:29 PM  I, [2022-09-12T13:52:29.535042 #1]  INFO -- : [5f98c3ef-bd6c-4c3a-9832-b676ee9ac285]   Parameters: {"account_id"=>"2", "id"=>"30"}
Sep 12 03:52:29 PM  I, [2022-09-12T13:52:29.591562 #1]  INFO -- : source=rack-timeout id=2e9c2b80-b249-43b4-8e4c-2bacbbafb7c0 wait=0ms timeout=15000ms state=ready
Sep 12 03:52:29 PM  I, [2022-09-12T13:52:29.592594 #1]  INFO -- : [2e9c2b80-b249-43b4-8e4c-2bacbbafb7c0] Started GET "/api/v1/accounts/2/custom_attribute_definitions" for 172.71.98.42 at 2022-09-12 13:52:29 +0000
Sep 12 03:52:29 PM  I, [2022-09-12T13:52:29.598401 #1]  INFO -- : [2e9c2b80-b249-43b4-8e4c-2bacbbafb7c0] Processing by Api::V1::Accounts::CustomAttributeDefinitionsController#index as JSON
Sep 12 03:52:29 PM  I, [2022-09-12T13:52:29.598520 #1]  INFO -- : [2e9c2b80-b249-43b4-8e4c-2bacbbafb7c0]   Parameters: {"account_id"=>"2"}
Sep 12 03:52:29 PM  I, [2022-09-12T13:52:29.624066 #1]  INFO -- : [2e9c2b80-b249-43b4-8e4c-2bacbbafb7c0]   Rendered api/v1/accounts/custom_attribute_definitions/index.json.jbuilder (Duration: 6.2ms | Allocations: 838)
Sep 12 03:52:29 PM  I, [2022-09-12T13:52:29.627948 #1]  INFO -- : [2e9c2b80-b249-43b4-8e4c-2bacbbafb7c0] Completed 200 OK in 29ms (Views: 2.4ms | ActiveRecord: 17.8ms | Allocations: 4928)
Sep 12 03:52:29 PM  I, [2022-09-12T13:52:29.628787 #1]  INFO -- : source=rack-timeout id=2e9c2b80-b249-43b4-8e4c-2bacbbafb7c0 wait=0ms timeout=15000ms service=37ms state=completed
Sep 12 03:52:29 PM  I, [2022-09-12T13:52:29.653281 #1]  INFO -- : [5f98c3ef-bd6c-4c3a-9832-b676ee9ac285]   Rendered api/v1/accounts/conversations/update_last_seen.json.jbuilder (Duration: 65.4ms | Allocations: 10692)
Sep 12 03:52:29 PM  I, [2022-09-12T13:52:29.655727 #1]  INFO -- : [5f98c3ef-bd6c-4c3a-9832-b676ee9ac285] Completed 200 OK in 121ms (Views: 49.5ms | ActiveRecord: 53.4ms | Allocations: 14668)
Sep 12 03:52:29 PM  I, [2022-09-12T13:52:29.656557 #1]  INFO -- : source=rack-timeout id=5f98c3ef-bd6c-4c3a-9832-b676ee9ac285 wait=0ms timeout=15000ms service=126ms state=completed
Sep 12 03:52:30 PM  I, [2022-09-12T13:52:30.759813 #1]  INFO -- : source=rack-timeout id=1ef8cae5-6500-404c-86a9-a2c9a4b412b4 timeout=15000ms state=ready
Sep 12 03:52:30 PM  I, [2022-09-12T13:52:30.760829 #1]  INFO -- : [1ef8cae5-6500-404c-86a9-a2c9a4b412b4] Started GET "/api" for 10.200.17.61 at 2022-09-12 13:52:30 +0000
Sep 12 03:52:30 PM  I, [2022-09-12T13:52:30.763399 #1]  INFO -- : [1ef8cae5-6500-404c-86a9-a2c9a4b412b4] Processing by ApiController#index as */*
Sep 12 03:52:30 PM  I, [2022-09-12T13:52:30.764514 #1]  INFO -- : [1ef8cae5-6500-404c-86a9-a2c9a4b412b4] Completed 200 OK in 1ms (Views: 0.3ms | ActiveRecord: 0.0ms | Allocations: 337)
Sep 12 03:52:30 PM  I, [2022-09-12T13:52:30.764803 #1]  INFO -- : source=rack-timeout id=1ef8cae5-6500-404c-86a9-a2c9a4b412b4 timeout=15000ms service=5ms state=completed
Sep 12 03:52:30 PM  I, [2022-09-12T13:52:30.954379 #1]  INFO -- : source=rack-timeout id=3660ad21-8765-474c-85bb-bedb88314546 timeout=15000ms state=ready
Sep 12 03:52:30 PM  I, [2022-09-12T13:52:30.954767 #1]  INFO -- : [3660ad21-8765-474c-85bb-bedb88314546] Started GET "/api" for 10.200.17.61 at 2022-09-12 13:52:30 +0000
Sep 12 03:52:30 PM  I, [2022-09-12T13:52:30.957260 #1]  INFO -- : [3660ad21-8765-474c-85bb-bedb88314546] Processing by ApiController#index as */*
Sep 12 03:52:30 PM  I, [2022-09-12T13:52:30.958391 #1]  INFO -- : [3660ad21-8765-474c-85bb-bedb88314546] Completed 200 OK in 1ms (Views: 0.2ms | ActiveRecord: 0.0ms | Allocations: 337)
Sep 12 03:52:30 PM  I, [2022-09-12T13:52:30.959080 #1]  INFO -- : source=rack-timeout id=3660ad21-8765-474c-85bb-bedb88314546 timeout=15000ms service=5ms state=completed

Environment

We're using a chatwoot docker container (chatwoot/chatwoot:latest). It's being updated automatically whenever there is a new image available.

Desktop (please complete the following information):

  • OS: MacOS
  • Browser: Safari Version 15.6.1 (17613.3.9.1.16); Firefox Version 104.0.2 (64-bit)

Additional context

None that we're aware, but we're happy to answer any questions, should they arise.

lwagner-getmomo avatar Sep 12 '22 15:09 lwagner-getmomo

@iamsivin Can you please investigate this issue?

pranavrajs avatar Sep 13 '22 12:09 pranavrajs

@pranavrajs Tested it and verified this issue. You can see it in the attached loom video. https://www.loom.com/share/2f318850d17e4983876881abc950d29c

If we set the name and email through setUser, and the Pre Chat Form is enabled it will still ask for the name and email.

iamsivin avatar Sep 13 '22 15:09 iamsivin

@iamsivin Thanks. If it is a small fix, let us get it fixed this sprint itself. If not, feel free to move to the next one.

pranavrajs avatar Sep 16 '22 21:09 pranavrajs

@pranavrajs It's an easy fix, but there is an issue when we click the start conversation button a random name will be generated. So if we add a condition if the name is available to hide the name field we cannot add a name when pre chat form Is enabled.

iamsivin avatar Sep 19 '22 16:09 iamsivin

Thanks a lot for investigating on behalf of our whole team!

lwagner-getmomo avatar Sep 20 '22 14:09 lwagner-getmomo

@lwagner-getmomo We are working on it. The fix should be available in the upcoming release

muhsin-k avatar Sep 23 '22 05:09 muhsin-k

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

github-actions[bot] avatar Nov 16 '22 16:11 github-actions[bot]