Open choran opened 6 years ago
Working on this one and it seems that somewhere where we serialize the JSON object to be sent to the Intercom servers, we are disregarding any changes to null.
If I try to run the code in the OP there I get the following payload:
"params":{"id":"5a045c938b874d2a82e7413a","email":"bobz12@example.com","avatar":{"type":"avatar"},"signed_up_at":1511349783,"last_seen_ip":"188.80.56.31","custom_attributes":{"average_monthly_spend":1500.0},"last_seen_user_agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36","last_request_at":1511349783,"unsubscribed_from_emails":false}
Running the same setting the email to null sends the following payload:
"params":{"id":"5a045c938b874d2a82e7413a","user_id":"notyomama","avatar":{"type":"avatar"},"signed_up_at":1511349783,"last_seen_ip":"188.80.56.31","custom_attributes":{"average_monthly_spend":1500.0},"last_seen_user_agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36","last_request_at":1511349783,"unsubscribed_from_emails":false}
That's odd, because using curl for the same user but just changing the created_at, sends a lot less params:
"params":{"id":"5a045c938b874d2a82e7413a","created_at":1234567891,"user":{"id":"5a045c938b874d2a82e7413a","created_at":1234567891}}
Figuring out where these params are being created, and validating my suspicion that the way we are creating the JSON payload is ignoring null values. I'll investigate.
Investigated this alongside @thewheat and this isn't a trivial fix as we will have to refactor how we create the JSON payload sent to the endpoints. Postponing a fix until we get other more impactful changes out.
Description
null
does not send the data to the APIEvidence
If you run the above code you will see that it does not change the suer_id