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

Add support for updateByEmail to the Contact resource #85

Merged
merged 1 commit into from
Feb 15, 2017

Conversation

dominics
Copy link
Contributor

Fixes #84

@ryanwinchester ryanwinchester merged commit 04c627a into HubSpot:master Feb 15, 2017
@flexgrip
Copy link

flexgrip commented Feb 17, 2017

Is this on packagist yet? And also is this the reason why I haven't been able to update a contact by email? I can't figure it out. I've been getting a 204 response. But the contact in hubspot is not updating. Example:

            # Instantiate new hubspot factory using the FD api key
            $hubspot = \SevenShores\Hubspot\Factory::create('123');

            # URL decode the orignal email
            $update_email = $orig_email;

            # Get the contact from the original form submit
            $contact = $hubspot->contacts()->getByEmail($update_email);

            # Instantiate the current time
            $now = Carbon::now();

            # Now use their vid to update the contact with the proper name, phone and email
            $props["properties"] = [
                array("property" => "email", "value" => $email),
                array("property" => "firstname", "value" => $name),
                array("property" => "phone", "value" => $phone),
                array("property" => "fd_account_create_date", "value" => $now->timestamp * 1000),
            ];

            # Last, update the contact.
            $update_contact = $hubspot->contacts()->update($contact->vid, json_encode($props));

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

Successfully merging this pull request may close these issues.

None yet

3 participants