APIs & Integrations

xtractor
Participant

Custom Workflow Actions - Automation API help with API response

Hi there,

 

I've only recently started using HubSpot, and have been familairising myself with the custom functions available. 

I've come unstuck with regard to processing API responses via a Customer Workflow Action, and the documentation doesn't give any real examples or pointers to help.

 

I have a workflow set up and have managed to POST custom API calls without any issues, using data from HubSpot .

 

However, two issues I have having.

1 - authenicated the call to the API - unclear how this is set (might be a rookie error in the PRE_ACTION_EXECUTION but I did try adding httpHeaders there but that stopped the API call happening at all

2 - taking data form the response for use within HubSpot  

 

I also could not get the API endpoint 

/automation/v4/actions/{appId}/{definitionId}/functions/{functionType}
to work, it kept gives me a 415 (unsupported media) regardless of what I sent into it. One further point was around outputFieldLabels - these are always lost after creating the custom action, and no examples include them to cross check I've got it right.
 
Any help on this would be very welcome, as I don't feel the documentation gives enough detail, nor decent examples in order to achieve what I'm trying to do. I'm using beeceptor.com to check what is being sent, and to ensure a senisible payload is returned (that includes client_ip)
 
Many thanks in advance,
 
Dave

 

My custom action request:

 

 

 

{
    "actionUrl": "https://xtractor.free.beeceptor.com/my/api/path/4",
    "inputFields": [
        {
            "typeDefinition": {
                "name": "childcompanyValue",
                "type": "string",
                "fieldType": "text"
            },
            "supportedValueTypes": [
                "STATIC_VALUE"
            ],
            "isRequired": true
        }
    ],
    "outputFields": [
        {
            "typeDefinition": {
                "name": "client_ip",
                "type": "string",
                "fieldType": "text"
            }
        }
    ],
    "labels": {
        "en": {
            "actionName": "Dave Test with Output Fields 1937",
            "actionCardContent": "Output fields",
            "inputFieldLabels": {
                "childcompanyValue": "Company Name"
            },
            "outputFieldLabels": {
                "client_ip": "Client IP"
            }
        }
    },
    "functions": [
        {
            "functionType": "PRE_ACTION_EXECUTION",
            "functionSource": "exports.main = function(event, callback) { return callback(transformRequest(event)); }\nfunction transformRequest(request) { return { webhookUrl: 'https://xtractor.free.beeceptor.com/my/api/path/3', body: JSON.stringify(request.fields), contentType: 'application/json', accept: 'application/json', httpMethod: 'POST' }; }"
        }
    ]
}

 

 

 

 

0 Upvotes
dennisedson
Community Manager
Community Manager

Custom Workflow Actions - Automation API help with API response

@Teun !

Mind lending a hand here?

Thanks,

Dennis




HubSpot Community Developer ShowMake sure to subscribe to our YouTube channel
where you can find the HubSpot Community Developer Show
0 Upvotes