![Go Report Card](https://camo.githubusercontent.com/39eef3af2d3eeaea96997803d53a295bccf602dc6b0cc86032831208d2e00775/68747470733a2f2f676f7265706f7274636172642e636f6d2f62616467652f6769746875622e636f6d2f6c656f6e656c7175696e7465726f732f68756273706f74)
HubSpot API client SDK for Go
go get github.com/leonelquinteros/hubspot
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)
}
https://godoc.org/github.com/leonelquinteros/hubspot