Skip to content

Commit

Permalink
Merge pull request #2180 from jupyter-naas/2179-hubspot-create-company
Browse files Browse the repository at this point in the history
feat: HubSpot - Create company
  • Loading branch information
FlorentLvr authored Sep 25, 2023
2 parents 6b5e4b4 + 45db0ff commit f720cc1
Show file tree
Hide file tree
Showing 4 changed files with 1,066 additions and 0 deletions.
277 changes: 277 additions & 0 deletions HubSpot/HubSpot_Create_company.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,277 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "b772e713-6a71-48e5-8b7c-a9280660420e",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
"<img width=\"10%\" alt=\"Naas\" src=\"https://landen.imgix.net/jtci2pxwjczr/assets/5ice39g4.png?w=160\"/>"
]
},
{
"cell_type": "markdown",
"id": "3fd8a8ca-257a-4cc3-9e03-253c5aecc714",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
"# HubSpot - Create company"
]
},
{
"cell_type": "markdown",
"id": "c64b5065-c0f4-4dc4-a121-74d2096b9820",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
"**Tags:** #hubspot #company #create #crm #business #management"
]
},
{
"cell_type": "markdown",
"id": "60064cb2-52d5-4e3e-903c-ecd67802f7ab",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
"**Author:** [Florent Ravenel](https://www.linkedin.com/in/florent-ravenel)"
]
},
{
"cell_type": "markdown",
"id": "b49aabbb-fda5-4ec3-9803-35750bbc072c",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
"**Last update:** 2023-09-25 (Created: 2023-09-25)"
]
},
{
"cell_type": "markdown",
"id": "cd8fa6b1-932e-4aaa-9b86-d23c88f7d3d8",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
"**Description:** This notebook will show how to create a company in HubSpot and how it is useful for organizations."
]
},
{
"cell_type": "markdown",
"id": "4d15d2e0-2150-48d9-a3fa-191fa1281045",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
"**References:**\n",
"- [HubSpot CRM API - Companies](https://developers.hubspot.com/docs/api/crm/companies)"
]
},
{
"cell_type": "markdown",
"id": "841c9cb1-770e-401a-85c7-650629ad4bba",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
"## Input"
]
},
{
"cell_type": "markdown",
"id": "30622949-e9f6-4a56-939f-f4081b2c1df0",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
"### Import libraries"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "497d7edf-1a3d-4f70-8bb0-0c841274820e",
"metadata": {
"papermill": {},
"tags": []
},
"outputs": [],
"source": [
"from naas_drivers import hubspot\n",
"import naas"
]
},
{
"cell_type": "markdown",
"id": "524ce4db-0aee-43bf-bf72-d5125edd5a08",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
"### Setup variables\n",
"**Mandatory**\n",
"\n",
"[Get your HubSpot Access token](https://knowledge.hubspot.com/articles/kcs_article/integrations/how-do-i-get-my-hubspot-api-key)\n",
"- `hs_access_token`: This variable stores an access token used for accessing the HubSpot API.\n",
"\n",
"**Optional**\n",
"- `properties`: This variable holds a dictionary that contains key-value pairs for creating a new company in HubSpot. You have the flexibility to include any custom properties, using their respective internal HubSpot names. To list company properties, you can use this template: \"HubSpot_List_company_properties.ipynb\" stored in https://github.com/jupyter-naas/awesome-notebooks."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "8735a84c-91eb-4c60-b427-53ad34fa3b02",
"metadata": {
"papermill": {},
"tags": []
},
"outputs": [],
"source": [
"hs_access_token = naas.secret.get(\"HS_ACCESS_TOKEN\") or \"YOUR_HS_ACCESS_TOKEN\"\n",
"properties = {\n",
" \"name\": \"HubSpot\", \n",
" \"domain\": \"hubspot.com\",\n",
" \"city\": \"Cambridge\",\n",
" \"phone\": \"555-555-555\",\n",
" \"state\": \"Massachusetts\",\n",
"}"
]
},
{
"cell_type": "markdown",
"id": "2dad33a7-3026-4e4e-a297-cfd51a40e90d",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
"## Model"
]
},
{
"cell_type": "markdown",
"id": "29afce7c-7211-4179-b35d-7485f03506bf",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
"### Create company"
]
},
{
"cell_type": "markdown",
"id": "ec344680-b35b-4e4d-8f9a-d7668f94c5fb",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
"This method will allow you to add any compnay properties available in your HubSpot."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "73929d4f-42ee-43c4-a3b8-f51a3e2ca108",
"metadata": {
"papermill": {},
"tags": []
},
"outputs": [],
"source": [
"hs_properties = {\"properties\": properties}\n",
"obj = hubspot.connect(hs_access_token).companies.send(hs_properties)"
]
},
{
"cell_type": "markdown",
"id": "e7234f74-eaf9-41c9-af6e-9306d9e1566d",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
"## Output"
]
},
{
"cell_type": "markdown",
"id": "c9944cfe-45d0-4207-a8ea-dfc61f63d4bb",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
"### Display result"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "6bc1eace-ab86-4bd5-8eee-7cbaadaf3d52",
"metadata": {
"papermill": {},
"tags": []
},
"outputs": [],
"source": [
"obj"
]
},
{
"cell_type": "markdown",
"id": "7fb84e3c-64d2-4198-93b9-22e0805ba311",
"metadata": {
"papermill": {},
"tags": []
},
"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"
},
"widgets": {
"application/vnd.jupyter.widget-state+json": {
"state": {},
"version_major": 2,
"version_minor": 0
}
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Loading

0 comments on commit f720cc1

Please sign in to comment.