![Go Report Card](https://camo.githubusercontent.com/5ca53687b2d5c6318219f75ecd8286b0ba032325314bc4c8271bedfb885debd0/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: "[email protected]",
},
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("[email protected]")
if err != nil {
log.Fatal(err)
}
// Print contact object
fmt.Printf("%+v", contact)
}
https://godoc.org/github.com/leonelquinteros/hubspot