forked from activepieces/activepieces
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request activepieces#6377 from kishanprmr/hubspot
feat(hubspot): 18 triggers and 38 actions
- Loading branch information
Showing
83 changed files
with
7,563 additions
and
2,060 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"name": "@activepieces/piece-hubspot", | ||
"version": "0.5.8" | ||
"version": "0.6.0" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 28 additions & 27 deletions
55
packages/pieces/community/hubspot/src/lib/actions/add-contact-to-list-action.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,36 @@ | ||
import { hubSpotListIdDropdown } from '../common/props'; | ||
import { hubSpotClient } from '../common/client'; | ||
import { staticListsDropdown } from '../common/props'; | ||
import { createAction, Property } from '@activepieces/pieces-framework'; | ||
import { assertNotNullOrUndefined } from '@activepieces/shared'; | ||
import { hubspotAuth } from '../../'; | ||
import { AuthenticationType, httpClient, HttpMethod } from '@activepieces/pieces-common'; | ||
|
||
export const hubSpotListsAddContactAction = createAction({ | ||
auth: hubspotAuth, | ||
name: 'add_contact_to_list', | ||
displayName: 'Add contact To List', | ||
description: 'Add contact to list', | ||
props: { | ||
listId: hubSpotListIdDropdown, | ||
email: Property.ShortText({ | ||
displayName: 'Email', | ||
description: 'Contact email', | ||
required: true, | ||
}), | ||
}, | ||
auth: hubspotAuth, | ||
name: 'add_contact_to_list', | ||
displayName: 'Add contact To List', | ||
description: 'Add contact to list', | ||
props: { | ||
listId: staticListsDropdown, | ||
email: Property.ShortText({ | ||
displayName: 'Contact Email', | ||
required: true, | ||
}), | ||
}, | ||
|
||
async run(context) { | ||
const token = context.auth.access_token; | ||
const { listId, email } = context.propsValue; | ||
async run(context) { | ||
const { listId, email } = context.propsValue; | ||
|
||
assertNotNullOrUndefined(token, 'token'); | ||
assertNotNullOrUndefined(listId, 'list'); | ||
assertNotNullOrUndefined(email, 'email'); | ||
const response = await httpClient.sendRequest({ | ||
method: HttpMethod.POST, | ||
url: `https://api.hubapi.com/contacts/v1/lists/${listId}/add`, | ||
body: { | ||
emails: [email], | ||
}, | ||
authentication: { | ||
type: AuthenticationType.BEARER_TOKEN, | ||
token: context.auth.access_token, | ||
}, | ||
}) | ||
|
||
return await hubSpotClient.lists.addContact({ | ||
token, | ||
listId, | ||
email, | ||
}); | ||
}, | ||
return response.body; | ||
}, | ||
}); |
Oops, something went wrong.