API & SDK

Here we demonstrate how to make an API call to retrieve the most recent activity of vitalik.eth.

We use direction=out to retrieve activities that are initiated by this address. It is a useful parameter to filter out spam activities.

curl https://mainnet.rss3.io/decentralized/accounts/vitalik.eth/activities?limit=1&direction=out

The result, at the time of writing, looks like:

{
  "data": [
    {
      "owner": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",
      "id": "0x000000000000000000000000ff70bc918b473c46868c119876f011dbb81f2e86",
      "network": "farcaster",
      "from": "0xADD746Be46fF36f10C81d6e3Ba282537f4c68077",
      "to": "0xAF82c0220bd5e11182aC1EE3A504f4045BBebc6d",
      "tag": "social",
      "type": "comment",
      "platform": "Farcaster",
      "status": "successful",
      "direction": "out",
      "actions": [
        {
          "tag": "social",
          "type": "comment",
          "platform": "Farcaster",
          "from": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",
          "to": "0x70a8283A2209b3F4E8C93639D94724b905e1b612",
          "metadata": {
            "handle": "vitalik.eth",
            "body": "Not everyone is a visionary builder. Often you really do just want 5 data points on whether A feels more right or B, or if there is some C you have not considered.",
            "profile_id": "5650",
            "publication_id": "0xFf70BC918B473c46868c119876F011DbB81F2e86",
            "target": {
              "handle": "sui",
              "body": "Opinion doesn’t matter if they don’t know what they’re building and what’s their vision.",
              "profile_id": "2252",
              "publication_id": "0x7c05A2e5eF56EcdB87A8f25Ca6342F54f9398F4F"
            }
          }
        },
        {
          "tag": "social",
          "type": "comment",
          "platform": "Farcaster",
          "from": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",
          "to": "0x0eA205bF08cc628E15B795794bD9593424BAE9F6",
          "metadata": {
            "handle": "vitalik.eth",
            "body": "Not everyone is a visionary builder. Often you really do just want 5 data points on whether A feels more right or B, or if there is some C you have not considered.",
            "profile_id": "5650",
            "publication_id": "0xFf70BC918B473c46868c119876F011DbB81F2e86",
            "target": {
              "handle": "sui",
              "body": "Opinion doesn’t matter if they don’t know what they’re building and what’s their vision.",
              "profile_id": "2252",
              "publication_id": "0x7c05A2e5eF56EcdB87A8f25Ca6342F54f9398F4F"
            }
          }
        },
        {
          "tag": "social",
          "type": "comment",
          "platform": "Farcaster",
          "from": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",
          "to": "0x09765E9D82B019eB0Bfe91Cbe2e472aAB9a142a8",
          "metadata": {
            "handle": "vitalik.eth",
            "body": "Not everyone is a visionary builder. Often you really do just want 5 data points on whether A feels more right or B, or if there is some C you have not considered.",
            "profile_id": "5650",
            "publication_id": "0xFf70BC918B473c46868c119876F011DbB81F2e86",
            "target": {
              "handle": "sui",
              "body": "Opinion doesn’t matter if they don’t know what they’re building and what’s their vision.",
              "profile_id": "2252",
              "publication_id": "0x7c05A2e5eF56EcdB87A8f25Ca6342F54f9398F4F"
            }
          }
        }
      ],
      "timestamp": 1695512826
    }
  ],
  "meta": {
    "cursor": "0x000000000000000000000000ff70bc918b473c46868c119876f011dbb81f2e86:farcaster"
  }
}

Since a Farcaster account can be linked to multiple EVM addresses, it is possible for the comment to appear multiple times (for instance, user sui has more than one addresses). You can use handle in metadata to determine the usernames and use those accordingly.

🥳 There you go, you just made your 1st RSS3 DSL call.

Refer to DSL API for the complete OpenAPI doc.

RSS3 SDK for JavaScript

Installation

npm i @rss3/js-sdk
pnpm i @rss3/js-sdk
yarn add @rss3/js-sdk

Getting Started

Obtain Data from the RSS3 DSL

Get open social activities of anyone, here we get vitalik.eth's comments on farcaster:

import { dataClient } from '@rss3/js-sdk'

const socialActivities = await dataClient().activities('vitalik.eth', {
  tag: ['social'],
  type: ['comment'],
  platform: ['farcaster'],
})

Or simply query cross-network and human-readable feed of anyone:

import { dataClient } from '@rss3/js-sdk'

const readableFeed = await dataClient().activities('0xd8da6bf26964af9d7eed9e03e53415d37aa96045')

Perform Searches on the RSS3 DSL

Search for keyword Ethereum across over 100 blockchains, networks and applications:

import { searchClient } from '@rss3/js-sdk'

const searchResults = await searchClient().activities({
  keyword: 'Ethereum',
})

Or on a specific platform like mirror:

import { searchClient } from '@rss3/js-sdk'

const searchResults = await searchClient().activities({
  keyword: 'Ethereum',
  platform: ['mirror'],
})