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

How to create a contact #25

Closed
Baspa opened this issue Jun 23, 2020 · 1 comment
Closed

How to create a contact #25

Baspa opened this issue Jun 23, 2020 · 1 comment

Comments

@Baspa
Copy link

Baspa commented Jun 23, 2020

At this moment I fetch the contacts like this:

Route::get('/', function (Rossjcooper\LaravelHubSpot\HubSpot $hubspot) {
    $response = $hubspot->contacts()->all();
    foreach ($response->contacts as $contact) {
        echo sprintf(
            "Contact name is %s %s." . PHP_EOL,
            $contact->properties->firstname->value,
            $contact->properties->lastname->value
        );
    }
});

How can I make a post request to create a contact?

@shawnreid
Copy link

shawnreid commented Jun 23, 2020

$response = HubSpot::contacts()->createOrUpdate(<email>, [[
    'property'  => 'email',
    'value'     => <email>
], [
    'property'  => 'phone',
    'value'     => <phone>
], [
   ....etc
]]);

@Baspa Baspa closed this as completed Jun 24, 2020
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

No branches or pull requests

2 participants