Skip to main content

Backend Integration

Once an account is subscribed to your app's notifications you can test sending notifications to the account. You can subscribe in your app directly with our Frontend Integration, or with one of the below testing options.

We recommend testing notifications with the Web3Inbox.com app which supports push notifications and can be installed to your phone. You can also try one of our sample wallets:

Authentication​

To send notifications and access all subscriber information for your dapp, you will need your Notify API Secret and project ID.

You can find the Notify API Secret under the Notify API section of the APIs tab of your project on WalletConnect Cloud. Follow steps on the Cloud Setup page to configure this. This secret allows publishing notifications to any account subscribed to your app, so should not be published and should only be used by your app backend.

Sending notifications​

Only plaintext is supported, and newlines are ignored.

To send a notification notification you can call the /notify endpoint. This endpoint supports the following fields:

  • type - The Notification type ID copied from WalletConnect Cloud.
  • title - The title of the notification. Max 64 characters.
  • body - The body of the notification containing more detail. Max 255 characters.
  • url (optional) - A URL attached to the notification that the user can navigate to. Max 255 characters.
  • accounts - A list of CAIP-10 account IDs for which to send the notification to. Max 500 accounts per request. Also see the rate limits below.
  • notification_id (optional) - An idempotency key of arbitrary format used to dedup multiple requests. Max 255 characters. Multiple calls with the same notification_id will use the first call's notification content, but will send to any additional account IDs listed in accounts.
type RequestBody = {
notification_id?: string | null
notification: {
type: string
title: string
body: string
url?: string | null
}
accounts: string[]
}

Example usage:

const PROJECT_ID = '<PROJECT_ID>'
const NOTIFY_API_SECRET = '<NOTIFY_API_SECRET>'
const response = await fetch(`https://notify.walletconnect.com/${PROJECT_ID}/notify`, {
method: 'POST',
headers: {
Authorization: `Bearer ${NOTIFY_API_SECRET}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
notification: {
type: 'a1e53b95-18e5-4af8-9f03-9308ec87b687',
title: 'The price of Ethereum has risen',
body: 'The price of Ethereum has gone up 10%',
url: 'https://app.example.com'
},
accounts: ['eip155:1:0x9AfEaC202C837df470b5A145e0EfD6a574B21029']
})
})

Get subscribers​

You can get a list of all of the currently-subscribed accounts by calling the /subscribers endpoint:

const PROJECT_ID = '<PROJECT_ID>'
const NOTIFY_API_SECRET = '<NOTIFY_API_SECRET>'
const response = await fetch(`https://notify.walletconnect.com/${PROJECT_ID}/subscribers`, {
headers: {
Authorization: `Bearer ${NOTIFY_API_SECRET}`
}
})
const subscribers: string[] = await response.json()

Rate limits​

To protect our system and subscribers, various limits and rate limits are in-place.

Rate limits are implemented as token bucket and contain both rate and burst amounts. On average, a rate of requests can be made. However, since real-world applications often make requests in bursts, this fixed rate can be surpassed temporarily up to the burst amount, provided the app subsequently makes requests below the average in order to recover its bursting capability.

  • POST /notify:
    • Each app can send 2 notifications per hour to an account, with a burst up to 50. Accounts that have been rate limited will be returned in the request response. Exceptions may be made on a per-project basis for special circumstances.
    • Each app can call this endpoint 2 times per second with a burst up to 20. Rate limited requests will return a 429 status code.
  • GET /subscribers
    • Each app can call this endpoint 1 time per second with a burst up to 5. Rate limited requests will return a 429 status code.