Skip to main content

Actions

The ballerinax/hubspot.crm.obj.feedback package exposes the following clients:

ClientPurpose
ClientProvides full access to HubSpot Feedback Submissions: list, read, search, create, update, upsert, and archive individual and batch records.

Client

Provides full access to HubSpot Feedback Submissions: list, read, search, create, update, upsert, and archive individual and batch records.

Configuration

FieldTypeDefaultDescription
authhttp:BearerTokenConfig|OAuth2RefreshTokenGrantConfig|ApiKeysConfigRequiredAuthentication configuration. Use OAuth2RefreshTokenGrantConfig for OAuth 2.0, http:BearerTokenConfig for a bearer token, or ApiKeysConfig for private app tokens.
httpVersionhttp:HttpVersionHTTP_2_0HTTP protocol version to use.
timeoutdecimal30Request timeout in seconds.
retryConfighttp:RetryConfig()Retry configuration for failed requests.
secureSockethttp:ClientSecureSocket()SSL/TLS configuration.
proxyhttp:ProxyConfig()Proxy server configuration.
validationbooleantrueEnable constraint validation on request/response payloads.

Initializing the client

import ballerinax/hubspot.crm.obj.feedback as hsfeedback;

configurable string clientId = ?;
configurable string clientSecret = ?;
configurable string refreshToken = ?;

hsfeedback:Client feedbackClient = check new ({
auth: {
clientId: clientId,
clientSecret: clientSecret,
refreshToken: refreshToken
}
});

Operations

Single object operations

List feedback submissions

Returns a paginated list of feedback submissions. Use query parameters to filter by archived status, select specific properties, and control page size.

Parameters:

NameTypeRequiredDescription
'limitintNoMaximum number of results to return per page. Defaults to 10.
afterstringNoCursor token for the next page of results, obtained from a previous response's paging.next.after.
propertiesstring[]NoComma-separated list of property names to include in the response.
propertiesWithHistorystring[]NoList of properties for which to include historical values.
associationsstring[]NoList of object types to retrieve associated IDs for.
archivedbooleanNoWhether to include archived submissions. Defaults to false.

Returns: CollectionResponseSimplePublicObjectWithAssociationsForwardPaging|error

Sample code:

