Code Monkey home page Code Monkey logo

hubspot's Introduction

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

hubspot's People

Contributors

retgits avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.