Crear un Workflow Extension – Hubspot

Siguiendo la documentación creamos el siguiente demo.
https://developers.hubspot.com/docs/api/automation/custom-workflow-actions 

Creamos el Json a registrar como extensión del Workflow, pero sin usar las funciones que trae por defecto.

Entonces tendríamos el siguiente Json de configuración y lo registramos acorde a la documentación.

{
    "actionUrl":"https://midominio.com/endpoint.php",
    "objectTypes":[
      "CONTACT"
    ],
    "inputFields":[
      {
        "typeDefinition":{
          "name":"staticInput",
          "type":"string",
          "fieldType":"text"
        },
        "supportedValueTypes":[
          "STATIC_VALUE"
        ],
        "isRequired":true
      },
      {
        "typeDefinition":{
          "name":"objectInput",
          "type":"string",
          "fieldType":"text"
        },
        "supportedValueTypes":[
          "OBJECT_PROPERTY"
        ],
        "isRequired":true
      }
    ],
    "inputFieldDependencies":[
      {
        "dependencyType":"SINGLE_FIELD",
        "dependentFieldNames":[
          "objectInput"
        ],
        "controllingFieldName":"staticInput"
      }
    ],
    "outputFields":[
      {
        "typeDefinition":{
          "name":"myOutput",
          "type":"string",
          "fieldType":"text"
        },
        "supportedValueTypes":[
          "STATIC_VALUE"
        ]
      }
    ],
    "objectRequestOptions":{
      "properties":[
        "email"
      ]
    },
    "labels":{
      "en":{
        "inputFieldLabels":{
          "staticInput":"Static Input",
          "objectInput":"Object Property Input",
          "optionsInput":"External Options Input"
        },
        "actionName":"My Extension",
        "actionDescription":"My Extension Description",
        "appDisplayName":"My App Display Name",
        "actionCardContent":"My Action Card Content"
      }
    },
    "functions":[],
    "published": true
  } 

Una vez registrada la extensión podemos revisar la acción en el workflow de Hubspot

Ingresamos datos en los campos de pruebas y guardamos.

Ahora solo nos queda la respuesta, cuando se llame al endpoint.

{
  "outputFields": {
    "myOutput": "Some value 13",
    "hs_execution_state": "SUCCESS"
  }
} 

Este retorno del campo “myOutput” podemos usarlo en las siguientes acciones.

Artículos Recientes