Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing method to update contact's customFields #17

Open
kovinet opened this issue Mar 14, 2017 · 8 comments
Open

Missing method to update contact's customFields #17

kovinet opened this issue Mar 14, 2017 · 8 comments

Comments

@kovinet
Copy link

kovinet commented Mar 14, 2017

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

@FreeDirt
Copy link

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
)
)
)
);

@ranjeetsingh12
Copy link

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

@FreeDirt
Copy link

FreeDirt commented Dec 19, 2017 via email

@kovinet
Copy link
Author

kovinet commented Dec 19, 2017

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);

@ranjeetsingh12
Copy link

Thank You For you help ! I got it working :)

@FreeDirt
Copy link

FreeDirt commented Dec 20, 2017 via email

@woojos
Copy link
Contributor

woojos commented Dec 20, 2017

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' => '[email protected]',
    ),
    '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.

@marinepix
Copy link

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!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

5 participants