> ## Documentation Index
> Fetch the complete documentation index at: https://docs.worldvisagroup.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Pusher Beams Push Integration with WorldVisa

> Connect Pusher Beams to WorldVisa to send push notifications to iOS, Android, and web devices through workflows using your Pusher Beams instance ID and secret key.

[Pusher Beams](https://pusher.com/beams/) is a cross-platform push notification API service provided by Pusher.

This guide explains the process of configuring and using Pusher Beams with WorldVisa, from getting your credentials to sending your first notification.

## How to configure Pusher Beams with WorldVisa

Before you can send notifications, you must get your credentials from a Pusher Beams instance and add them to your WorldVisa integration settings.

### Step 1: Get your Pusher Beams credentials

To enable Pusher Beams integration, you need to create a Pusher Beams Instance and use both `Instance ID` and `Secret Key` from the Instance [dashboard](https://dashboard.pusher.com/beams/).

**1. Log in to Pusher Beams**

Open the Pusher Beams dashboard and sign in.

**2. Create an instance**

Name your Pusher Beams instance, then click **Create instance**.

**3. Name the instance**

Enter the instance name, and then click **Create**.

![Create instance](https://mintcdn.com/wv-enterprise/l3bkwl1N_3mOn9aW/images/developers/channels-and-providers/push/pusher-beams/create-instance.png?fit=max\&auto=format\&n=l3bkwl1N_3mOn9aW\&q=85\&s=57a01dd77ab9b3e686c537c9092d6163)

**4. Copy credentials**

In the instance dashboard, click **Keys** from the sidebar, then copy and store your **Instance ID** and **Primary key** you will need them in [Step 2](https://docs.worldvisagroup.com/developers/integrations/push/pusher-beams.md#step-2-connect-pusher-beams-to-WorldVisa).

![Instance credentials](https://mintcdn.com/wv-enterprise/l3bkwl1N_3mOn9aW/images/developers/channels-and-providers/push/pusher-beams/instance-credentials.png?fit=max\&auto=format\&n=l3bkwl1N_3mOn9aW\&q=85\&s=f47ea7beabac5ba2e588d9e6888cceab)

### Step 2: Connect Pusher Beams to WorldVisa

Next, add these credentials to your Pusher Beams integration in the WorldVisa dashboard.

**1. Log in to the WorldVisa dashboard**

Open the WorldVisa Dashboard.

**2. Open Integration Store**

On the WorldVisa dashboard, navigate to the **Integration Store**.

**3. Connect a provider**

In the **Integration Store**, click **Connect provider** to begin setup.

**4. Select Pusher Beams**

In the **Push** tab, choose **Pusher Beams** from the provider list.

**5. Paste credentials**

In the Pusher Beams integration form, paste your **Instance ID** and **Secret Key** into the corresponding fields.

![Pusher Beams Integration in WorldVisa](https://mintcdn.com/wv-enterprise/l3bkwl1N_3mOn9aW/images/developers/channels-and-providers/push/pusher-beams/pusher-beams-integration.png?fit=max\&auto=format\&n=l3bkwl1N_3mOn9aW\&q=85\&s=9ca24191acb1ddf09eefc54cbe80a294)

**6. Create the integration**

Review your credentials, then click **Create Integration** to save.

## Using Pusher Beams with WorldVisa

Once your integration is configured, you can start sending push notifications by registering your subscribers' `userId` and triggering a workflow.

### Step 1: Add subscriber device token

After [setting up the Pusher Beams SDK](https://pusher.com/docs/beams/reference/all-libraries/) in your application, you must associate users with their devices using Pusher Beams' [Authenticated Users](https://pusher.com/docs/beams/guides/publish-to-specific-user/web/) feature. This assigns them a `userId`.

To target a Pusher Beams user from WorldVisa, you must register this `userId` as the `deviceToken` for their WorldVisa subscriber profile. You can retrieve this value using the [`getUserId()`](https://pusher.com/docs/beams/reference/web/#getuserid) method from the Pusher Beams SDK.

You can do this by making an API call to update the subscriber's credentials.

```bash theme={null}
curl -L -X PUT "${WV_API_URL}/v1/subscribers/<SUBSCRIBER_ID>/credentials" \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H "Authorization: ApiKey ${WV_API_KEY}" \
-d '{
  "providerId": "pusher-beams",
  "credentials": {
    "deviceTokens": [
      "token1",
      "token2",
      "token3"
    ]
  },
  "integrationIdentifier": "pusher-beams-MnGLxp8uy"
}'
```

### Step 2: Send a notification

Now you're ready to send a push notification. [Create a workflow with a Push step](https://docs.worldvisagroup.com/developers/workflow/create-a-workflow.md) and trigger it. WorldVisa sends the notification to the `userId`'s associated with the subscriber.

The example below demonstrates a simple trigger using WorldVisa’s SDK.

```bash theme={null}
curl --location "${WV_API_URL}/v1/events/trigger" \
--header 'Content-Type: application/json' \
--header "Authorization: ApiKey ${WV_API_KEY}" \
-d '{
    "name": "workflowId",
    "to": [
        "subscriberId"
    ],
    "payload": {
        "custom_data": "custom_data"
    }
}'
```

## Activity tracking

Pusher Beams supports [push activity tracking](https://docs.worldvisagroup.com/developers/integrations/push/push-activity-tracking.md). Enable the **Push Activity Tracking** toggle on the Pusher Beams integration. Your app reads the WorldVisa message id from the notification and forwards it as `eventId`.

WorldVisa puts the trigger payload, including `__nvMessageId`, in the `data` object on all three platform blocks:

* Android: FCM `data.__nvMessageId`
* Web: the default Beams service worker stores the web payload at `notification.data.pusher.customerPayload`. The message id is `notification.data.pusher.customerPayload.data.__nvMessageId`.
* iOS: the same `data` object beside `aps`, so the id is `data.__nvMessageId` in the APNs `userInfo`

```json theme={null}
{
  "aps": {
    "alert": { "title": "Hello", "body": "Hello, world!" }
  },
  "data": {
    "__nvMessageId": "65c0d71c0959a38e8857b999"
  }
}
```

A `data` override on `fcm`, `web`, or `apns` is merged into that object. Leave `__nvMessageId` in place.

On web, read the id from the default Beams service worker shape:

```javascript theme={null}
self.addEventListener("notificationclick", (event) => {
  const messageId =
    event.notification.data?.pusher?.customerPayload?.data?.__nvMessageId;

  event.waitUntil(
    fetch("https://your-api.com/api/notifications/events", {
      method: "POST",
      headers: { "Content-Type": "application/json" },
      body: JSON.stringify({
        eventType: "clicked",
        eventId: messageId,
      }),
    })
  );
});
```

Forward `delivered`, `opened`, `dismissed`, or `failed` the same way when your app observes those events. Your backend then calls [WorldVisa's activity endpoint](https://docs.worldvisagroup.com/developers/integrations/push/push-activity-tracking.md#step-3-forward-events-to-WorldVisa-from-your-backend).


## Related topics

- [Activity Tracking](https://docs.worldvisagroup.com/developers/integrations/push/push-activity-tracking.md)
- [Push Webhook Push Integration with WorldVisa](https://docs.worldvisagroup.com/developers/integrations/push/push-webhook.md)
- [Expo Push Push Integration with WorldVisa](https://docs.worldvisagroup.com/developers/integrations/push/expo-push.md)
- [Pushpad Push Integration with WorldVisa](https://docs.worldvisagroup.com/developers/integrations/push/pushpad.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.