Hey all,
So, this one’s got me spinning my wheels a bit. We’re seeing authenticated visitor data - specifically, the email address - getting dropped after a user submits the pre-chat form. Feels…familiar. Had almost the exact same thing happen back in late '22, turned out to be a weird interaction between the SDK’s session handling and our data action update.
Right now, flow looks like this: visitor authenticates via a custom login widget → SDK sets visitor info (email, name) → visitor lands in chat → pre-chat form pops up. The pre-chat form itself isn’t doing anything fancy, just grabbing a few extra details. But after the submit button is pressed, the email address in the SDK’s getCurrentVisitor() is blank.
We’re using the Web Messaging SDK v2.7.0. The authentication piece is handled on our side, passing the email address to the SDK via setVisitorInfo() before the chat window even opens. It’s been rock solid for months, so I initially ruled out anything with the auth flow itself.
Digging through the network logs, the pre-chat form POST to the messaging endpoint is completing successfully. The data action we’re using is a basic REST POST, just updating a custom contact attribute. It’s not even trying to overwrite the email address - it’s just adding other fields. But something is clearing the existing visitor info.
Spent like 3 hours on this yesterday, bouncing between the SDK documentation, the REST API docs, and the Architect flow. Feels like a race condition somewhere. Maybe the data action update is triggering a re-initialization of the visitor object within the SDK? I’m grasping at straws.
Here’s what we’ve tried so far:
- SDK version: verified we’re on 2.7.0. Rolled back to 2.6.0 just to see if it was a regression - no change.
- Pre-chat form data action: simplified to only POST a single, non-sensitive field. Still causes the issue.
- Data action timing: delayed the data action execution in Architect by 5 seconds. Didn’t help.
- SDK initialization order: double-checked that
setVisitorInfo()is called before the chat window is displayed. - Debugging console: The SDK console is mostly quiet, no errors showing up. It’s doing jack all.
- Architect flow: verified the flow is not overwriting the visitor information.
The strange thing is, it’s intermittent. Happens maybe 60% of the time. It’s driving me nuts.
// Example SDK snippet - this is where we set the visitor info
webMessaging.getCurrentVisitor()
.then(visitor => {
visitor.setEmail(userEmail); // userEmail is populated from auth
visitor.setName(userName);
webMessaging.setVisitorInfo(visitor);
});
Any thoughts?