Skip to content
This repository has been archived by the owner on Jan 9, 2025. It is now read-only.

feat: add HubSpot component #199

Merged
merged 19 commits into from
Jul 26, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
202 changes: 202 additions & 0 deletions application/hubspot/v0/README.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,202 @@
---
title: "HubSpot"
lang: "en-US"
draft: false
description: "Learn about how to set up a VDP HubSpot component https://github.com/instill-ai/instill-core"
---

The HubSpot component is an application component that allows users to use HubSpot application to do various tasks.
It can carry out the following tasks:

- [Get Contact](#get-contact)
- [Create Contact](#create-contact)
- [Get Deal](#get-deal)
- [Create Deal](#create-deal)
- [Get Thread](#get-thread)
- [Retrieve Association](#retrieve-association)



## Release Stage

`Alpha`



## Configuration

The component configuration is defined and maintained [here](https://github.com/instill-ai/component/blob/main/application/hubspot/v0/config/definition.json).




## Setup


| Field | Field ID | Type | Note |
| :--- | :--- | :--- | :--- |
| Token (required) | `token` | string | Fill in your HubSpot private app access token. Go here for more information: https://developers.hubspot.com/docs/api/private-apps |




## Supported Tasks

### Get Contact

Get contact information using contact ID or Email


| Input | ID | Type | Description |
| :--- | :--- | :--- | :--- |
| Task ID (required) | `task` | string | `TASK_GET_CONTACT` |
| Contact ID or Email (required) | `contactIdOrEmail` | string | Input contact ID or email. If the input has @, it will search the contact using email |



| Output | ID | Type | Description |
| :--- | :--- | :--- | :--- |
| Owner ID (optional) | `ownerId` | string | Owner ID |
| Email Address (optional) | `email` | string | Email address |
| First Name (optional) | `firstName` | string | First name |
| Last Name (optional) | `lastName` | string | Last name |
| Phone Number (optional) | `phoneNumber` | string | Phone number. Preferably, format is in country code + phone number. Example: +886xxxxxxxxx |
| Company (optional) | `company` | string | Company |
| Job Title (optional) | `jobTitle` | string | Job title |
| Lifecycle Stage (optional) | `lifecycleStage` | string | Lifecycle stage. Default format is in small letters, all words are combined. Example: salesqualifiedlead. However, remember to check internal value for custom fields. |
| Lead Status (optional) | `leadStatus` | string | Lead status. Default format is in capital letters, with _ as space. Example: IN_PROGRESS. However, remember to check internal value for custom fields. |
| Contact ID | `contactId` | string | Contact ID |






### Create Contact

Create new contact


| Input | ID | Type | Description |
| :--- | :--- | :--- | :--- |
| Task ID (required) | `task` | string | `TASK_CREATE_CONTACT` |
| Owner ID | `ownerId` | string | Owner ID |
| Email Address (required) | `email` | string | Email address |
| First Name | `firstName` | string | First name |
| Last Name | `lastName` | string | Last name |
| Phone Number | `phoneNumber` | string | Phone number. Preferably, format is in country code + phone number. Example: +886xxxxxxxxx |
| Company | `company` | string | Company |
| Job Title | `jobTitle` | string | Job title |
| Lifecycle Stage | `lifecycleStage` | string | Lifecycle stage. Default format is in small letters, all words are combined. Example: salesqualifiedlead. However, remember to check internal value for custom fields. |
| Lead Status | `leadStatus` | string | Lead status. Default format is in capital letters, with _ as space. Example: IN_PROGRESS. However, remember to check internal value for custom fields. |



| Output | ID | Type | Description |
| :--- | :--- | :--- | :--- |
| Contact ID | `contactId` | string | Contact ID |






### Get Deal

Get deal information using deal ID


| Input | ID | Type | Description |
| :--- | :--- | :--- | :--- |
| Task ID (required) | `task` | string | `TASK_GET_DEAL` |
| Deal ID (required) | `dealId` | string | Input deal ID |



| Output | ID | Type | Description |
| :--- | :--- | :--- | :--- |
| Owner ID (optional) | `ownerId` | string | Owner ID |
| Deal Name | `dealName` | string | Deal name |
| Pipeline | `pipeline` | string | Pipeline. HubSpot uses interval value rather than the name displayed in the view |
| Deal Stage | `dealStage` | string | Deal stage. Default format is in small letters, all words are combined. Example: qualifiedtobuy. However, remember to check internal value for custom fields. |
| Amount (optional) | `amount` | string | Amount |
| Deal Type (optional) | `dealType` | string | Deal type. Default format is in small letters, all words are combined. Example: newbusiness. However, remember to check internal value for custom fields. |
| Close Date (optional) | `closeDate` | string | Close date. Format is in ISO 8601. Example: 2024-07-01T11:47:40.388Z |
| Create Date (optional) | `createDate` | string | Create date. Format is in ISO 8601. Example: 2024-07-01T11:47:40.388Z |






### Create Deal

Create new contact


| Input | ID | Type | Description |
| :--- | :--- | :--- | :--- |
| Task ID (required) | `task` | string | `TASK_CREATE_DEAL` |
| Contact ID or Email | `contactIdOrEmail` | string | Use to associate contact with deal. If the input has @, it will use email, otherwise, it will use contact id. |
| Deal Name (required) | `dealName` | string | Deal name |
| Pipeline (required) | `pipeline` | string | Pipeline. HubSpot uses interval value rather than the name displayed in the view |
| Deal Stage (required) | `dealStage` | string | Deal stage. Default format is in small letters, all words are combined. Example: qualifiedtobuy. However, remember to check internal value for custom fields. |
| Amount | `amount` | string | Amount |
| Deal Type | `dealType` | string | Deal type. Default format is in small letters, all words are combined. Example: newbusiness. However, remember to check internal value for custom fields. |
| Close Date | `closeDate` | string | Close date. Format is in ISO 8601. Example: 2024-07-01T11:47:40.388Z |



| Output | ID | Type | Description |
| :--- | :--- | :--- | :--- |
| Deal ID | `dealId` | string | Deal ID |






### Get Thread

Retrieve all the messages inside a thread (conversation inbox)


| Input | ID | Type | Description |
| :--- | :--- | :--- | :--- |
| Task ID (required) | `task` | string | `TASK_GET_THREAD` |
| Thread ID (required) | `threadId` | string | Input thread ID |



| Output | ID | Type | Description |
| :--- | :--- | :--- | :--- |
| Messages | `results` | array[object] | An array of messages |






### Retrieve Association

Get all the object IDs associated with contact ID


| Input | ID | Type | Description |
| :--- | :--- | :--- | :--- |
| Task ID (required) | `task` | string | `TASK_RETRIEVE_ASSOCIATION` |
| Contact ID (required) | `contactId` | string | Input contact ID |
| Object Type (required) | `objectType` | string | Input object type (CRM objects or 'Threads'). Note: CRM objects include 'Deals', 'Companies', 'Tickets', etc |



| Output | ID | Type | Description |
| :--- | :--- | :--- | :--- |
| Object ID Array | `results` | array[object] | An array of object ID |







26 changes: 26 additions & 0 deletions application/hubspot/v0/config/definition.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"availableTasks": [
"TASK_GET_CONTACT",
"TASK_CREATE_CONTACT",
"TASK_GET_DEAL",
"TASK_CREATE_DEAL",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question
Do we need TASK_UPDATE_DEAL for this story?
image

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question
It seems the design here is like

  1. Get Contact
  2. If there is no Contact, Create Contact (with company info)
  3. Get Company
  4. If there is no Company, Create Company
  5. Get Deal
  6. If there is no Deal, Create Deal
  7. Get Ticket
  8. If there is no Ticket, Create Ticket
  9. Get Thread
  10. If there is update from the conversation, Insert Message.

So, now, Does it seem we miss insert Message to Thread?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question

As a sales manager, he/she wants to supervise the status of each client.

If you fake the sales tool component first, is your design able to fulfil this story request?

If my understanding is correct, we may miss company-id in Contact object

Copy link
Collaborator Author

@AmeliaCelline AmeliaCelline Jul 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question
Do we need TASK_UPDATE_DEAL for this story?

Question
It seems the design here is like

I will answer these questions together.

  1. First regarding the design. Initially when I was designing the component, I was thinking, how does HubSpot component fit together with the other already-made components and future possible components. For the "create" tasks, such as "create deal" and "create contact", I thought users will benefit from this when "Run on Event" pipeline is ready. Example: A WhatsApp message from a new client -> Create a new contact in HubSpot. For the "get" tasks, it is mainly for summarization purpose. With an email of the client, all the information about the client is obtainable (using the retrieve association task), then afterward can use LLM to summarize all those information.

  2. Second, regarding the TASK_UPDATE_DEAL. I thought update was not needed because I don't see the use case of it. I don't see how the output of text summarization will lead to the need of update.

So, now, Does it seem we miss insert Message to Thread?

Yes, I was debating on this as well. I think I will create it after all.

If you fake the sales tool component first, is your design able to fulfil this story request?
If my understanding is correct, we may miss company-id in Contact object

Yes, I think you are right after all. I will provide options for the user to be able to create contact -> object association (including company).

I am not sure what you mean by fake the sales tool, feel free to elaborate it thanks.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AmeliaCelline

Second, regarding the TASK_UPDATE_DEAL. I thought update was not needed because I don't see the use case of it. I don't see how the output of text summarization will lead to the need of update.

Maybe I missed some points. But, as I known, deal means the case that a sales is processing.
So, it means when a sales have a update with their clients in WhatsApp, the deal will be updated according to their message.

e.g. when a client said "I have sent the contract back to you", it means the deal should be updated as "contracting status".

Is this correct under this domain or industry?

I am not sure what you mean by fake the sales tool, feel free to elaborate it thanks.

Because we do not have any Sales tool component like WhatsApp, the story must not be done by this PR.
So, fake it means "we assume we have WhatsApp, after we add HubSpot, could we fulfil this story?"

Copy link
Collaborator Author

@AmeliaCelline AmeliaCelline Jul 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe I missed some points. But, as I known, deal means the case that a sales is processing.
So, it means when a sales have a update with their clients in WhatsApp, the deal will be updated according to their message.

Yes, I think you are right. The update task does have its use case once more sales tool component is integrated. I think I can make "Update Ticket task" and "Update Deal task" as soon as I am done with WhatsApp "send message task". I believe once these 2 additional tasks are completed, the HubSpot design should be able to fulfill the story.

Note: Just wanted to let you know that unfortunately, the WhatsApp component will not have "receive message" task, as it can only be implemented through webhook.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chuang8511 Maybe it is better if I create a new PR specifically for those 2 update tasks? I think this PR is getting too big

Copy link
Contributor

@chuang8511 chuang8511 Jul 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Want to make sure if we lack these 2 tasks, can you build a demo pipeline like I mentioned in Slack?
If yes, I think you can do it in another PR.
If no, I think you need to do it with this PR.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the WhatsApp component will not have "receive message" task, as it can only be implemented through webhook.

Does it mean there is no API to fetch users' message in a Chatroom?

Copy link
Collaborator Author

@AmeliaCelline AmeliaCelline Jul 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Want to make sure if we lack these 2 tasks, can you build a demo pipeline like I mentioned in Slack?
If yes, I think you can do it in another PR.
If no, I think you need to do it with this PR.

Yes, I believe I can build a demo pipeline without those two tasks.

Does it mean there is no API to fetch users' message in a Chatroom?

From my understanding so far, the official WhatsApp Business Platform API cannot retrieve user messages in a chatroom. The only way to get the content of the message is when we receive the message notification sent to the webhook endpoint that we set up.

"TASK_GET_THREAD",
"TASK_RETRIEVE_ASSOCIATION"
],
"custom": false,
"documentationUrl": "https://www.instill.tech/docs/component/application/hubspot",
"icon": "assets/hubspot.svg",
"iconUrl": "",
AmeliaCelline marked this conversation as resolved.
Show resolved Hide resolved
"id": "hubspot",
"public": true,
"title": "HubSpot",
"description": "Use HubSpot application to do various tasks",
"tombstone": false,
"type": "COMPONENT_TYPE_APPLICATION",
"uid": "0cd80b30-29bc-4f19-91ca-5911de3a3aae",
"vendor": "HubSpot",
"vendorAttributes": {},
"version": "0.1.0",
"sourceUrl": "https://github.com/instill-ai/component/blob/main/application/hubspot/v0",
"releaseStage": "RELEASE_STAGE_ALPHA"
}
27 changes: 27 additions & 0 deletions application/hubspot/v0/config/setup.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"token": {
"description": "Fill in your HubSpot private app access token. Go here for more information: https://developers.hubspot.com/docs/api/private-apps",
"instillUpstreamTypes": [
"reference"
],
"instillAcceptFormats": [
"string"
],
"instillSecret": true,
"instillUIOrder": 0,
"title": "Token",
"type": "string"
}
},
"required": [
"token"
],
"instillEditOnNodeFields": [
"token"
],
"title": "Slack Connection",
"type": "object"
}
Loading