Getting BitClout user Notification through public key

Getting BitClout user Notification through public key

·

2 min read

One of the most fascinating part about BitClout is that it offers way too transparency than any other social media could ever offer. You can imagine the level of transparency when you can even lurk into someone's notification. Interesting right ?

This article is about how one can get notification of any user. As always, this article requires you to have basic knowledge of python atleast.

Below is python code that fetches notification using the public key passed.

import json
import requests
def getNotificationByKey(publicKey, order, numToFetch):
  payload= {"PublicKeyBase58Check":publicKey,"FetchStartIndex":order,"NumToFetch":numToFetch}
  response = requests.post(url="https://bitclout.com/api/v0/get-notifications", json=payload)

  file = open("Notification.json", "w")
  json.dump(response.json(), file)
  file.close()
  return response.status_code

if __name__ == "__main__":
  publicKey = "BC1YLhBLE1834FBJbQ9JU23JbPanNYMkUsdpJZrFVqNGsCe7YadYiUg"
  order = -1 # -1 will return notifications in latest order while 0 will return in oldest order
  numToFetch = 20 #simply means the number of notifications you want to fetch.
  print(getNotificationByKey(publicKey, order, numToFetch))

If the above code prints status code 200, you can see a new file created named "Notification.json" which has the notifications of that user in the desired order. You can study the file to learn more about the format of the data!

You can get notification in your desired order. If you set the order to 0, you will get notifications from old to latest order while a value of -1 means latest to oldest order.

If you like the article don't forget to let us know in the comments or maybe give a shout to DevsClout ? You can also join DevsClout discord server to chat with more devs who are building awesome projects on BitClout! We would love to hear back from you!