Skip to content

Commit

Permalink
feat: create, retrive, update, delete a company from hubspot templates
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorentLvr committed Sep 25, 2023
1 parent ff62be6 commit 6fe030a
Showing 1 changed file with 265 additions and 0 deletions.
265 changes: 265 additions & 0 deletions HubSpot/HubSpot_Get_company.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,265 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "african-pavilion",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
"<img width=\"10%\" alt=\"Naas\" src=\"https://landen.imgix.net/jtci2pxwjczr/assets/5ice39g4.png?w=160\"/>"
]
},
{
"cell_type": "markdown",
"id": "frequent-pittsburgh",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
"# HubSpot - Get a company\n",
"<a href=\"https://app.naas.ai/user-redirect/naas/downloader?url=https://raw.githubusercontent.com/jupyter-naas/awesome-notebooks/master/HubSpot/HubSpot_Update_contact_using_custom_properties.ipynb\" target=\"_parent\"><img src=\"https://naasai-public.s3.eu-west-3.amazonaws.com/Open_in_Naas_Lab.svg\"/></a><br><br><a href=\"https://bit.ly/3JyWIk6\">Give Feedback</a> | <a href=\"https://github.com/jupyter-naas/awesome-notebooks/issues/new?assignees=&labels=bug&template=bug_report.md&title=HubSpot+-+Update+contact+using+custom+properties:+Error+short+description\">Bug report</a>"
]
},
{
"cell_type": "markdown",
"id": "genuine-poland",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
"**Tags:** #hubspot #crm #sales #company #naas_drivers #snippet #get"
]
},
{
"cell_type": "markdown",
"id": "1ca9ae0b-0121-49dd-ab85-246f17d69448",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
"**Author:** [Florent Ravenel](https://www.linkedin.com/in/florent-ravenel/)"
]
},
{
"cell_type": "markdown",
"id": "19d62035-3dc4-435d-b968-b773157ca7aa",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
"**Last update:** 2023-09-25 (Created: 2023-09-25)"
]
},
{
"cell_type": "markdown",
"id": "naas-description",
"metadata": {
"papermill": {},
"tags": [
"description"
]
},
"source": [
"**Description:** This notebook demonstrates how to get a given company in using its hubspot ID."
]
},
{
"cell_type": "markdown",
"id": "0674efd4-cc2f-4795-aa85-f2f0461a5ed1",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
"**References:**\n",
"- [HubSpot CRM API - Companies](https://developers.hubspot.com/docs/api/crm/companies)"
]
},
{
"cell_type": "markdown",
"id": "decreased-discovery",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
"## Input"
]
},
{
"cell_type": "markdown",
"id": "outer-mechanism",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
"### Import libraries"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "obvious-surgery",
"metadata": {
"papermill": {},
"tags": []
},
"outputs": [],
"source": [
"from naas_drivers import hubspot\n",
"import naas"
]
},
{
"cell_type": "markdown",
"id": "bcf071a5-f2a8-4952-803b-d1abce07ca7d",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
"### Setup variables\n",
"**Mandatory**\n",
"- `hs_access_token`: This variable stores an access token used for accessing the HubSpot API. [Get your HubSpot Access token](https://knowledge.hubspot.com/articles/kcs_article/integrations/how-do-i-get-my-hubspot-api-key)\n",
"- `hubspot_id`: This variable stores the HubSpot company ID\n",
"\n",
"**Optional**\n",
"- `properties`: List of properties (hubspot internal names) you want to get from a company. By default, you will get: name, domain, createdate, lastmodifieddate, hs_object_id. To list of contact properties, you can use this template: \"HubSpot/HubSpot_List_contact_properties.ipynb\" stored in https://github.com/jupyter-naas/awesome-notebooks"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "5a2f148d-7443-4ba0-9c3d-261a67003423",
"metadata": {
"papermill": {},
"tags": []
},
"outputs": [],
"source": [
"# Mandatory\n",
"hs_access_token = naas.secret.get(\"HS_ACCESS_TOKEN\") or \"YOUR_HS_ACCESS_TOKEN\"\n",
"hubspot_id = \"179121906\"\n",
"\n",
"# Optional\n",
"properties = []"
]
},
{
"cell_type": "markdown",
"id": "minor-white",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
"## Model"
]
},
{
"cell_type": "markdown",
"id": "fiscal-directive",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
"### Get a company"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "phantom-people",
"metadata": {
"papermill": {},
"tags": []
},
"outputs": [],
"source": [
"obj = hubspot.connect(hs_access_token).companies.get(hubspot_id, properties)"
]
},
{
"cell_type": "markdown",
"id": "compressed-target",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
"## Output"
]
},
{
"cell_type": "markdown",
"id": "4d39601c-e21c-4a3f-a0a4-f60b9354d490",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
"### Display result"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "38410b82-6f46-48d4-8cd1-533f5a83f7fc",
"metadata": {
"papermill": {},
"tags": []
},
"outputs": [],
"source": [
"obj"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "9f31c2d2-ee78-48b2-bc80-b3c10f74da16",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.6"
},
"naas": {
"notebook_id": "1a66fd4eb09d5f34d95b8451ca85989c9743a9060a6540d11d2c19a559a516bb",
"notebook_path": "HubSpot/HubSpot_Update_contact_using_custom_properties.ipynb"
},
"papermill": {
"default_parameters": {},
"environment_variables": {},
"parameters": {},
"version": "2.3.3"
}
},
"nbformat": 4,
"nbformat_minor": 5
}

0 comments on commit 6fe030a

Please sign in to comment.