# Setting Authorization Header in Webhooks

**URL:** <https://community.prismic.io/t/setting-authorization-header-in-webhooks/514>\
**Category:** Features\
**Tags:** product-feature-idea\
**Created:** [May 22, 2020, 4:54pm UTC](https://community.prismic.io/t/setting-authorization-header-in-webhooks/514 "2020-05-22T16:54:22Z")\
**Posts on this page:** 1\
**Showing post:** 18

<div class="post-metadata">

**Author:** ![juj](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/juj/32/100_2.png) [@juj](https://community.prismic.io/u/juj)\
**Post date:** [November 19, 2020, 9:54am UTC](https://community.prismic.io/t/setting-authorization-header-in-webhooks/514/18 "2020-11-19T09:54:55Z")

</div>

Sure 🙂

I have created a lambda function called forwardPrismicWebhook (to Github Actions).

I have set Prismic up to call the lambda's url with a query parameter for the prismic repository, so that I can use the same lambda for multiple Prismic repos. E:g. forward-prismic-webhook-url?repository=myrepo.

In my lambda I do something like this:

```auto
const bodyFromPrismic = JSON.parse(event.body);
const data = {
   event_type: "prismic-publish",
};

const githubActionsUrl = getGithubActionsUrl(
   event.queryStringParameters.repository
);

const config = createConfig(bodyFromPrismic.secret, data);

try {
  const resp = await axios.post(githubActionsUrl, data, config);
  console.log("Response from Github Actions: ", resp);
  return successResponse(
    event,
    "Github Actions webhook called successfully!"
  );
} catch (err) {
  console.error(err);
  return errorResponse(event, "Failed to call Github Actions webhook!");
}

```

The getGithubActionsUrl method is just a switch-case that returns the url to the corresponding Github Actions for one of my Prismic repositories.

The createConfig creates the headers I needed to call Github Actions with

```auto
const createConfig = (authToken: string, data: any) => {
  return {
    headers: {
      "Content-Type": "application/json",
      "Content-Length": data.length,
      Accept: "application/vnd.github.everest-preview+json",
      Authorization: "Bearer " + authToken,
      "User-Agent": "Prismic",
    },
  };
};

```

---

_[View the full topic](https://community.prismic.io/t/setting-authorization-header-in-webhooks/514)._
