APIs & Integrations

Peta_APB
Contributor | Gold Partner
Contributor | Gold Partner

Webhooks in Workflows - how to include the authorization header with my API key

SOLVE

Hi all

 

I’m trying to build a workflow that sends a webhook to an external application (Stripe) using a GET method.

 

I feel I’m having trouble with one step. And I’ve been referring to the instructions here:

https://knowledge.hubspot.com/workflows/how-do-i-use-webhooks-with-hubspot-workflows#set-up-a-webhoo...

 

So my issue is that I’m experiencing a 401 error. Which I understand it’s not authenticating my request. So, I've used the following settings in my webhook:

 

  • I’ve selected GET method.
  • I’ve added my Stripe API Key as a secret.
  • I’ve selected API Key as the authentication type and selected my secret for my Stripe key.
  • I’ve selected Request header as the key location.


So even though I've selected request header as my key location, do I also need to add an additional query parameter to set the header? If so, exactly what values need to be set in the Key and Value fields so that it uses my secret and sets the authorization as bearer token?

 

Sorry if this is a dumb question, but I've tried:

Key = Authorization

Value = Bearer {StripeTestDataKey}

 

This isn't correct obviously so any help would be appreciated because I've tried many combinations.

 

I thought this would actually be quite easy as I actually have these already built in our Zapier account so I know the URL and the API key are correct, etc. I would love to resolve this one issue of authenticating the request so that I can simply bypass sending everything through Zapier.

And I should also explain that I’m not a developer so please be gentle, but I’ve searched through the Hubspot literature and simply cannot find the answer to this question anywhere and support aren't able to help me. 

So hopefully this is simple for someone to help me with.

Thank you.

Kind regards

Peta

0 Upvotes
1 Accepted solution
Peta_APB
Solution
Contributor | Gold Partner
Contributor | Gold Partner

Webhooks in Workflows - how to include the authorization header with my API key

SOLVE

If anyone is looking, I just noticed Hubspot just updated their article to include the information I was missing.

 

Peta_APB_0-1675653947914.png

 

 

 

Peta_APB_3-1675654332683.png

 

Peta_APB_5-1675654535376.png

 

 

 

 

View solution in original post

6 Replies 6
JG_520
Participant

Webhooks in Workflows - how to include the authorization header with my API key

SOLVE

@tominal @Peta_APB Did you ever find a solution for this? I need to pass to 2 key:values in the header, 1 being the API key, the onther being

Content-Typeapplication/x-www-form-urlencoded

 

0 Upvotes
Peta_APB
Contributor | Gold Partner
Contributor | Gold Partner

Webhooks in Workflows - how to include the authorization header with my API key

SOLVE

Hi @JG_520 my understanding is that unfortunately customization of workflow webhooks is extremely limited, so I'm not aware of a way to include additional headers.

I did post an update however on how to include the API key. I included screenshots on how to save the key as a secret and include in the webhook. You need to save the key in your secrets as the exact value required in the header and then select 'API Key' in the dropdown selection under 'Authentication type'. Once selected, you'll then need to actually rename the API key name to "Authorization" (as per my screenshots in the thread here: https://community.hubspot.com/t5/APIs-Integrations/Webhooks-in-Workflows-how-to-include-the-authoriz...).

Other than that, as far as I'm aware, the only way around it is to either send the request outside of Hubspot and use something like Zapier. Or alternatively if you have Ops Hub, then you might need to see if you can use an Custom Code action step. 

I'd love to see if there are improvements coming though or if anyone has a workaround solution as 99% of the time, if I'm trying to retreive information, I can't use a webhook step in a workflow because most of them need a dynamic url or some level of customization in the request body.

Peta_APB
Solution
Contributor | Gold Partner
Contributor | Gold Partner

Webhooks in Workflows - how to include the authorization header with my API key

SOLVE

If anyone is looking, I just noticed Hubspot just updated their article to include the information I was missing.

 

Peta_APB_0-1675653947914.png

 

 

 

Peta_APB_3-1675654332683.png

 

Peta_APB_5-1675654535376.png

 

 

 

 

Jaycee_Lewis
Community Manager
Community Manager

Webhooks in Workflows - how to include the authorization header with my API key

SOLVE

Hey, @Peta_APB 👋 Thank you so much for your question. Let's see if any of our brilliant community members have experience here — @Teun @LMeert @tominal, do you have any tips you can share with @Peta_APB?

 

Thank you! — Jaycee

linkedin

Jaycee Lewis

Developer Community Manager

Community | HubSpot

0 Upvotes
tominal
Guide | Partner
Guide | Partner

Webhooks in Workflows - how to include the authorization header with my API key

SOLVE

Hi @Peta_APB,

 

I am having trouble understanding your use case here. Webhooks are one-way requests sent by applications like HubSpot and Stripe for an application to react to.

 

If you are wanting to change something on Stripe's end, you would need to use some code to utilize their API. You can actually accomplish this using a custom code workflow action (HubSpot Enterprise), but you would need some Node.js experience.

 

Are you able to speak a little about your use case for us to better understand?

 

Regards,
-T


Thomas Johnson
Community Champion


Kahu Software LLC
A Texan HubSpot consulting firm
https://kahusoftware.com
0 Upvotes
Peta_APB
Contributor | Gold Partner
Contributor | Gold Partner

Webhooks in Workflows - how to include the authorization header with my API key

SOLVE

Hi @tominal thank you so much for your reply.

I have several use cases, but to keep it simple, I think all I’m struggling with is understanding how to configure my webhook to include my Stripe API key as Authorization: Bearer {my_Stripe_API_key}.

In terms of use cases, we actually have quite a few and in fact, I already have most of this built in Zapier using custom webhooks, so I am comfortable with that and comfortable with the Stripe API documentation, but I just am struggling with how to configure webhooks in Hubspot and Hubspot support have directed me here.

I actually shot a quick screen recording to explain my issue better (I feel like I’m just missing pieces of information):

 

https://www.loom.com/share/4e4a6a27434c47b09228a6b6e6efe244

 

 

I hope this adds better clarification to my original question.

I look forward to hearing from you soon.


Warm regards

Peta

0 Upvotes