Skip to content

xhs_get_notifications

Get account notifications (comments, likes, new followers).

Parameters

ParameterTypeRequiredDescription
accountstringNoAccount to use
typestringNoNotification type (default: all)
limitnumberNoPer-type limit (default: 20, max: 100)

type options

ValueDescription
allAll notifications (default)
mentionsComments and replies
likesLike notifications
connectionsNew followers

Response

json
{
  "account": "account-name",
  "success": true,
  "unreadCount": 5,
  "counts": {
    "mentions": 3,
    "likes": 10,
    "connections": 2
  },
  "mentions": [
    {
      "id": "notification-id",
      "type": "comment",
      "title": "Notification title",
      "time": "2024-01-01T00:00:00Z",
      "user": {
        "userId": "user-id",
        "nickname": "Username",
        "avatar": "avatar-url"
      },
      "noteId": "note-id",
      "xsecToken": "token",
      "commentId": "comment-id",
      "commentContent": "Comment content"
    }
  ],
  "likes": [...],
  "connections": [...]
}

Examples

Get all notifications

xhs_get_notifications()

Get only comment notifications

xhs_get_notifications({
  type: "mentions",
  limit: 50
})

Notes

  • Returned noteId and xsecToken can be used for replying
  • commentId can be used with xhs_reply_comment

Released under the MIT License.