Custom link not working in CRM Extensions API

Hey all!

I have an extremely simple app that I created in Flask. Here’s my end goal: Create a CRM Card that has a link back to my App with a couple of variables from the Company. This seems to work perfectly fine if I do not include any variables and type in a hardcoded URL. The moment I change the URL to include variables, I get a Response deserialization error.
Here’s the code:

@app.route('/google-scan')
def google_scan():
 try:
 company_name = request.args.get('name')
 except Exception:
 company_name = 'unknown'
 try:
 city = request.args.get('city')
 except Exception:
 city = 'unknown'
 try:
 state = request.args.get('state')
 except Exception:
 state = 'unknown'
 try:
 zip = request.args.get('zip')
 except Exception:
 zip = 'unknown'
 link = 'https://[MY_URL].com/search/' + company_name + '/' + city + '/' + state + '/' + zip
 data = {
 'results': [
 {
 'objectId': 1,
 'title': "Google Search",
 'link': link,
 }
 ]
 }
 response = make_response(data, 200)
 response.headers['Content-Type'] = 'application/json'
 response.headers['accept'] = 'application/json'
 return response

You might be wondering if I’m getting exceptions at every request.args.get(‘variable’). I’m not. The data is being passed from HubSpot to my app. Again, I’m not sure why the link works fine if it is hard-coded, but not when I include variables. Any insight would be appreciated!

Hey @jacobtomlinson,

Just to clarify, when you add the variable on the url, did you update the data fetch url on the dev app crm cards settings?

Additionally, could you share with me the app ID in question?

Hey @WendyGoh ,

Here is the Data Fetch URL:

32000i7DC1148AB3E29D66.png

Here is the Base Action URLs:

The App ID is 228850.

Hey @jacobtomlinson,

Thanks for sharing additional details!

I believe you’re seeing the Response deserialization error likely because the link was not passed as a url encoded link:

{
"results" : [
{
"link" : "https://hubspot-hook.herokuapp.com/search/Mathnasium of Roslyn Heights/Roslyn Heights/NY/11577",
"objectId" : 1,
"title" : "Google Search"
}
]
}

I changed it to the following:

{
"results" : [
{
"objectId" : 1,
"title" : "Google Search",
"link" : "https://hubspot-hook.herokuapp.com/search/Mathnasium%20of%20Roslyn%20Heights/Roslyn%20Heights/NY/11577"
}
]
}

and it is working just fine. Can you try and see if it works on your end?


Of course! Thanks, @WendyGoh.