Links

Delete note

Tags: #hubspot #sales #crm #engagements #note #snippet #delete
Author: Florent Ravenel
Last update: 2023-08-29 (Created: 2023-08-29)
Description: This notebook demonstrates how to delete a note using its ID using HubSpot API.
References:

Input

Import libraries

import requests
import naas

Setup variables

  • hs_access_token: This variable stores an access token used for accessing the HubSpot API.
  • object_id: This variable stores the object ID.
hs_access_token = naas.secret.get("HS_ACCESS_TOKEN") or "YOUR_HS_ACCESS_TOKEN"
object_id = 39230793063

Model

Delete note

def delete_note(
token,
object_id
):
# Requests
headers = {
"Content-Type": "application/json",
"Authorization": f"Bearer {token}"
}
url = f"https://api.hubapi.com/crm/v3/objects/notes/{object_id}"
# Response
res = requests.delete(url, headers=headers)
if res.status_code == 204:
print(f"Note '{object_id}' successfully deleted!")
else:
print(res.text)
return res
res = delete_note(hs_access_token, object_id)

Output

Delete note

res