Fetch notifications overview
These APIs are useful for fetching list of all notification (inbox or spam) of a user in a paginated manner.
Notification list API
- js
// userAlice.notification.list(type, {options?})
const inboxNotifications = await userAlice.notification.list("INBOX");
Notification list parameters
Param | Type | Subtype | Default | Remarks |
---|---|---|---|---|
type | INBOX or SPAM | - | INBOX | A string representing the type of feed to retrieve. |
options | object | - | - | An object containing additional options for filtering and pagination. |
- | options.account | string | - | Account supports a number of address format including wallet addresses, chain agnostic wallet addresses, NFT addresses, etc |
- | options.channels | string[] | - | An array of channels to filter feeds by. |
- | options.page | number | 1 | A number representing the page of results to retrieve. |
- | options.limit | number | 10 | A number representing the maximum number of feeds to retrieve per page. |
- | options.raw | boolean | False | A boolean indicating whether to retrieve raw feed data. |
Note: Parameters
in this style
are mandatory.
Expected response
[
{
cta: "",
title: "test",
message: "test",
icon: "https://gateway.ipfs.io/ipfs/bafybeib76bmkscu6efwawi2tkltdgthwrpny2ok7lur7nltffgydiq7ruy/QmVaY4HQaorrMhKo1sHk7FM1B8Xi1JnT3DvJbG9Xv7VeLZ",
url: "https://google.com",
sid: "1922",
app: "Updated Name",
image: "",
blockchain: "ETH_TEST_GOERLI",
notification: { body: "test", title: "Updated Name - test" },
secret: "",
},
{
cta: "",
title: "test",
message: "test",
icon: "https://gateway.ipfs.io/ipfs/bafybeib76bmkscu6efwawi2tkltdgthwrpny2ok7lur7nltffgydiq7ruy/QmVaY4HQaorrMhKo1sHk7FM1B8Xi1JnT3DvJbG9Xv7VeLZ",
url: "https://google.com",
sid: "1435",
app: "Updated Name",
image: "",
blockchain: "ETH_TEST_GOERLI",
notification: { body: "test", title: "Updated Name - test" },
secret: "",
},
{
cta: "",
title: "test",
message: "test",
icon: "https://gateway.ipfs.io/ipfs/bafybeib76bmkscu6efwawi2tkltdgthwrpny2ok7lur7nltffgydiq7ruy/QmVaY4HQaorrMhKo1sHk7FM1B8Xi1JnT3DvJbG9Xv7VeLZ",
url: "https://google.com",
sid: "1432",
app: "Updated Name",
image: "",
blockchain: "ETH_TEST_GOERLI",
notification: { body: "test", title: "Updated Name - test" },
secret: "",
},
];
Fetch channel specific notifications API
This API is useful for fetching the list of all notifications sent from a channel. Useful for fetching notifications for a specific channel.
- js
// userAlice.channel.notifications(channelAddress, {options?})
const allNotifications = await userAlice.channel.notifications(channelAddress);
Fetch Notifications by Channel API
Param | Type | Subtype | Default | Remarks |
---|---|---|---|---|
channelAddress | string | - | - | Channel address that you want fetch notifications for, Account supports a number of address format including wallet addresses, chain agnostic wallet addresses, NFT addresses, etc |
options | object | - | - | An object containing additional options for filtering and pagination. |
- | options.page | number | 1 | A number representing the page of results to retrieve. |
- | options.limit | number | 10 | A number representing the maximum number of feeds to retrieve per page. |
- | options.raw | boolean | False | A boolean indicating whether to retrieve raw feed data. |
- | options.filter | string | - | Filter the notifications by their type. Accepts CONSTANTS.NOTIFICATION.TYPE.BROADCAST , CONSTANTS.NOTIFICATION.TYPE.SUBSET , CONSTANTS.NOTIFICATION.TYPE.TARGETTED |
Note: Parameters
in this style
are mandatory.
Expected response
{
feeds: [
{
payload_id: 4714471,
sender: '0x90A48D5CF7343B08dA12E067680B4C6dbfE551Be',
epoch: '2023-12-11T16:33:16.000Z',
payload: [Object],
source: 'ETH_MAINNET',
etime: null
},
{
payload_id: 4714469,
sender: '0x90A48D5CF7343B08dA12E067680B4C6dbfE551Be',
epoch: '2023-12-11T16:31:44.000Z',
payload: [Object],
source: 'ETH_MAINNET',
etime: null
},
{
payload_id: 4710921,
sender: '0x90A48D5CF7343B08dA12E067680B4C6dbfE551Be',
epoch: '2023-12-08T18:03:16.000Z',
payload: [Object],
source: 'ETH_MAINNET',
etime: null
},
{
payload_id: 4710908,
sender: '0x90A48D5CF7343B08dA12E067680B4C6dbfE551Be',
epoch: '2023-12-08T18:02:03.000Z',
payload: [Object],
source: 'ETH_MAINNET',
etime: null
},
{
payload_id: 4497176,
sender: '0x90A48D5CF7343B08dA12E067680B4C6dbfE551Be',
epoch: '2023-08-11T18:30:08.000Z',
payload: [Object],
source: 'ETH_MAINNET',
etime: null
},
{
payload_id: 4487454,
sender: '0x90A48D5CF7343B08dA12E067680B4C6dbfE551Be',
epoch: '2023-07-28T18:41:41.000Z',
payload: [Object],
source: 'ETH_MAINNET',
etime: null
},
{
payload_id: 4487453,
sender: '0x90A48D5CF7343B08dA12E067680B4C6dbfE551Be',
epoch: '2023-07-28T18:40:04.000Z',
payload: [Object],
source: 'ETH_MAINNET',
etime: null
},
{
payload_id: 4459720,
sender: '0x90A48D5CF7343B08dA12E067680B4C6dbfE551Be',
epoch: '2023-07-10T16:45:25.000Z',
payload: [Object],
source: 'ETH_MAINNET',
etime: null
},
{
payload_id: 4444690,
sender: '0x90A48D5CF7343B08dA12E067680B4C6dbfE551Be',
epoch: '2023-06-30T17:19:05.000Z',
payload: [Object],
source: 'ETH_MAINNET',
etime: null
},
{
payload_id: 4438184,
sender: '0x90A48D5CF7343B08dA12E067680B4C6dbfE551Be',
epoch: '2023-06-26T19:03:49.000Z',
payload: [Object],
source: 'ETH_MAINNET',
etime: null
}
],
itemcount: 85693
}