Skip to content

leonelquinteros/hubspot

Folders and files

NameName
Last commit message
Last commit date
Aug 29, 2019
Jul 29, 2019
Sep 26, 2019
Aug 29, 2019
Apr 21, 2021
Aug 30, 2019
Aug 30, 2019
Aug 29, 2019
Sep 1, 2019
Sep 2, 2019
Sep 1, 2019
Sep 16, 2019
Aug 29, 2019
Aug 30, 2019
Aug 30, 2019
Apr 15, 2021
Aug 30, 2019

Repository files navigation

GitHub release MIT license GoDoc Go Report Card

HubSpot API client SDK for Go

Install

go get github.com/leonelquinteros/hubspot

Quickstart

package main

import "github.com/leonelquinteros/hubspot"

func main() {
    // Create client object with config from environment variables (HUBSPOT_API_HOST, HUBSPOT_API_KEY, HUBSPOT_OAUTH_TOKEN)
    c := hubspot.NewClient(hubspot.NewClientConfig())

    // Create new contact
    data := hubspot.ContactsRequest{
		hubspot.Properties: []hubspot.Property{
			hubspot.Property{
				Property: "email",
				Value:    "contact@example.com",
			},
			hubspot.Property{
				Property: "firstname",
				Value:    "Contact",
			},
			hubspot.Property{
				Property: "lastname",
				Value:    "Example",
			},
		},
    }
    r, err := c.Contacts().Create(data)
	if err != nil {
		log.Fatal(err)
	}

    // Get contact by email
    contact, err = c.Contacts().GetByEmail("contact@example.com")
    if err != nil {
        log.Fatal(err)
    }

    // Print contact object
    fmt.Printf("%+v", contact)
}

Full documentation

https://godoc.org/github.com/leonelquinteros/hubspot