hsfeedback:CollectionResponseSimplePublicObjectWithAssociationsForwardPaging response =
check feedbackClient->/.get('limit = 5, properties = ["hs_survey_channel", "hs_response_text"]);

Sample response:

{
"results": [
{
"id": "392813793683",
"properties": {
"hs_createdate": "2024-01-15T10:30:00.000Z",
"hs_lastmodifieddate": "2024-01-15T10:30:00.000Z",
"hs_object_id": "392813793683",
"hs_survey_channel": "EMAIL",
"hs_response_text": "Great service, very responsive team!"
},
"createdAt": "2024-01-15T10:30:00.000Z",
"updatedAt": "2024-01-15T10:30:00.000Z",
"archived": false
}
],
"paging": {
"next": {
"after": "392813793700",
"link": "https://api.hubapi.com/crm/v3/objects/feedback_submissions?after=392813793700"
}
}
}
Read a feedback submission

Retrieves a single feedback submission by its HubSpot record ID or a unique property value.

Parameters:

NameTypeRequiredDescription
feedbackSubmissionIdstringYesThe unique identifier of the feedback submission.
propertiesstring[]NoList of property names to include in the response.
propertiesWithHistorystring[]NoList of properties for which to return historical values.
associationsstring[]NoList of associated object types to retrieve IDs for.
idPropertystringNoThe name of a unique property to use instead of the HubSpot internal ID.
archivedbooleanNoWhether to return archived submissions. Defaults to false.

Returns: SimplePublicObjectWithAssociations|error

Sample code:

hsfeedback:SimplePublicObjectWithAssociations submission =
check feedbackClient->/["392813793683"].get(
properties = ["hs_survey_channel", "hs_response_text", "hs_survey_type"]
);

Sample response:

{
"id": "392813793683",
"properties": {
"hs_createdate": "2024-01-15T10:30:00.000Z",
"hs_lastmodifieddate": "2024-01-15T10:30:00.000Z",
"hs_object_id": "392813793683",
"hs_survey_channel": "EMAIL",
"hs_response_text": "Great service, very responsive team!",
"hs_survey_type": "NPS"
},
"createdAt": "2024-01-15T10:30:00.000Z",
"updatedAt": "2024-01-15T10:30:00.000Z",
"archived": false,
"associations": {}
}
Create a feedback submission

Creates a new feedback submission record in HubSpot CRM.

Parameters:

NameTypeRequiredDescription
payloadSimplePublicObjectInputForCreateYesThe feedback submission properties and optional associations to create.

Returns: SimplePublicObject|error

Sample code:

hsfeedback:SimplePublicObject created = check feedbackClient->/.post({
properties: {
"hs_survey_channel": "EMAIL",
"hs_response_text": "Excellent support experience!",
"hs_survey_type": "CES"
},
associations: []
});

Sample response:

{
"id": "392813799001",
"properties": {
"hs_createdate": "2024-03-18T08:00:00.000Z",
"hs_lastmodifieddate": "2024-03-18T08:00:00.000Z",
"hs_object_id": "392813799001",
"hs_survey_channel": "EMAIL",
"hs_response_text": "Excellent support experience!",
"hs_survey_type": "CES"
},
"createdAt": "2024-03-18T08:00:00.000Z",
"updatedAt": "2024-03-18T08:00:00.000Z",
"archived": false
}
Update a feedback submission

Performs a partial update on a feedback submission, modifying only the specified properties.

Parameters:

NameTypeRequiredDescription
feedbackSubmissionIdstringYesThe unique identifier of the feedback submission to update.
payloadSimplePublicObjectInputYesAn object containing the properties to update.
idPropertystringNoThe name of a unique property to use as the identifier instead of the HubSpot ID.

Returns: SimplePublicObject|error

Sample code:

hsfeedback:SimplePublicObject updated = check feedbackClient->/["392813793683"].patch({
properties: {
"hs_response_text": "Updated: Outstanding support!"
}
});

Sample response:

{
"id": "392813793683",
"properties": {
"hs_createdate": "2024-01-15T10:30:00.000Z",
"hs_lastmodifieddate": "2024-03-18T09:15:00.000Z",
"hs_object_id": "392813793683",
"hs_survey_channel": "EMAIL",
"hs_response_text": "Updated: Outstanding support!"
},
"createdAt": "2024-01-15T10:30:00.000Z",
"updatedAt": "2024-03-18T09:15:00.000Z",
"archived": false
}
Archive a feedback submission

Archives (soft-deletes) a feedback submission by its ID. Archived submissions can be retrieved by setting archived=true in list or read requests.

Parameters:

NameTypeRequiredDescription
feedbackSubmissionIdstringYesThe unique identifier of the feedback submission to archive.

Returns: error?

Sample code:

check feedbackClient->/["392813793683"].delete();

Batch operations

Read a batch of feedback submissions

Retrieves multiple feedback submissions by a list of internal IDs or unique property values in a single request.

Parameters:

NameTypeRequiredDescription
payloadBatchReadInputSimplePublicObjectIdYesAn object containing the list of IDs, the properties to return, and optional propertiesWithHistory.
archivedbooleanNoWhether to include archived submissions. Defaults to false.

Returns: BatchResponseSimplePublicObject|BatchResponseSimplePublicObjectWithErrors|error

Sample code:

hsfeedback:BatchResponseSimplePublicObject|hsfeedback:BatchResponseSimplePublicObjectWithErrors batchResult =
check feedbackClient->/batch/read.post({
inputs: [
{id: "392813793683"},
{id: "392813793700"}
],
properties: ["hs_survey_channel", "hs_response_text"],
propertiesWithHistory: []
});

Sample response:

{
"status": "COMPLETE",
"results": [
{
"id": "392813793683",
"properties": {
"hs_object_id": "392813793683",
"hs_survey_channel": "EMAIL",
"hs_response_text": "Great service, very responsive team!"
},
"createdAt": "2024-01-15T10:30:00.000Z",
"updatedAt": "2024-01-15T10:30:00.000Z",
"archived": false
},
{
"id": "392813793700",
"properties": {
"hs_object_id": "392813793700",
"hs_survey_channel": "CHAT",
"hs_response_text": "Quick resolution, very happy!"
},
"createdAt": "2024-01-16T14:00:00.000Z",
"updatedAt": "2024-01-16T14:00:00.000Z",
"archived": false
}
],
"startedAt": "2024-03-18T09:00:00.000Z",
"completedAt": "2024-03-18T09:00:00.050Z"
}
Create a batch of feedback submissions

Creates multiple feedback submission records in a single API call.

Parameters:

NameTypeRequiredDescription
payloadBatchInputSimplePublicObjectInputForCreateYesAn object containing a list of feedback submission inputs, each with properties and optional associations.

Returns: BatchResponseSimplePublicObject|BatchResponseSimplePublicObjectWithErrors|error

Sample code:

hsfeedback:BatchResponseSimplePublicObject|hsfeedback:BatchResponseSimplePublicObjectWithErrors batchCreated =
check feedbackClient->/batch/create.post({
inputs: [
{
properties: {
"hs_survey_channel": "EMAIL",
"hs_response_text": "Very helpful team."
},
associations: []
},
{
properties: {
"hs_survey_channel": "CHAT",
"hs_response_text": "Fast and efficient support."
},
associations: []
}
]
});

Sample response:

{
"status": "COMPLETE",
"results": [
{
"id": "392813800001",
"properties": {
"hs_createdate": "2024-03-18T10:00:00.000Z",
"hs_survey_channel": "EMAIL",
"hs_response_text": "Very helpful team."
},
"createdAt": "2024-03-18T10:00:00.000Z",
"updatedAt": "2024-03-18T10:00:00.000Z",
"archived": false
},
{
"id": "392813800002",
"properties": {
"hs_createdate": "2024-03-18T10:00:00.000Z",
"hs_survey_channel": "CHAT",
"hs_response_text": "Fast and efficient support."
},
"createdAt": "2024-03-18T10:00:00.000Z",
"updatedAt": "2024-03-18T10:00:00.000Z",
"archived": false
}
],
"startedAt": "2024-03-18T10:00:00.000Z",
"completedAt": "2024-03-18T10:00:00.080Z"
}
Update a batch of feedback submissions

Updates multiple feedback submission records by their IDs in a single API call.

Parameters:

NameTypeRequiredDescription
payloadBatchInputSimplePublicObjectBatchInputYesAn object containing a list of update inputs, each with an id and the properties to update.

Returns: BatchResponseSimplePublicObject|BatchResponseSimplePublicObjectWithErrors|error

Sample code:

hsfeedback:BatchResponseSimplePublicObject|hsfeedback:BatchResponseSimplePublicObjectWithErrors batchUpdated =
check feedbackClient->/batch/update.post({
inputs: [
{
id: "392813793683",
properties: {"hs_response_text": "Revised: Excellent experience."}
},
{
id: "392813793700",
properties: {"hs_response_text": "Revised: Very satisfied."}
}
]
});

Sample response:

{
"status": "COMPLETE",
"results": [
{
"id": "392813793683",
"properties": {
"hs_lastmodifieddate": "2024-03-18T11:00:00.000Z",
"hs_response_text": "Revised: Excellent experience."
},
"createdAt": "2024-01-15T10:30:00.000Z",
"updatedAt": "2024-03-18T11:00:00.000Z",
"archived": false
},
{
"id": "392813793700",
"properties": {
"hs_lastmodifieddate": "2024-03-18T11:00:00.000Z",
"hs_response_text": "Revised: Very satisfied."
},
"createdAt": "2024-01-16T14:00:00.000Z",
"updatedAt": "2024-03-18T11:00:00.000Z",
"archived": false
}
],
"startedAt": "2024-03-18T11:00:00.000Z",
"completedAt": "2024-03-18T11:00:00.060Z"
}
Upsert a batch of feedback submissions

Creates or updates multiple feedback submissions based on a unique property value. If a record with the given unique property exists, it is updated; otherwise a new record is created.

Parameters:

NameTypeRequiredDescription
payloadBatchInputSimplePublicObjectBatchInputUpsertYesAn object containing a list of upsert inputs, each with an id, idProperty, and properties.

Returns: BatchResponseSimplePublicUpsertObject|BatchResponseSimplePublicUpsertObjectWithErrors|error

Sample code:

hsfeedback:BatchResponseSimplePublicUpsertObject|hsfeedback:BatchResponseSimplePublicUpsertObjectWithErrors upserted =
check feedbackClient->/batch/upsert.post({
inputs: [
{
id: "ext-feedback-001",
idProperty: "hs_unique_id",
properties: {
"hs_survey_channel": "EMAIL",
"hs_response_text": "Smooth onboarding process."
}
}
]
});

Sample response:

{
"status": "COMPLETE",
"results": [
{
"id": "392813801000",
"properties": {
"hs_createdate": "2024-03-18T12:00:00.000Z",
"hs_survey_channel": "EMAIL",
"hs_response_text": "Smooth onboarding process."
},
"createdAt": "2024-03-18T12:00:00.000Z",
"updatedAt": "2024-03-18T12:00:00.000Z",
"archived": false,
"new": true
}
],
"startedAt": "2024-03-18T12:00:00.000Z",
"completedAt": "2024-03-18T12:00:00.070Z"
}
Archive a batch of feedback submissions

Archives multiple feedback submissions by their IDs in a single request.

Parameters:

NameTypeRequiredDescription
payloadBatchInputSimplePublicObjectIdYesAn object containing a list of submission IDs to archive.

Returns: error?

Sample code:

check feedbackClient->/batch/archive.post({
inputs: [
{id: "392813793683"},
{id: "392813793700"}
]
});
Search feedback submissions

Searches feedback submissions using filter groups, property conditions, sorting, and pagination. Returns submissions matching all specified criteria.

Parameters:

NameTypeRequiredDescription
payloadPublicObjectSearchRequestYesThe search request containing filter groups, sort options, pagination parameters, and property selection.

Returns: CollectionResponseWithTotalSimplePublicObjectForwardPaging|error

Sample code:

hsfeedback:CollectionResponseWithTotalSimplePublicObjectForwardPaging searchResult =
check feedbackClient->/search.post({
filterGroups: [
{
filters: [
{
propertyName: "hs_survey_channel",
operator: "EQ",
value: "EMAIL"
}
]
}
],
properties: ["hs_survey_channel", "hs_response_text", "hs_createdate"],
'limit: 10,
after: "0"
});

Sample response:

{
"total": 42,
"results": [
{
"id": "392813793683",
"properties": {
"hs_createdate": "2024-01-15T10:30:00.000Z",
"hs_lastmodifieddate": "2024-01-15T10:30:00.000Z",
"hs_object_id": "392813793683",
"hs_survey_channel": "EMAIL",
"hs_response_text": "Great service, very responsive team!"
},
"createdAt": "2024-01-15T10:30:00.000Z",
"updatedAt": "2024-01-15T10:30:00.000Z",
"archived": false
},
{
"id": "392813793720",
"properties": {
"hs_createdate": "2024-01-20T08:45:00.000Z",
"hs_lastmodifieddate": "2024-01-20T08:45:00.000Z",
"hs_object_id": "392813793720",
"hs_survey_channel": "EMAIL",
"hs_response_text": "The issue was resolved quickly."
},
"createdAt": "2024-01-20T08:45:00.000Z",
"updatedAt": "2024-01-20T08:45:00.000Z",
"archived": false
}
],
"paging": {
"next": {
"after": "10",
"link": "https://api.hubapi.com/crm/v3/objects/feedback_submissions/search?after=10"
}
}
}