Hi all,
I’m following the Custom Workflow Actions tutorial to create an integration of Hubspot with an external SMS service.
I managed to create the workflow action definition, but can’t get the functions to work.
I’ve defined my function as follows, using Webhook.site as actionUrl
{
"actionUrl": "https://webhook.site/cbf139bf-cae4-48f3-896b-41d130c91fe6",
"published": true,
"objectTypes": [
"CONTACT"
],
"inputFields": [
{
"typeDefinition": {
"name": "smsText",
"type": "string",
"fieldType": "text"
},
"supportedValueTypes": [
"STATIC_VALUE"
],
"isRequired": true
}
],
"inputFieldDependencies": [],
"outputFields": [
{
"typeDefinition": {
"name": "status",
"type": "bool",
"fieldType": "booleancheckbox"
},
"supportedValueTypes": [
"STATIC_VALUE"
]
}
],
"objectRequestOptions": {
"properties": [
"hs_object_id",
"email",
"phonenumber"
]
},
"labels": {
"en": {
"inputFieldLabels": {
"smsText": "Message"
},
"outputFieldLabels": {
"status": "Success"
},
"actionName": "Send SMS (via Zenvia)",
"actionDescription": "Send SMS via Zenvia SMS integration",
"appDisplayName": "Zenvia SMS",
"actionCardContent": "Dispatches an SMS message to a contact's mobile phone through Zenvia SMS integration"
},
"pt-br": {
"inputFieldLabels": {
"smsText": "Mensagem"
},
"outputFieldLabels": {
"status": "Sucesso"
},
"actionName": "Enviar SMS (Zenvia)",
"actionDescription": "Envia mensagem SMS por meio da integra\u00e7\u00e3o com a Zenvia",
"appDisplayName": "Zenvia SMS",
"actionCardContent": "Dispara SMS para o n\u00famero de celular de um contato utilizando a integra\u00e7\u00e3o com a Zenvia"
}
},
"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\"][\"phonenumber\"] ,\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"
}
]
}
However, when I test the custom action, I receive no requests on Webhook.site.
Also, Hubspot throws a “The response body for this request was empty” error on the cumsto action step of the workflow.
Am I missing something?