hubspot

module
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 16, 2019 License: MIT

README

HubSpot

Godoc

Why build this?

HubSpot has a great API to allow you to create a functional application or integration quickly and easily. The APIs they expose are the same that power the HubSpot application. There isn't a good abstraction to be able to use those in Go apps, unless you want to marshal and unmarshal things yourself and have code with tons of HTTP requests.

Usage

To use the HubSpot module, you'll need to create an API key. That key can be used to create the hubspot client.

import (
	"fmt"

	"github.com/retgits/hubspot/client"
)

func main() {
    hubspot := client.NewClient().WithAPIKey("<myAccessToken>")
	fmt.Println(hubspot.APIKey)
}

Depending on which type of resource you want to access, you'll need to import one of the services

import (
    "github.com/retgits/hubspot/client/contacts" // If you want to use the contacts API
    "github.com/retgits/hubspot/client/crmassociations" // If you want to use the crm associations API
    "github.com/retgits/hubspot/client/deals" // If you want to use the deals API
    "github.com/retgits/hubspot/client/engagement" // If you want to use the engagements API
    "github.com/retgits/hubspot/client/tickets" // If you want to use the tickets API
)

For example, getting the first name of the most recently updated contact in HubSpot would be like:

package main

import (
	"fmt"

	"github.com/retgits/hubspot/client"
	"github.com/retgits/hubspot/client/contacts"
)

func main() {
    // Create a new HubSpot client
    hubspot := client.NewClient().WithAPIKey("<myAccessToken>")
    // Create a new Contacts service
    contactsSvc := contacts.New(hubspot).WithProperties([]string{"firstname"})
	// Get all the recentlu updated contacts
    contacts, _err_ := contactsSvc.GetRecentlyUpdatedContacts()
    // Print the first in the array
    fmt.Printf("%s", contacts[0].Properties["firstname"]["value"])
}

Contributing

Currently the methods I use regularly are implemented, so chances are that something you might need is missing. If something is missing, or if you'd like to suggest new features feel free to create an issue or a PR!

License

See the LICENSE file in the repository

Acknowledgements

A most sincere thanks to the team of HubSpot, for building a great CRM!

_This package is not endorsed by HubSpot

Directories

Path Synopsis
contacts
Package contacts are for the fundamental building block to HubSpot, contacts.
Package contacts are for the fundamental building block to HubSpot, contacts.
crmassociations
Package crmassociations covers the CRM Associations API is used to manage associations between objects in the HubSpot CRM.
Package crmassociations covers the CRM Associations API is used to manage associations between objects in the HubSpot CRM.
deals
Package deals covers the Deals API which has been exposed to allow for easy integration with the HubSpot CRM objects.
Package deals covers the Deals API which has been exposed to allow for easy integration with the HubSpot CRM objects.
engagement
Package engagement covers the engagements which are used to store data from CRM actions, including notes, tasks, meetings, and calls.
Package engagement covers the engagements which are used to store data from CRM actions, including notes, tasks, meetings, and calls.
tickets
Package tickets is part of HubSpots preview program, and should be considered as a non-stable release that will be subject to bugs and breaking changes while under development.
Package tickets is part of HubSpots preview program, and should be considered as a non-stable release that will be subject to bugs and breaking changes while under development.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL