Skip to content

Commit

Permalink
feat(hubspot-user-operations): [nan-1860] hubspot user operations (#34)
Browse files Browse the repository at this point in the history
## Describe your changes
Add hubspot user operations
- create user
- delete user
- fetch roles
- change user role

## Issue ticket number and link
NAN-1860

## Checklist before requesting a review (skip if just adding/editing
APIs & templates)
- [x] I added tests, otherwise the reason is:
- [x] External API requests have `retries`
- [x] Pagination is used where appropriate
- [ ] The built in `nango.paginate` call is used instead of a `while
(true)` loop
- [ ] Third party requests are NOT parallelized (this can cause issues
with rate limits)
- [ ] If a sync requires metadata the `nango.yaml` has `auto_start:
false`
- [ ] If the sync is a `full` sync then `track_deletes: true` is set
  • Loading branch information
khaliqgant authored Oct 4, 2024
1 parent 75a16da commit 01dbf64
Show file tree
Hide file tree
Showing 93 changed files with 2,403 additions and 1,610 deletions.
30 changes: 24 additions & 6 deletions .github/workflows/push-flows-to-nango-repo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,34 @@ jobs:
echo "Contents of nango directory after copying flows.yaml:"
ls nango/
- name: Get PR Details
if: github.event_name == 'pull_request'
id: pr_details
run: |
# Extract the PR URL and description from the event payload
PR_URL=${{ github.event.pull_request.html_url }}
PR_BODY=${{ github.event.pull_request.body }}
# Write the PR URL and description to the GITHUB_OUTPUT environment file
echo "pr_url=$PR_URL" >> $GITHUB_OUTPUT
echo "pr_body=$PR_BODY" >> $GITHUB_OUTPUT
- name: Make changes and commit
if: steps.changes.outputs.any_changed == 'true'
working-directory: nango
run: |
echo "Configuring Git and committing changes..."
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "GitHub Actions Bot"
git add packages/shared/flows.yaml
git commit -m "chore(integration-templates): Automated commit updating flows.yaml from the integration-templates repo"
echo "Changes committed."
echo "Configuring Git and committing changes..."
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "GitHub Actions Bot"
# Add the changes
git add packages/shared/flows.yaml
# Commit with a message that includes the PR link and description
git commit -m "chore(integration-templates): Automated commit updating flows.yaml from the integration-templates ${{ steps.pr_details.outputs.pr_url }}
Description: ${{ steps.pr_details.outputs.pr_body }}"

echo "Changes committed."

