# PubNub

![Pubnub-logo.svg](https://assets.relyanceuat.xyz/images/docs/6567031422989/6566877456909.svg)
PubNub is a web-based infrastructure-as-a-service (IaaS) communication Platform. It supports use cases including chat, virtual events, collaboration, alerting, IoT device control, real-time updates, and push notifications to help companies build engaging, scalable, and reliable apps.

In order to integrate PubNub with Relyance AI you will need a **Publish Key**, **Subscribe Key**, **Secret Key**, and **UUID**.

#### In PubNub:

1. Login to your PubNub account.
2. Go to the Admin Portal at [PubNub Admin Portal](https://admin.pubnub.com/)
3. Click on **Apps** in the left-side navigation menu.
4. Click on the **+ CREATE NEW APP** button on the right-side of the Apps page.

![PubNub-1.png](https://assets.relyanceuat.xyz/images/docs/6567031422989/6567494445581.png)

![PubNub-2.png](https://assets.relyanceuat.xyz/images/docs/6567031422989/6567584296461.png)

5. Provide a name in the dialog box that pops up and click **CREATE**.
6. Click on the new app card.

7. Click on the new app card keyset on the resulting page.

![PubNub-3.png](https://assets.relyanceuat.xyz/images/docs/6567031422989/6567584499085.png)

8. Copy the **Publish Key**, **Subscribe Key**, and **Secret Key** from this page.
9. The **UUID** is a unique identifier for this App, you will need to provide a unique string of up to 64 characters to help PubNub identify the client that connects to the PubNub platform. You can create this yourself. See this document for more info: [How do I set the UUID?](https://support.pubnub.com/hc/en-us/articles/360051496532-How-do-I-set-the-UUID-)

#### In the Relyance AI application:

1. Login to your Relyance account.
2. Navigate to the **Settings** Menu in the bottom left-hand side.
3. Select **Integrations**.
4. Click on the **Vendor Integration** tab.
5. Find the **PubNub** integration card and click it to open its connections.
6. Under **Authentication Method**, choose **Custom**.
8. Paste the **Publish Key**, **Subscribe Key**, **Secret Key**, and **UUID** into their respective fields.

![PubNub-4.png](https://assets.relyanceuat.xyz/images/docs/6567031422989/6567553929101.png)

9. Click **Authenticate**.
10. At this point, you should see the following result on the Vendor Integrations page:

![PubNub-5.png](https://assets.relyanceuat.xyz/images/docs/6567031422989/6567560135565.png)

11. Congratulations, you are now connected to **PubNub**.

<!-- terraform-examples:begin (generated from the integration catalog; do not hand-edit) -->

## Manage this integration with Terraform

Connections for this integration can be managed as code with the [Relyance Terraform provider](https://registry.terraform.io/providers/Relyance/relyance/latest). Non-secret fields go in `auth.params`; secret fields go in `auth.secrets_wo`, which is write-only — never stored in Terraform state. Rotate secrets by bumping `auth.secrets_wo_version`.

```hcl
resource "relyance_integration_connection" "pubnub" {
  vendor = "pubnub"
  name   = "<your connection name>"

  auth = {
    method = "keyset"
    params = {
      uuid = "ade395ab-67eb-4df3-81b6-16b230803e10"
      data_storage_location = "us"
    }
    # Secret fields are write-only: sent to Relyance, never stored in state.
    secrets_wo = {
      pubkey = var.pubnub_pubkey
      subkey = var.pubnub_subkey
      seckey = var.pubnub_seckey
    }
    secrets_wo_version = 1
  }

  scans = { "property-inspection" = { enabled = true } }
}
```

<!-- terraform-examples:end -->
