Open kovinet opened 7 years ago
How to update contact in GetResponse API3. Automation is not triggering in API 1.5. Pls. help, Thank you.
$result = $client->set_contact_customs( $api_key, array ( 'contact' => $contact_id, 'customs' => array ( array ( 'name' => 'myCustomfield', 'content' => $customs ) ) ) );
Hello .. Is there any update regarding this issue ? I am also using the API V3 & not able to update the contact's custom fields. Please let me know if can help me out. Thanks
Sorry, They only told me that they don’t have support for their API.
Regards, Ryan Mendoza
DR. KLIPPE Philippines Corporation Ryan U. Mendoza Bldg. 11C-1 Berthaphil I Industrial Park Jose Abad Santos Avenue Clark Freeport Zone, Pampanga Philippines 2023
Office: +63 45 499 0273 Mobile: +63 906 272 6950 (Globe) Mobile: +63 998 963 6950 (Smart) Skype: r.usi Email: r.mendoza@acc.dr-klippe.de Web: www.dr-klippe.com
On 15 Dec 2017, at 2:46 PM, ranjeetsingh12 notifications@github.com wrote:
Hello .. Is there any update regarding this issue ? I am also using the API V3 & not able to update the contact's custom fields. Please let me know if can help me out. Thanks
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/GetResponse/getresponse-api-php/issues/17#issuecomment-351927535, or mute the thread https://github.com/notifications/unsubscribe-auth/AXcQUorUD5mCZVBqiBrJ1JD2OpWrzriZks5tAhXUgaJpZM4McMCx.
The solution (or workaround) is to call updateContact($contact_id)
method but instead of just putting id of contact you can add '/custom-fields' string concatenated to it like this:
$response = $getresponse->updateContact($contactId . '/custom-fields', $params);
Thank You For you help ! I got it working :)
Hello sir,
I can’t get it right. is there something wrong with my code? please help thank you.
$result = $getresponse->getContacts(array( 'query' => array( 'email' => 'Mytest@getresponse.com', ), 'fields' => 'name,email,campaign,,' ));
$response = $getresponse->updateContact(array( 'contact' => $result, 'campaign' => array('campaignId' => 'Cpid'), 'customFieldValues' => array( array('customFieldId' => CfId', 'value' => array( 'test2' )), array('customFieldId' => ‘CfId', 'value' => array( 'test03' )) ) ));
echo 'DONE!';
Regards, Ryan Mendoza
DR. KLIPPE Philippines Corporation Ryan U. Mendoza Bldg. 11C-1 Berthaphil I Industrial Park Jose Abad Santos Avenue Clark Freeport Zone, Pampanga Philippines 2023
Office: +63 45 499 0273 Mobile: +63 906 272 6950 (Globe) Mobile: +63 998 963 6950 (Smart) Skype: r.usi Email: r.mendoza@acc.dr-klippe.de Web: www.dr-klippe.com
On 19 Dec 2017, at 3:58 PM, ranjeetsingh12 notifications@github.com wrote:
Thank You For you help ! I got it working :)
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/GetResponse/getresponse-api-php/issues/17#issuecomment-352667248, or mute the thread https://github.com/notifications/unsubscribe-auth/AXcQUrSaoHdxXpID-vRlN6wG3puix7Lgks5tB2y1gaJpZM4McMCx.
Hi
You should use method updateContact as in @kovinet example. updateContact as a first param requires contact id as a string. In your example it's an array.
Try something like this:
$result = (array)$getresponse->getContacts(array(
'query' => array(
'email' => 'example@gmail.com',
),
'fields' => 'name,email,campaign,,'
));
$contactId = $result['0']->contactId;;
$response = $getresponse->updateContact(
$contact_id . '/custom-fields',
array(
'customFieldValues' => array(
array('customFieldId' => CfId',
'value' => array(
'test2'
)),
array('customFieldId' => ‘CfId',
'value' => array(
'test03'
))
)
)
);
BTW, this library is no longer supported and maintained. The new one is on the way.
With the most recent API (v3?) In order to add custom fields when creating a new contact, you need to enclose the array of customFieldValues in an array! Crazy stuff! Here's what i've ended up doing: $json_object = array( "campaign" => array( "campaignId" => "A" ), "email"=>$email, 'customFieldValues' => array(array( 'customFieldId' => 'u', 'value' => array('free') )) );
There might be a better way but I've had no response from GetResponse's support team. HTH someone... took me ages to find (onstackoverflow in the end!)
There is a missing method to only update custom fields of contact, as documented here: https://apidocs.getresponse.com/v3/resources/contacts#contacts.upsert.custom-fields