Our WebSockets feed is currently in Beta and subject to changes. We do our best to make backwards compatible changes. If you have questions or feedback, please come chat with us in our Discord.

Overview

WebSockets give creators a direct feed of the tips that are left on their pages. Once a tip is processed, a simple payload is pushed to your WebSocket connection so you can handle it in real-time.

Setup

1. Get an API key

You can get an API key under API Keys on your dashboard.

We recommend creating a new API key for each integration or service you use. This way, you can easily revoke access to a specific service without affecting others.

API keys are private and should never be made public.

2. Connect to a feed

You can use websocketking.com to test WebSocket connections.

You can connect to a real-time feed with the API key above using one of the following URLs:

Firehose

The firehose feed sends all tips for all pages you own.

Firehose Feed
wss://events.pally.gg?auth=YOUR_API_KEY&channel=firehose

Page Activity Feed

The activity feed sends all tips for a specific page you own or have access to.

Page Activity Feed
wss://events.pally.gg?auth=YOUR_API_KEY&channel=activity-feed&room=PAGE_SLUG

3. Keep your connection alive

With WebSockets, events are only sent/received when a connection is open. We only send events once to all open WebSocket connections after the tip is received.

To ensure you receive the events, there are several ways to make sure your connection stays alive:

  1. Implement retry and reconnect mechanisms in your client.

  2. Send a simple ping message every 60 seconds to keep the connection alive. The server should respond with pong.

Events

The event payload may contain additional/undocumented fields but will always contain the documented fields.

campaigntip.notify

Sent when a new tip is received for a page you own or when a tip is replayed from the activity feed.

{
  "type": "campaigntip.notify",
  "payload": {
    "campaignTip": {
      "createdAt": "2024-03-13T18:02:33.743Z",
      "displayName": "Someone",
      "grossAmountInCents": 500,
      "id": "b1w2pjwjtb9fx0v1se9ex4n2",
      "message": "",
      "netAmountInCents": 500,
      "processingFeeInCents": 0,
      "updatedAt": "2024-03-13T18:02:33.743Z"
    },
    "page": {
      "id": "1627451579049x550722173620715500",
      "slug": "pally",
      "title": "Pally.gg's Team Page",
      "url": "https://pally.gg/p/pally"
    }
  }
}

Testing

You can test receiving events by sending an echo message to an open WebSocket connection. The server will respond by sending the payload of the message back.

Below is an example of an echo message that can be sent to test receiving a campaigntip.notify event.

This example is formatted but should be sent as a string. It can be pasted in websocketking.com but would be surrounded in quotes in code.
{
  "type": "echo",
  "payload": {
    "type": "campaigntip.notify",
    "payload": {
      "campaignTip": {
        "createdAt": "2024-03-13T18:02:33.743Z",
        "displayName": "Someone",
        "grossAmountInCents": 500,
        "id": "b1w2pjwjtb9fx0v1se9ex4n2",
        "message": "",
        "netAmountInCents": 500,
        "processingFeeInCents": 0,
        "updatedAt": "2024-03-13T18:02:33.743Z"
      },
      "page": {
        "id": "1627451579049x550722173620715500",
        "slug": "pally",
        "title": "Pally.gg's Team Page",
        "url": "https://pally.gg/p/pally"
      }
    }
  }
}