Custom Workflow Actions: Patch method, returns 500 Internal Server Error

When attempting to update an existing custom workflow action’s specifically changing the `actionUrl` field using the PATCH method, but the API returns a 500 Internal Server Error.

For ActionUrl, I am using ngrok pointing to my local pc, so i am sure that it works.

Here’s the sample body

{
 "id": "30920351",
 "actionUrl": "{{actionUrl}}/api/send-sms",
 "integrationAppId": {{applicationId}},
 "published": true,
 "extensionName": "SMS Local Testing V1",
 "httpHeaders": {
 "Authorization": "Bearer {{auth_token}}"
 },
 "version": 8,
 "latestVersion": 8.1,
 "objectTypes": ["CONTACT", "DEAL"],
 "inputFields": [
 {
 "typeDefinition": {
 "name": "widgetPhone",
 "type": "string",
 "fieldType": "text"
 },
 "supportedValueTypes": ["OBJECT_PROPERTY"],
 "isRequired": true
 },
 {
 "typeDefinition": {
 "name": "smsMessage",
 "type": "string",
 "fieldType": "textarea"
 },
 "supportedValueTypes": ["STATIC_VALUE"],
 "isRequired": true
 }
 ],
 "outputFields": [
 {
 "typeDefinition": {
 "name": "status",
 "type": "bool",
 "fieldType": "booleancheckbox"
 },
 "supportedValueTypes": [
 "STATIC_VALUE"
 ]
 }
 ],
 "labels": {
 "en": {
 "inputFieldLabels": {
 "widgetPhone": "Enter phone number",
 "smsMessage": "SMS Message"
 },
 "outputFieldLabels": {
 "status": "Success"
 },
 "actionName": "SMS Local Testing V1",
 "actionDescription": "This custom workflow is for testing only",
 "actionCardContent": "SMS Local Testing V1"
 }
 },
 "functions": [
 {
 "functionType": "PRE_ACTION_EXECUTION",
 "functionSource": "exports.main = (event, callback) => {\n\n callback({\n \"data\": {\n \"hs_object_id\": event[\"object\"][\"objectId\"],\n \"phone\": event[\"object\"][\"widgetPhone\"] ,\n \"text\": event[\"inputFields\"][\"smsText\"] \n }\n });\n}\n"
 },
 {
 "functionType": "POST_ACTION_EXECUTION",
 "functionSource": "exports.main = (event, callback) => {\n callback({\n \"outputFields\": {\n \"status\": \"true\" ,\n \"hs_execution_state\": \"SUCCESS\" \n }\n });\n}\n"
 }
 ]

}

Hi @RBaniqued :waving_hand:

Using your example JSON body, I’ve not been able to replicate the issue you’re experiencing.

Could you please share the failing request’s cURL code snippet (as generated by Postman)? Be sure to redact any potentially sensitive information (including API keys, private access tokens etc.).

Hi @zach_threadint
Here’s the generated curl, still the same on my side though when tested it

curl --location --request PATCH 'https://api.hubapi.com/automation/v4/actions/{{applicationId}}/{{actionID}}?hapikey={{hapikey}}' \
--header 'Content-Type: application/json' \
--header 'Cookie: __cf_bm=fca0wPnfoMIZlImG8L5aGPUi6PCDN27inF_fQACxmbE-1737337696-1.0.1.1-ZtjFfhufpfrzBeAD_E5bcaQNGgVaK9CFf4TZ6mSd4OfGnGN0wQ3BX4WXKUI8wcBIVhzXe4EdMgMZrYSnus3rmA' \
--data '{
 "id": {{actionID}},
 "actionUrl": "https://webhook.site/dadf4961-2212-4f77-a9b9-b5f5f6ee37c0",
 "integrationAppId": {{applicationId}},
 "published": true,
 "extensionName": "SMS Local Testing V1",
 "version": 8,
 "latestVersion": 8.1,
 "objectTypes": ["CONTACT", "DEAL"],
 "inputFields": [
 {
 "typeDefinition": {
 "name": "widgetPhone",
 "type": "string",
 "fieldType": "text"
 },
 "supportedValueTypes": ["OBJECT_PROPERTY"],
 "isRequired": true
 },
 {
 "typeDefinition": {
 "name": "smsMessage",
 "type": "string",
 "fieldType": "textarea"
 },
 "supportedValueTypes": ["STATIC_VALUE"],
 "isRequired": true
 }
 ],
 "outputFields": [
 {
 "typeDefinition": {
 "name": "status",
 "type": "bool",
 "fieldType": "booleancheckbox"
 },
 "supportedValueTypes": [
 "STATIC_VALUE"
 ]
 }
 ],
 "labels": {
 "en": {
 "inputFieldLabels": {
 "widgetPhone": "Enter phone number",
 "smsMessage": "SMS Message"
 },
 "outputFieldLabels": {
 "status": "Success"
 },
 "actionName": "SMS Local Testing V1",
 "actionDescription": "This custom workflow is for testing only",
 "actionCardContent": "SMS Local Testing V1"
 }
 },
 "functions": [
 {
 "functionType": "PRE_ACTION_EXECUTION",
 "functionSource": "exports.main = (event, callback) => {\n\n callback({\n \"data\": {\n \"hs_object_id\": event[\"object\"][\"objectId\"],\n \"phone\": event[\"object\"][\"widgetPhone\"] ,\n \"text\": event[\"inputFields\"][\"smsText\"] \n }\n });\n}\n"
 },
 {
 "functionType": "POST_ACTION_EXECUTION",
 "functionSource": "exports.main = (event, callback) => {\n callback({\n \"outputFields\": {\n \"status\": \"true\" ,\n \"hs_execution_state\": \"SUCCESS\" \n }\n });\n}\n"
 }
 ]
}'

Hi @RBaniqued :waving_hand:

Thanks for sharing the additional info. This is still leading to a success response for me and nothing really jumps out at me when reviewing your example request.

Do you have any comments in your request body within Postman? Sometimes I’ve seen errors like this that seem to relate to the inclusion of comments in request JSON bodies.

Hi @zach_threadint , regarding comments, none, actually i removed all possible that might cause any errors in updating a custom action, also tried giving an error format for json, but it gives the right error response, which is expected. Its just when everything is good, I am getting this kind of 500 Internal error, it is really weird. So far, for me to move forward, I created another custom action, tried everything there. and it works fine. For now im gonna use that.
Thanks for such a big help.

@RBaniqued Glad you got it sorted :+1: