Mautic Community Forums

Contact syncing from mautic to salesforce is not working in mautic 4 (latest stable release)

Your software
My Mautic version is: 4.0.1
My PHP version is: 7.4.3
My Database type and version is: MySQL80Platform 8.0.26-0ubuntu0.20.04.2

Your problem
My problem is: Unable to push contacts from mautic to salesforce

These errors are showing in the log:
REQUEST:
POST https://bimus123456.my.salesforce.com/services/data/v38.0/composite/
array (
0 => ‘Authorization: Bearer 000hiding0for0security0reason’,
)

array (
‘allOrNone’ => ‘false’,
‘compositeRequest’ =>
array (
0 =>
array (
‘method’ => ‘POST’,
‘url’ => ‘/services/data/v38.0/sobjects/Lead’,
‘referenceId’ => ‘9949-Lead’,
‘body’ =>
array (
‘Company’ => ‘0011H00001S2nnmQAB’,
‘Email’ => ‘virat@test.local’,
‘LastName’ => ‘Test2’,
‘Type__c’ => ‘Developer’,
‘FirstName’ => ‘Virat’,
),
‘httpHeaders’ =>
array (
‘Sforce-Auto-Assign’ => ‘TRUE’,
),
),
),
)

array (
‘encode_parameters’ => ‘json’,
‘curl_options’ =>
array (
32 => 6,
),
‘request_timeout’ => 300,
)
PHP Warning: http_build_query() expects parameter 1 to be array, string given in /var/www/html/vendor/guzzlehttp/guzzle/src/Client.php on line 359
PHP Notice: Undefined index: compositeResponse in /var/www/html/plugins/MauticCrmBundle/Integration/SalesforceIntegration.php on line 2395
1/1 [============================] 100%
Number of contacts pushed: 0 updated, 0 created, 0 had errors and 1 were ignored (likely duplicates or didn’t match field criteria)

Steps I have tried to fix the problem:
I tried to send request manually to check whether request is working or not. It wasn’'t. So I modified few header and it started working. Please update the salesforce plugin, so that it would start working.

REQUEST
POST /services/data/v38.0/composite/ HTTP/1.1
Host: bimus123456.my.salesforce.com
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:92.0) Gecko/20100101 Firefox/92.0
Authorization: Bearer 000hiding0for0security0reason
Sforce-Auto-Assign: TRUE
Content-Type:application/json
Connection: close
Content-Length: 299

{
“allOrNone” : false,
“compositeRequest” : [{
“method” : “POST”,
“url” : “/services/data/v38.0/sobjects/Lead”,
“referenceId” : “9949-Lead”,
“body” : { “Company” : “0011H00001S2nnmQAB”,“Email”:“virat@test.local”,“LastName”:“Test2”,“Type__c”:“Developer”,“FirstName”:“Virat” }
}]
}

RESPONSE
HTTP/1.1 200 OK
Date: Wed, 29 Sep 2021 16:30:53 GMT
Set-Cookie: CookieConsentPolicy=0:0; domain=bimus123456.my.salesforce.com; path=/; expires=Thu, 29-Sep-2022 16:30:53 GMT; Max-Age=31536000
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
X-Robots-Tag: none
Referrer-Policy: origin-when-cross-origin
Cache-Control: no-cache,must-revalidate,max-age=0,no-store,private
Set-Cookie: BrowserId=nT0hVSFCEeyG0nsnJ8ITDg; domain=.salesforce.com; path=/; expires=Thu, 29-Sep-2022 16:30:53 GMT; Max-Age=31536000
Set-Cookie: BrowserId_sec=nT0hVSFCEeyG0nsnJ8ITDg; domain=.salesforce.com; path=/; expires=Thu, 29-Sep-2022 16:30:53 GMT; Max-Age=31536000; secure; SameSite=None
Sforce-Limit-Info: api-usage=8615/103000
Content-Type: application/json;charset=UTF-8
Vary: Accept-Encoding
Connection: close
Content-Length: 217

{“compositeResponse”:[{“body”:{“id”:“00Q8V00001JSOnNUAX”,“success”:true,“errors”:},“httpHeaders”:{“Location”:"/services/data/v38.0/sobjects/Lead/00Q8V00001JSOnNUAX"},“httpStatusCode”:201,“referenceId”:“9949-Lead”}]}

1 Like

Same thing happens with hubspot integration. same error:

[2021-10-06 17:07:15] mautic.WARNING: PHP Warning - http_build_query() expects parameter 1 to be array, string given - in file /home/cheerup/connect.cheerup.ro/vendor/guzzlehttp/guzzle/src/Client.php - at line 359

Hope someone knows hot to fix it

1 Like

Confirmed this bug with HubSpot in 4.0.1, I’ve raised the bug here:

1 Like