# HubSpot
HubSpot is a CRM system. The internal Hubspot integration provides API access to built-in operations that you can execute between RELE.AI and Hubspot.
The purpose of the integration is to allow the user to retrieve or save information in a HubSpot account.
# Find Objects
Attribute: find_objects
Finds a Hubspot object within a hubspot account.
The function searches for hubspot object in hubspot according to each of the parameters provided under the above fields:
email
phone
firstname
lastname
query
NOTE
query is a free search key, which searches by all the properties that hubspot allows you to search for.
In addition, the function gets another object called findBy
.
Each key under findBy
defines the type of objects we want to retrieve from hubspot. We currently support contacts / deals / companies.
Under each such object, we can define exactly what fields we want to retrieve, and whether our search will be based on these fields.
That is, any key defined under an object type can contain two parameters: searchBy
, and location
.
searchBy
defines whether the search filter will execute according to this field (if the value is set to false, the field will be retrieved, but the search filter will not execute by this field).
location
defines the position of the field in the array of results that will be returned from the endpoint. Can be in the range of 1 - max_int.
# find_objects is opeartion thats searches object on hubspot.
type: Operation
# define the pointers to the
# internal app & app action
selector:
app: hubspot
app_action: find_objects
# define the find_objects payload
payload:
# query is a free value by which the search will be performed.
query:
data: crm_contact:message_data:message:body
rkey_type: hash_map
type: redis
# define the find by object
findBy:
data:
contacts:
firstname:
searchBy: true
location: 1
lastname:
searchBy: true
location: 2
companies:
name:
searchBy: true
type: raw
# redis-key that will hold the response
# from find_objects
redis:
field: crm_contact_info
type: hash_map
NOTE
Assume we want to send data under query attribute, saved under redis, from text that came from whatsapp.
In this case, the structure will always be fixed.
Each response from whatsapp is built in the structure:
message_data:message:body
Suppose redis is defined in the operation that received the message from whatsapp under the field crm_contact
, so to retrieve the value in our opeartion, we will turn to:
crm_contact:message_data:message:body
# Create Contact
Attribute: create_contact
Create a Contact within a hubspot account.
The function create a contact in hubspot according to each of the parameters provided under the above fields:
email
phone
firstname
lastname
# create_contact is opeartion thats creates contact on hubspot.
type: Operation
# define the pointers to the
# internal app & app action
selector:
app: hubspot
app_action: create_contact
# define the create_contact payload
payload:
# contact phone proprety
phone:
data: check_contact_info:phone
rkey_type: hash_map
type: redis
# contact firstname proprety
firstname:
data: check_contact_info:firstname
rkey_type: hash_map
type: redis
# contact lastname proprety
lastname:
data: check_contact_info:lastname
rkey_type: hash_map
type: redis
# contact email proprety
email:
data: check_contact_info:email
rkey_type: hash_map
type: redis
# redis-key that will hold the response
# from create_contact
redis:
field: contact_response
type: hash_map
# Get Contact Information
Attribute: get_contact_info
Get contact info takes a hubspot's contact id, and pulls the following information about it:
It returns the contact
itself, the company
to which it associated (if exsits), the open deals that associated to the contact
(if exsits), and the open deals that associated to the company
(if exsits).
# get_contact_info is opeartion thats
# pulls info about contact from hubspot.
type: Operation
# define the pointers to the
# internal app & app action
selector:
app: hubspot
app_action: get_contact_info
# define the get_contact_info payload
payload:
# hubspot's contact id
id:
data: crm_contact_info:contacts:0:vid
rkey_type: hash_map
type: redis
# redis-key that will hold the response
# from get_contact_info
redis:
field: get_contact_info_response
type: hash_map
# Get Company Information
Attribute: get_company_info
Get company info takes a hubspot's company id, and pulls the following information about it:
It returns the company
itself and the open deals that associated to the company
(if exsits).
# get_company_info is opeartion thats
# pulls info about company from hubspot.
type: Operation
# define the pointers to the
# internal app & app action
selector:
app: hubspot
app_action: get_company_info
# define the get_company_info payload
payload:
# hubspot's company id
id:
data: crm_contact_info:companies:0:vid
rkey_type: hash_map
type: redis
# redis-key that will hold the response
# from get_company_info
redis:
field: get_company_info_response
type: hash_map
# Record Note
Attribute: record_note
Record Note creates a note in a hubspot and attaches it to an object in a hubspot
Record Note Gets an id
of an object in a hubspot, the type
of the object (can be one of contacts / compaies / deals), and an array of base64 messages/files to record as a body
.
# record_note is opeartion thats
# create note in hubspot.
type: Operation
# define the pointers to the
# internal app & app action
selector:
app: hubspot
app_action: record_note
# define the record_note payload
payload:
# hubspot's contact id
id:
data: get_contact_info:objects:0:vid
rkey_type: hash_map
type: redis
# type of the object
type:
data: get_contact_info:types:0
type: redis
rkey_type: hash_map
# array of base64 messages/files
body:
data: messages:messages:messages_b64
type: redis
rkey_type: hash_map
# redis-key that will hold the response
# from record_note
redis:
field: record_write_result
type: hash_map
# Search Objects
Attribute: search_objects
Search objects Searches for objects in a hubspot by query.
The function gets a query that defines the search key-word, and an array of search_by that defines which objects in the hubspot the search should be performed.
search_by is an array of objects, each object defining the type of object in the hubspot that should be searched for, what properties to search by, and what properties we want to retrieve in the answer.
Each object in the array includes some attributes:
type
: Defines the hubspot's object type that you want to search for.
generalProperties
: Defines the properties you want to pull in your response, if there is a match.
searchByProperties
: Defines the properties by which the search will be performed.
# search_objects is opeartion thats
# search for objects in hubspot.
type: Operation
# define the pointers to the
# internal app & app action
selector:
app: hubspot
app_action: search_objects
# define the search_objects payload
payload:
# hubspot's search query
query:
data: get_user_search:message_data:message:body
rkey_type: hash_map
type: redis
# type of the object
searchBy:
type: raw
data:
- type: contacts
generalProperties:
- prefix: "First Name:"
propertyName: firstname
- prefix: "Last Name:"
propertyName: lastname
- type: companies
generalProperties:
- prefix: "Amount of open deals:"
propertyName: open_deals_amount
searchByProperties:
- name
# redis-key that will hold the response
# from search_objects
redis:
field: get_service_search
type: hash_map
NOTE
When searching by type of contacts, there is no need to provide searchByProperties
because hubspot automatically searches for all fields defined as searchable.
# Check Missing Fields
Attribute: check_missing_fields
Check Missing Fields receives 4 parameters of email
, phone
, firstname
and lastname
, and returns the parameters that do not yet have values.
You will usually use this operation when we want to create a new contact, and we will want to make sure what parameters are missing to create the contact in hubspot.
# check_missing_fields is opeartion thats
# create note in hubspot.
type: Operation
# define the pointers to the
# internal app & app action
selector:
app: hubspot
app_action: check_missing_fields
# define the check_missing_fields payload
payload:
# contact phone proprety
phone:
data: check_contact_info:phone
rkey_type: hash_map
type: redis
# contact firstname proprety
firstname:
data: check_contact_info:firstname
rkey_type: hash_map
type: redis
# contact lastname proprety
lastname:
data: check_contact_info:lastname
rkey_type: hash_map
type: redis
# contact email proprety
email:
data: check_contact_info:email
rkey_type: hash_map
type: redis
# redis-key that will hold the response
# from check_missing_fields
redis:
field: check_missing_response
type: hash_map
← WhatsApp Salesforce →