---
title: "Accessing metadata | WebhookRelay"
meta:
  "og:description": "Accessing metadata from Webhook Relay Functions"
  "og:title": "Accessing metadata"
  description: "Accessing metadata from Webhook Relay Functions"
---

![Stripes](https://webhookrelay.com/docs/webhooks/functions/accessing-metadata/images/stripes.svg)

Documentation

**Fundamentals**

# **Accessing metadata**

Accessing metadata from Webhook Relay Functions

It can be useful to access metadata from the function. For example, you can access the bucket, input and output names or the IDs directly from the function. This way you can build more complex functions that can be used in different scenarios.

## [Accessing metadata](#accessing-metadata)

You can access the metadata from the function:

```
r.metadata["bucket_name"]
```

```
r.Metadata["bucket_name"]
```

## [Available metadata](#available-metadata)

| Metadata | Description |
| --- | --- |
| bucket_id | The ID of the bucket |
| bucket_name | The name of the bucket |
| input_id | The ID of the input |
| input_name | The name of the input |
| output_id | The ID of the output |
| output_name | The name of the output |
| output_url | The URL of the output |

## [Example function deciding based on bucket name](#example-function-deciding-based-on-bucket-name)

Here's an example accessing Bucket name from within the function:

```
const bucketName = r.metadata["bucket_name"]

if (bucketName === "first-bucket") {
    // do something
    const response = http.request("GET", "https://company-a.com")
    // exit from function
    return
}

if (bucketName === "second-bucket") {
    // do something
    const response = http.request("GET", "https://company-b.com")
    // exit from function
    return
}
```

```
local http = require("http")

local bucket_name = r.Metadata["bucket_name"]

if bucket_name == "first-bucket" then
  -- do something
  response, err = http.request("GET", "https://company-a.com")
  if err then error(err) end
  -- exit from function
  return
end


if bucket_name == "second-bucket" then
  -- do something
  response, err = http.request("GET", "https://company-b.com")
  if err then error(err) end
  -- exit from function
  return
end
```

Did this page help you?