- name: Push changes to target repo
if: steps.changes.outputs.any_changed == 'true'
Expand Down
94 changes: 89 additions & 5 deletions flows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2360,9 +2360,13 @@ integrations:
runs: every day
description: |
Fetches a list of users from Hubspot
output: HubspotUser
output: User
sync_type: full
endpoint: GET /users
version: 1.0.1
scopes:
- settings.users.read (standard scope)
- crm.objects.users.read (granular scope)
knowledge-base:
runs: every day
description: |
Expand All @@ -2383,7 +2387,42 @@ integrations:
input: CreateDeal
scopes:
- crm.objects.deals.write
create-user:
description: Creates a user in Hubspot
output: CreatedUser
endpoint: POST /users
input: CreateUser
scopes:
- settings.users.write (standard scope)
- crm.objects.users.write (granular)
delete-user:
description: Creates a user in Hubspot
endpoint: DELETE /users
output: SuccessResponse
input: IdEntity
scopes:
- settings.users.write (standard scope)
- crm.objects.users.write (granular)
fetch-roles:
description: Fetch the roles on an account
output: RoleResponse
endpoint: GET /roles
scopes:
- settings.users.read (standard scope)
- crm.objects.users.read (granular scope)
change-user-role:
description: Change a user role
input: UserRoleInput
output: ChangedRoleResponse
endpoint: PUT /roles
scopes:
- settings.users.write (standard scope)
- crm.objects.users.write (granular scope)
models:
IdEntity:
id: string
SuccessResponse:
success: boolean
InputProperty:
name: string
PropertyResponse:
Expand Down Expand Up @@ -2416,6 +2455,31 @@ integrations:
value: string
displayOrder: number
hidden: boolean
RoleResponse:
results: Role[]
Role:
requiresBillingWrite: boolean
name: string
id: string
UserRoleInput:
id: string
firstName?: string
lastName?: string
primaryTeamId?: string
ChangedRoleResponse:
id: string
firstName: string
lastName: string
primaryTeamId?: string
email: string
sendWelcomeEmail: boolean
roleIds: string[]
secondaryTeamIds: string[]
superAdmin: boolean
firstName?: string
lastName?: string
sendWelcomeEmail?: boolean
secondaryTeamIds?: string[]
HubspotServiceTicket:
id: integer
createdAt: date
Expand All @@ -2438,11 +2502,31 @@ integrations:
createdAt: date
updatedAt: date
archived: boolean
HubspotUser:
id: integer
User:
id: string
email: string
firstName: string
lastName: string
roleIds: string[]
primaryTeamId?: string | undefined
superAdmin: boolean
CreateUser:
firstName?: string
lastName?: string
primaryTeamId?: string
email: string
sendWelcomeEmail?: boolean
roleId?: string
secondaryTeamIds?: string[]
CreatedUser:
id: string
firstName: string
lastName: string
primaryTeamId?: string
email: string
roleId: integer
primaryTeamId: integer
sendWelcomeEmail: boolean
roleIds: string[]
secondaryTeamIds: string[]
superAdmin: boolean
HubspotKnowledgeBase:
id: string
Expand Down
4 changes: 2 additions & 2 deletions integrations/calendly/mocks/events/Event/batchDelete.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"buffered_end_time": "2023-06-01T18:30:00.000000Z",
"buffered_start_time": "2023-06-01T18:00:00.000000Z",
"user": "https://api.calendly.com/users/111",
"user_email": "myname@nango.dev",
"user_email": "myname@foo.com",
"user_name": "MockName LastName"
}
],
Expand Down Expand Up @@ -61,7 +61,7 @@
"buffered_end_time": "2023-07-25T11:30:00.000000Z",
"buffered_start_time": "2023-07-25T11:00:00.000000Z",
"user": "https://api.calendly.com/users/111",
"user_email": "myname@nango.dev",
"user_email": "myname@foo.com",
"user_name": "MockName LastName"
}
],
Expand Down
8 changes: 4 additions & 4 deletions integrations/calendly/mocks/events/Event/batchSave.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"buffered_end_time": "2023-05-25T18:30:00.000000Z",
"buffered_start_time": "2023-05-25T18:00:00.000000Z",
"user": "https://api.calendly.com/users/111",
"user_email": "myname@nango.dev",
"user_email": "myname@foo.com",
"user_name": "MockName LastName"
}
],
Expand Down Expand Up @@ -49,7 +49,7 @@
"buffered_end_time": "2023-06-12T18:00:00.000000Z",
"buffered_start_time": "2023-06-12T17:30:00.000000Z",
"user": "https://api.calendly.com/users/111",
"user_email": "myname@nango.dev",
"user_email": "myname@foo.com",
"user_name": "MockName LastName"
}
],
Expand Down Expand Up @@ -97,7 +97,7 @@
"buffered_end_time": "2023-07-27T12:00:00.000000Z",
"buffered_start_time": "2023-07-27T11:30:00.000000Z",
"user": "https://api.calendly.com/users/111",
"user_email": "myname@nango.dev",
"user_email": "myname@foo.com",
"user_name": "MockName LastName"
}
],
Expand Down Expand Up @@ -134,7 +134,7 @@
"buffered_end_time": "2023-08-03T18:00:00.000000Z",
"buffered_start_time": "2023-08-03T17:30:00.000000Z",
"user": "https://api.calendly.com/users/111",
"user_email": "myname@nango.dev",
"user_email": "myname@foo.com",
"user_name": "MockName LastName"
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"buffered_end_time": "2023-05-25T18:30:00.000000Z",
"buffered_start_time": "2023-05-25T18:00:00.000000Z",
"user": "https://api.calendly.com/users/111",
"user_email": "myname@nango.dev",
"user_email": "myname@foo.com",
"user_name": "MockName LastName"
}
],
Expand Down Expand Up @@ -55,7 +55,7 @@
"buffered_end_time": "2023-06-01T18:30:00.000000Z",
"buffered_start_time": "2023-06-01T18:00:00.000000Z",
"user": "https://api.calendly.com/users/111",
"user_email": "myname@nango.dev",
"user_email": "myname@foo.com",
"user_name": "MockName LastName"
}
],
Expand Down Expand Up @@ -91,7 +91,7 @@
"buffered_end_time": "2023-06-12T18:00:00.000000Z",
"buffered_start_time": "2023-06-12T17:30:00.000000Z",
"user": "https://api.calendly.com/users/111",
"user_email": "myname@nango.dev",
"user_email": "myname@foo.com",
"user_name": "MockName LastName"
}
],
Expand Down Expand Up @@ -133,7 +133,7 @@
"buffered_end_time": "2023-07-25T11:30:00.000000Z",
"buffered_start_time": "2023-07-25T11:00:00.000000Z",
"user": "https://api.calendly.com/users/111",
"user_email": "myname@nango.dev",
"user_email": "myname@foo.com",
"user_name": "MockName LastName"
}
],
Expand Down Expand Up @@ -180,7 +180,7 @@
"buffered_end_time": "2023-07-27T12:00:00.000000Z",
"buffered_start_time": "2023-07-27T11:30:00.000000Z",
"user": "https://api.calendly.com/users/111",
"user_email": "myname@nango.dev",
"user_email": "myname@foo.com",
"user_name": "MockName LastName"
}
],
Expand Down Expand Up @@ -216,7 +216,7 @@
"buffered_end_time": "2023-08-03T18:00:00.000000Z",
"buffered_start_time": "2023-08-03T17:30:00.000000Z",
"user": "https://api.calendly.com/users/111",
"user_email": "myname@nango.dev",
"user_email": "myname@foo.com",
"user_name": "MockName LastName"
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"buffered_end_time": "2023-05-25T18:30:00.000000Z",
"buffered_start_time": "2023-05-25T18:00:00.000000Z",
"user": "https://api.calendly.com/users/111",
"user_email": "myname@nango.dev",
"user_email": "myname@foo.com",
"user_name": "MockName LastName"
}
],
Expand Down Expand Up @@ -55,7 +55,7 @@
"buffered_end_time": "2023-06-01T18:30:00.000000Z",
"buffered_start_time": "2023-06-01T18:00:00.000000Z",
"user": "https://api.calendly.com/users/111",
"user_email": "myname@nango.dev",
"user_email": "myname@foo.com",
"user_name": "MockName LastName"
}
],
Expand Down Expand Up @@ -91,7 +91,7 @@
"buffered_end_time": "2023-06-12T18:00:00.000000Z",
"buffered_start_time": "2023-06-12T17:30:00.000000Z",
"user": "https://api.calendly.com/users/111",
"user_email": "myname@nango.dev",
"user_email": "myname@foo.com",
"user_name": "MockName LastName"
}
],
Expand Down Expand Up @@ -133,7 +133,7 @@
"buffered_end_time": "2023-07-25T11:30:00.000000Z",
"buffered_start_time": "2023-07-25T11:00:00.000000Z",
"user": "https://api.calendly.com/users/111",
"user_email": "myname@nango.dev",
"user_email": "myname@foo.com",
"user_name": "MockName LastName"
}
],
Expand Down Expand Up @@ -180,7 +180,7 @@
"buffered_end_time": "2023-07-27T12:00:00.000000Z",
"buffered_start_time": "2023-07-27T11:30:00.000000Z",
"user": "https://api.calendly.com/users/111",
"user_email": "myname@nango.dev",
"user_email": "myname@foo.com",
"user_name": "MockName LastName"
}
],
Expand Down Expand Up @@ -216,7 +216,7 @@
"buffered_end_time": "2023-08-03T18:00:00.000000Z",
"buffered_start_time": "2023-08-03T17:30:00.000000Z",
"user": "https://api.calendly.com/users/111",
"user_email": "myname@nango.dev",
"user_email": "myname@foo.com",
"user_name": "MockName LastName"
}
],
Expand Down
Loading

0 comments on commit 01dbf64

Please sign in to comment.