Get DEAL information when Stage is changed


I’m new to APIs and looking for a method to extract all the information pertaining to that one particular DEAL (including the company and customer name info).
My goal is to be able to pull this information out, which i will be plugging into an engagement letter to send to that customer (that portion is already finished with VBA). I just need to find a a way to get the DEAL info out of the system, and somehow pull it into a spreadsheet and save it on a sever, which is where my vba would pull the information into an word document.

I have no idea if this is possible, or really where to start.

anyone’s tips would be greatly appreciated.


@jason_jost You can set up a webhook to know when a deal stage has changed.

Once you have that then you can hit our recently changed endpoint.

This will give you all the information that you would need.

Using Webhook / Deal Property Changed - Deal Stage


Thanks for the tip. this does give me some direction to start working towards. can you provide any other details. Please forgive me, as my understanding of API and webhooks is eqivalent to a 8th grader in a Calculus class. I understand the use of webhooks and APIs, but i dont have any experience in setting them up and getting them to work together.


@jason_jost I would install postman. It is a tool that can help you test out API calls.

Go through the documentation I posted above for receiving the recent deals. Postman will allow you to test out your calls with out having to worry about writing code at all. Once you are receiving what you want/expect then you can worry about writing in the API calls to a script to automate it.


I have been playing around with POSTMAN. my only issue right now is trying to figure out how to setup the Oauth 2.0 so i can make those requests.

Right now, if i try to use an API without the OAuth, i get an error saying i >reached my daily limit", which im assuming is because i dont have an access token setup. I’ve been searching around for the last hour trying to figure out where i get the data fields for that (auth url, access token url, client id, client secret). this is my one hang up right now


@jason_jost How many calls have you made today? Your call limit(40k/day) would be counted for either HAPI key or token authentication. Here is some example code I wrote up on how to do it in NodeJS using PassPortJS as the middleware

var express = require('express')
var passport = require('passport')
var app = express()
var OAuth2Strategy = require('passport-oauth').OAuth2Strategy;

var port = 3000
console.log("i'm on, running at port: " + port)

// used to serialize the user for the session
passport.serializeUser(function(user, done) {
    done(null, user); 
   // where is this going? Are we supposed to access this anywhere?

// used to deserialize the user
passport.deserializeUser(function(id, done) {
    User.findById(id, function(err, user) {
        done(err, user);

//Dev information can be accessed here:
passport.use('hubspot', new OAuth2Strategy({
    authorizationURL: '',
    tokenURL: '',
    clientID: 'xxxxx',
    clientSecret: 'xxxxx',
    callbackURL:   'http://localhost:'+port+'/auth/hubspot/callback'
  function(accessToken, refreshToken, profile, done) {
    //console.log('profile', profile)
    var authInfo = {
      refreshToken: refreshToken
    request('' + accessToken, function(error, response, body, authInfo){
        console.log('authInfo', this.authInfo)
        json_response = JSON.parse(body)
        var accessToken = this.authInfo.accessToken
        var refreshToken = this.authInfo.refreshToken
        User.findOrCreate({ email: json_response.user, hub_id:json_response.hub_id, access_token:accessToken, refresh_token: refreshToken }, function (err, user,created) {
          return done(err, user);


app.get('/auth/hubspot', passport.authenticate('hubspot',{scope:['contacts','content','reports','social','automation','timeline']}));
app.get('/auth/hubspot/callback',  passport.authenticate('hubspot', { failureRedirect: '/login' }),
  function(req, res) {
    // console.log('req.session.passport.user')
    // console.log(req.session.passport.user)
    // console.log('req.session.passport')
    // console.log(req.session.passport)
    // Successful authentication, redirect home.


Here is our documentation on it.

You would get the secret and clientID yourself. you can follow the docs above to get those.

Using Webhook / Deal Property Changed - Deal Stage


Oh, i havent made any calls today. thats why i knew i wasnt setting it up right when i was tyring to run an API and it was telling me that i was over the limit!

Thanks, I’m going to run through this really quick and see where it takes me.



So here is what i got in. i run this, click on my developer account, and it tells me that there is an error getting integrations permissions.


i do have a token already setup on the other end, but this still doesnt seem to be working.


your call back address should be pointing towards hubspot and not postman. Take a couple good whacks at it and let me know if you make any damage.


In case anyone comes across this post the proper internal name is dealstage not Deal Stage