Forum Discussion

dazza's avatar
Active Member
5 months ago

Refresh Token in Webhook Campaign


I'm looking to create a Webhook campaign.

For the endpoint I'm using, the access tokens only last several hours.

What is the recommended practice to deal with such end point that require the tokens to be refreshed every few hours?  I can't find any way to refresh the token in the webhook template form.

thank you!

3 Replies

  • dazza's avatar
    Active Member

    I managed to find a workable solution, and so am posting it here for others in case they find it helpful.

    If there is a better way, please let me know.

    In going through the other webhook templates, it seems that this can be managed via using Connected Content directly in the Header for the value of the Authorization field in the form of:

    Bearer {% connected_content https://sample_api_website/token?grant_type=password&client_id=1234&client_secret=5678&username=user1&password=pass1 :method post :cache_max_age 900 :save token_response %}{{token_response.access_token}}


    I'm not happy with the credentials being visible here and so an still investigating that.  The Connected Content Credentials seems limited to username and password and don't support client_id and secret.

    But please somebody let me know if I'm missing something.

  • Max's avatar

    Hey, have you tried to save the credentials directly in Braze under Settings > Connected Content? You can then use it (if it's a basic authentication) in your connected content call with:

    :basic_auth credential_name 

     You can find an example in the documentation. Hope this helps 🙂 

    • dazza's avatar
      Active Member

      Thanks Max, however, I need to pass the parameters in to the URL.  Would that be possible using this method?  It looks like what you've provided will pass it in the headers and not the URL parameters.