CRM Extension : Action Hooks Custom error message


#1

Hello,

I’m trying to respond to an Action Hook with a custom message when there is an error, but it seems I only can write a custom message if my status is 200.

This is the hook that is configured :

{
  type: 'ACTION_HOOK',
  httpMethod: 'PUT',
  uri: (my uri),
  label: 'The label',
  associatedObjectProperties: [
    'lastname',
    'firstname',
    ...
  ],
}

And this is my success response :

return res.status(200).send({ message: 'This is the message !' });

This displays my success message well.

success

But when my response is an error :

return res.status(403).send({ message: 'This is the message !' });

This displays a generic error message.

fail

Is there some way to customise the error message ?

Thanks in advance,

Édouard


#2

Hi @Edouard_DUBOIS,

Thank you for your patience. Custom error responses to action hooks aren’t currently supported. This is something the product team is looking into, but there isn’t yet a timeline. If you have the inclination, I would encourage you to check out the Ideas Forum on the HubSpot Community. There, you can create a post including this use case that product and other customers can see.


#3

Thank you for your response.

I’ve been sending errors as 200 so the message displays correctly and the card refreshes.
This displays correctly for the user (except for the message colour) only messes up the logs a little bit but it is not a major issue.