An API for integrating between HubSpot CRM, Upright and Slack
- Upright organisational account
- HubSpot Sales Hub Professional or Enterprise
- Slack workspace
- Redis running on port 6379
The API takes in a HubSpot Deal, finds an Upright profile for the Company associated with the Deal, and returns the Upright profile.
There are two endpoints:
Example body:
{
"objectId": "1234567890"
}
200 response:
ok
objectId
is the ID of the Deal in HubSpot (visible in the URL when you open the deal).
You can set up a webhook to this URL in GitHub Actions for some Deal trigger to automatically
send an Upright profile to Slack whenever that trigger fires.
This endpoint is asynchronous, it just always returns ok
if an objectId
was provided.
If there are any errors, they are posted to the Slack admin channel.
If a profile is found, it is posted to the Slack profile channel as a PNG image.
This endpoint is similar to deals
. However, this doesn't post the profile to Slack.
Instead, it returns the PNG image as the response body.
If there are errors, the first error is included in the response body.
git clone [email protected]:ColumbiaRoad/impact-helper-api.git
cd impact-helper-api
cp .env.example .env
- Log in to HubSpot.
- Go to Settings -> Integrations -> Private Apps -> Create a private app.
- Basic info tab: Add a name for your private app (and optionally a logo and description).
- Scopes tab: Add the following scopes:
crm.objects.companies.read
crm.objects.deals.read
- Click Create app -> Continue creating -> Go to app details.
- In the Access token section, click Show token -> Copy.
- In your
.env
file, paste the token as the value ofHUBSPOT_ACCESS_TOKEN
.
- Log in to Upright.
- On the top right, click your name -> Account.
- Go to Administration.
- Generate an API token, copy it and paste it as the
.env
value ofUPRIGHT_API_TOKEN
.
- Create a new channel in Slack. This channel will be used for error messages. You can also use this channel for testing the bot during development.
- Log in to api.slack.com/apps.
- Click Create New App -> From scratch.
- Add App Name and pick a workspace.
- Create App.
- Go to OAuth & Permissions.
- Under Scopes -> Bot Token Scopes, click Add an OAuth Scope. Add the following scopes:
files:write
incoming-webhook
- Scroll up and click Install to Workspace.
- Under Where should post?, select the channel you created earlier.
- Click Allow.
- Copy the Bot User OAuth Token and paste it as the
.env
value ofSLACK_TOKEN
. - In Slack, go to the channel you created earlier. Click on the channel name at the top and scroll down.
- Copy the Channel ID and paste it as the
.env
value ofSLACK_ERROR_CHANNEL
. - Similarly, set
SLACK_CHANNEL
as the channel you want the impact profiles to be posted on (can be the same asSLACK_ERROR_CHANNEL
during development).
Deploy the app and set the environment variables as instructed in .env.example
.
The build script is npm run build
and the start script is npm start
.