GithubHelp home page GithubHelp logo

hubspot's Introduction

HubSpot

HubSpot API in Go.

Installation

go get github.com/Fyb3roptik/hubspot

Examples

import(
  "github.com/Fyb3roptik/hubspot"
)

api_key := os.Getenv("HUBSPOT_API_KEY")

Create Contact via Contact API

a := hubspot.NewContact(api_key, "[email protected]")
a.Add("firstname", "Abhi")
a.Add("lastname", "Yerra")
a.Add("company", "Acksin")
a.Add("lifecyclestage", "opportunity")
a.Add("acksinsoftware", "opsZero")
resp := a.Publish()
if resp.Vid != 901 {
        t.Errorf("Failed to update contact")
}

Create New Deal via Deal API

d := hubspot.NewDeal(api_key)
d.Associations.AssociatedVids = []int{resp.Vid}
d.Add("dealname", "Tim's Newer Deal")
d.Add("dealstage", "closedwon")
d.Add("closedate", Timestamp())
d.Add("amount", "60000")
d.Add("dealtype", "newbusiness")
d.Publish()

Create Single-Send Email via Single-Send API

// Single Send Email has 2 property types. Contact and Custom, so we need to specify using the first param. The To, From and ReplyTo are required.
message := hubspot.Message{
  To: "[email protected]",
  From: "[email protected]",
  ReplyTo: "[email protected]",
}
e := hubspot.NewEmail(api_key, email_id, message)

// Adding a contact property
e.Add("contact", "firstname", "Jack")

// Adding a custom property
e.Add("custom", "some_custom_key", "some_custom_value")

e.Publish()

Create a New Contact via Form API

e := hubspot.NewForm(api_key, portal_id, form_guid)
e.Add("firstname", "Tester")
e.Add("lastname", "McTest")
e.Add("email", "[email protected]")
e.Publish()

Credit

This is based on the original library written by acksin

hubspot's People

Contributors

abhiyerra avatar floscom avatar fyb3roptik avatar

Watchers

 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.