Retrieving Contact properties in Feedback Submission

Hi,

I have created a feedback survey, where I am asking a question like “what is your email?” which is a contact property. When I try to retrieve the responses of that survey, it does not the email question’s responses.

Looks like the feedback_submissions endpoint only returns properties found in this properties endpoint:

https://api.hubapi.com/crm/v3/properties/feedback_submissions

This is the Url I am using to retrieve the feedback survey responses:

https://api.hubapi.com/crm/v3/objects/feedback_submissions”.

and this is the params I pass in the request:

params_sub = {

“properties”: properties_list,

“limit”: 100,

}

properties_list is a list of all the properties from the properties/feedback_submissions endpoint and also the email property.

Please let me know if there is some way to get that email contact property associated with the feedback responses.

Hi @azharmajeed-ai :waving_hand:

A couple of questions that might help us resolve the issue you’re experiencing:

  1. How are you interacting with the API (e.g. cURL, Python Client Library etc.)?
  2. Would you please share more detailed information about your API request? For example:
    • Endpoint URL + query string parameters (raw please, not “properties_list”)
    • Headers

Please let me know if you have any follow-up questions.

Hi zach_threadint,

Thanks for replying.

1. I am interacting with the API using the requests library in python.

2. Endpoints I am using:

sub_url = "https://api.hubapi.com/crm/v3/objects/feedback_submissions"

prop_url = "https://api.hubapi.com/crm/v3/properties/feedback_submissions"

property_list as you can see below is a dynamic list of all feedback_submission properties along with email which is a ''contact property". Sorry, I should have been more specific there. Please let me know if you have any other questions.
Attached is a snippet of code I am using to get all surveys.

sub_url = "https://api.hubapi.com/crm/v3/objects/feedback_submissions"
prop_url = "https://api.hubapi.com/crm/v3/properties/feedback_submissions"
headers = {
 "Authorization": f"Bearer {access_token}",
 "Content-Type": "application/json",
}

# Get properties
params = {"archived": False}
response_properties = requests.get(prop_url, headers=headers, params=params)
properties = response_properties.json()
prop_df = pd.DataFrame(properties["results"])

# Get submissions for a specific hs_survey_id in batches
# adding email here in case it survey email question was created using a contact property
properties_list = prop_df["name"].unique().tolist() + ["email"]

sub_list_all = []
params_sub = {
 "properties": properties_list,
 "limit": 100,
}

while True:
 response_submissions = requests.get(sub_url, headers=headers, params=params_sub)
 submissions = response_submissions.json()
 sub_list = [sub["properties"] for sub in submissions["results"]]
 sub_list_all += sub_list
 if "paging" in submissions.keys() and "next" in submissions["paging"]:
 next_page = submissions["paging"]["next"]["after"]
 params_sub["after"] = next_page
 if not next_page:
 break
 else:
 break

sub_df_all = pd.DataFrame(sub_list_all)
logger.info(f"Survey Ids found: {sub_df_all.hs_survey_id.unique()}") 

The survey creation feature seems to currently be facing some issue where this page is not loading. I can share the snippet where the contact property ‘email’ is being used once this is back running.

Looking forward to hearing from you.

Best regards,

Azhar

Hi @JDoe3 :waving_hand:

Thanks for the extra information regarding your API request.

I can’t seem to create a test survey where it’s possible to use Contact properties (e.g. Email) as a form field :thinking:

Regardless, what I think you’ll want to consider doing is specifying in your request that you’d like specific Feedback Submission properties and associated Contacts to be returned. For example:

GET https://api.hubapi.com/crm/v3/objects/feedback\_submissions?limit=100&properties=**example\_feedback\_submission\_prop**&associations=**CONTACT**

You then may need to perform another request in order to get specific data relating to the Contact associated with the given Feedback Submission:

GET https://api.hubapi.com/crm/v3/objects/contacts/**{{CONTACT\_ID}}**?&properties=example_contact_prop

I hope this proves useful. Please let me know if you have any follow-up questions.