I want to update custom_attributes of Intercom through PHP CURL.
I am passing user_id and email as parameter still getting this error. {"code":"400","message":"User email, user_id or anonymous_id must be supplied"}
try {
                $postData = json_encode(array(
                    "user_id" => strval($userDetails["id"]),
                    "email" => $userEmail,
                    "custom_attributes" => ['unsubscribed_from_emails' => 'true']
                ));
                $postHeader = [
                    'Authorization: Bearer <Access Token>',
                    'Accept: application/json',
                    'Content-Type: application/json -d'
                ];
                $curl = curl_init("https://api.intercom.io/users");
                curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "POST");
                curl_setopt($curl, CURLOPT_POSTFIELDS, $postData);
                curl_setopt($curl, CURLOPT_RETURNTRANSFER, FALSE);
                curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
                curl_setopt($curl, CURLOPT_HTTPHEADER, $postHeader);
                curl_exec($curl);
                curl_close($curl);
            } catch (Exception $e) {
                error_log($e->getMessage());
            }
 
                        
As per php.net about the CURLOPT_POSTFIELDS:
https://www.php.net/manual/en/function.curl-setopt.php
But you pass a json instead.