Custom Workflow Actions: Fetching an external data issue

Hello,

we have 2 custom actions apps which use the same code:

var actionBody = new
 {
 actionUrl = $"{my_service_url_here}/api/v1/hubspot/sendTemplate",
 published = true,
 inputFields = new List<object>()
 {
 new {
 typeDefinition = new {
 name = "whatsappNumber",
 type = "string",
 fieldType = "text"
 },
 supportedValueTypes = new List<string>() {
 "STATIC_VALUE"
 },
 isRequired = true
 },
 new {
 typeDefinition = new {
 name = "templateName",
 type = "enumeration",
 fieldType = "select",
 optionsUrl = $"{my_service_url_here}/api/v1/hubspot/getTemplates"
 },
 supportedValueTypes = new List<string>() {
 "STATIC_VALUE"
 }
 },
 new {
 typeDefinition = new {
 name = "parameters",
 type = "string",
 fieldType = "textarea"
 },
 supportedValueTypes = new List<string>() {
 "STATIC_VALUE"
 },
 isRequired = false
 },

 },
 labels = new
 {
 en = new
 {
 actionName = "Send Whatsapp Message",
 actionDescription = "This action will create a new widget to send message template in hubspot. Please notify help description.",
 actionCardContent = "Your Number: {{whatsappNumber}}, Template Name: {{templateName}}, Parameters: {{parameters}}",
 inputFieldLabels = new
 {
 whatsappNumber = "Whatsapp Number",
 templateName = "Template Name",
 parameters = "Parameters and Values",
 },
 inputFieldDescriptions = new
 {
 whatsappNumber = "Input your Whatsapp number with country code. eg. 11234567890",
 templateName = "Select your template name created from WATI",
 parameters = "Fill out pairs of parameter and value according to the template name choosen above. eg. param1:value, param2:value ...",
 }
 },
 },
 objectTypes = new List<string> {
 "CONTACT", "DEAL"
 },
 functions = new List<object> {
 new {
 functionType= "PRE_FETCH_OPTIONS",
 id = "templateName",
 functionSource = "exports.main = function(event, callback) { return callback(transformRequest(event)); }\nfunction transformRequest(request) { return { webhookUrl: request.webhookUrl, body: JSON.stringify(request.fields), httpMethod: 'POST' }; }"
 }
 }
 };

as you see there is a dropdown which fetches the data from our side,

calling

optionsUrl = ${my_service_url_here}/api/v1/hubspot/getTemplates"

The problem:

app1 calls this endpoint and passes a correct PortalId and

ExtensionDefinitionId as result it gets the data from our side and shows it in dropdown,

but app2 call this endpoint but doesn’t pass any data to our server. content is empty for some reasons.

as result it shows an error in dropdown menu:

I compared these https requests and reproduced it in Postman.

There is only one difference in these requests -

extensionDefinitionId field:

failed for app2, but works for app1:

The logs in our side confirm that data is empty for app2:

app1:

app2:

My questions:

What is wrong with “extensionDefinitionId”: 11785357 ?

Why does it work well with

“extensionDefinitionId”: 3627888, but does’t with 11785357 ?

What have I done wrong in the config of the second app which is causing this issue, how can I fix this?

Already spent a lot of time looking for the root cause, please help

Hi, @AndreyL :waving_hand: I’m sorry this situation is one of high frustration for you. I do not have the solution. And I’d like to gather some additional information. Best case is we get you unstuck and, at the very least, we gather data to share with our resources. The below questions are not meant to be tedious, but rather to maximize our odds of finding a next step or solution.

Questions:

  • Parallel App Experiment: Could you try creating a new app with the same settings as app2 and see if the problem persists? If it does, try creating a new one mimicking app1’s settings. This could help you identify whether the issue lies with the settings in the app or if it’s something else
  • Isolate the HTTP Request: Have you tested the functionality of the code within app2 that makes the HTTP request independent of the dropdown feature? Maybe you could set up a test button that would execute the same HTTP request when clicked and see if the results are as expected?
  • ID Swap: Try switching the extensionDefinitionId of app2 to that of app1 temporarily and see if the request is successful. Although these IDs usually don’t impact functionality, it might give us more information about what’s happening
  • Isolation Test: If possible, try isolating app2 on a separate server or environment and see if that changes anything

Thanks in advance! — Jaycee

hi @Jaycee_Lewis ,

- Parallel App Experiment:

app2(appId: 549162, extensionDefinition: 11785357) was created in the image and likeness of the app1(262918, extensionDefinition: 3627888).

app3(1550526) that mimics app1 too - has the same issue that app2.

- Isolate the HTTP Request:

Test1.

I changed dropdown’s optionsUrl to webhook.site url:

here is a request that webhook.site received,

as you see there is no Content at all.

Test2.

I removed dropdown section at all, left only simple text field, turned on the workflow and enrolled this workflow to contacts.

webhook.site received the data:

from this we can conclude that only the logic of the dropdown section (PRE_FETCH_OPTIONS) does not work for app2 and app3.

Question here: why does it work well for app1, if the code is the same?

app1 was created a long time ago (February 24, 2021),

app2 - December 13, 2021

app3 - March 28, 2023

Maybe during this time there were some changes in the app configuration in your side that we lose sight of? it may expain why app1 works well, but app2,3 don’t…

- ID Swap:

I changed extensionDefinitionId of app2 to app1 for the same http request (namely: for dropdown PRE_FETCH_OPTIONS request ) - it works with app1, but doesn’t with app2.

I have attached Postman screenshots of this test in my previous comment, you can check it.

@Jaycee_Lewis

the same code also works well for production app (id:262931, Created on February 25, 2021)

it’s published and listed a long time ago.

Same issue I’m facing now.
Our prod app is getting correct information from HS but not my test app.