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

**URL:** <https://forum.mautic.org/t/contact-syncing-from-mautic-to-salesforce-is-not-working-in-mautic-4-latest-stable-release/21065>\
**Category:** Product Support\
**Tags:** mautic-4\
**Created:** [September 29, 2021, 4:57pm UTC](https://forum.mautic.org/t/contact-syncing-from-mautic-to-salesforce-is-not-working-in-mautic-4-latest-stable-release/21065 "2021-09-29T16:57:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![viratraaz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/viratraaz/32/4344_2.png) [@viratraaz](https://forum.mautic.org/u/viratraaz)\
**Post date:** [September 29, 2021, 4:57pm UTC](https://forum.mautic.org/t/contact-syncing-from-mautic-to-salesforce-is-not-working-in-mautic-4-latest-stable-release/21065/1 "2021-09-29T16:57:36Z")

</div>

**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/](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](http://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](http://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](http://domain=.salesforce.com); path=/; expires=Thu, 29-Sep-2022 16:30:53 GMT; Max-Age=31536000  
Set-Cookie: BrowserId\_sec=nT0hVSFCEeyG0nsnJ8ITDg; [domain=.salesforce.com](http://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”}]}

---

<div class="post-metadata">

**Author:** ![radu](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/radu/32/412_2.png) [@radu](https://forum.mautic.org/u/radu)\
**Post date:** [October 6, 2021, 2:35pm UTC](https://forum.mautic.org/t/contact-syncing-from-mautic-to-salesforce-is-not-working-in-mautic-4-latest-stable-release/21065/2 "2021-10-06T14:35:12Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![silavapi](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/silavapi/32/7424_2.png) [@silavapi](https://forum.mautic.org/u/silavapi)\
**Post date:** [October 8, 2021, 4:37pm UTC](https://forum.mautic.org/t/contact-syncing-from-mautic-to-salesforce-is-not-working-in-mautic-4-latest-stable-release/21065/3 "2021-10-08T16:37:44Z")

</div>

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

> <https://github.com/mautic/mautic/issues/10517>
>
> \### Mautic Version
> 
> 4.0.0
> 
> \### PHP version
> 
> 7.4
> 
> \### What browsers are you seein…g the problem on?
> 
> Not relevant
> 
> \### What happened?
> 
> Reported on the forums:
> 
> https://forum.mautic.org/t/contact-syncing-from-mautic-to-salesforce-is-not-working-in-mautic-4-latest-stable-release/21065
> 
> I was able to reproduce with HubSpot.
> 
> There were two contacts in the segment:
> 
> ruth.cheesley@MacBookPro-RuthCheesley mautic % ddev exec bin/console m:c:t
> Triggering events for campaign 3
> Triggering events for newly added contacts
> 2 total events(s) to be processed in batches of 100 contacts
> 2/2 \[============================\] 100%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
> 
> 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 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
> 
> 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
> 
> \### How can we reproduce this issue?
> 
> Step 1: Create a segment with at least one contact in it
> Step 2: Set up an integration - HubSpot or Salesforce for example - and map fields First Name, Last Name, Email.
> Step 3: Add a campaign action to push to integration
> Step 4: Run the crons to build segment, build campaign, trigger campaign
> Step 5: Notice error in the command line output
> 
> \### Relevant log output
> 
> \`\`\`shell
> ruth.cheesley@MacBookPro-RuthCheesley mautic % ddev exec bin/console m:c:t
> Triggering events for campaign 3
> Triggering events for newly added contacts
> 2 total events(s) to be processed in batches of 100 contacts
> 2/2 \[============================\] 100%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
> 
> 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 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
> 
> 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
> \`\`\`
> 
> 
> \### Code of Conduct
> 
> \- \[X\] I confirm that I have read and agree to follow this project's Code of Conduct

---

<div class="post-metadata">

**Author:** ![mayanktiwaridotcom](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/mayanktiwaridotcom/32/1501_2.png) [@mayanktiwaridotcom](https://forum.mautic.org/u/mayanktiwaridotcom)\
**Post date:** [January 22, 2022, 6:16am UTC](https://forum.mautic.org/t/contact-syncing-from-mautic-to-salesforce-is-not-working-in-mautic-4-latest-stable-release/21065/4 "2022-01-22T06:16:20Z")

</div>

This issue is expected to be fixed in mautic 4.1.2 as only the merge is pending for pull request,  
for a quick fix you can  
[https://raw.githubusercontent.com/mautic/mautic/2a85a79f8d465bff113a448449cbc60fdff2a2c6/app/bundles/PluginBundle/Integration/AbstractIntegration.php](https://raw.githubusercontent.com/mautic/mautic/2a85a79f8d465bff113a448449cbc60fdff2a2c6/app/bundles/PluginBundle/Integration/AbstractIntegration.php)  
download this file and replace  
/app/bundles/PluginBundle/Integration/AbstractIntegration.php with the new fixed file.
