slackapi/python-slack-sdk

Fix next_cursor Flag in SlackResponse

lre12 opened this issue · 5 comments

In the SlackResponse, the presence of the next_cursor is determined by the _next_cursor_is_present method.
In most APIs, the next_cursor is returned as an empty string ("") as seen in _next_cursor_is_present.
However, in some APIs, the next_cursor is returned as null. To handle this situation, I would like to make modifications to the _next_cursor_is_present method.

example) slackbot.responses.list

Category (place an x in each of the [ ])

  • slack_sdk.web.WebClient (sync/async) (Web API client)
  • slack_sdk.webhook.WebhookClient (sync/async) (Incoming Webhook, response_url sender)
  • slack_sdk.models (UI component builders)
  • slack_sdk.oauth (OAuth Flow Utilities)
  • slack_sdk.socket_mode (Socket Mode client)
  • slack_sdk.audit_logs (Audit Logs API client)
  • slack_sdk.scim (SCIM API client)
  • slack_sdk.rtm (RTM client)
  • slack_sdk.signature (Request Signature Verifier)

Requirements

Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you are agreeing to those rules.

Hello @lre12 thanks for writing in 💯

Contributions to the project are always greatly appreciated 🥇 take a look at our creating-a-pull-request docs for information on this

Before proceeding would you be able to outline which APIs return next_cursor as null

@lre12 Could you share a bit more details about slackbot.responses.list, which you mentioned as an example? This SDK does not offer such a method.

I am using the Slack enterprise called tossteam. So, please understand that I have only used it as an enterprise.

example code)

from slack_sdk import WebClient

token = "xoxc-XXXXXXXXXXX"
cookie = "d=xoxd-XXXXXXXXXXXXX"

client = WebClient(
    base_url="https://tossteam.slack.com",
    token=token,
    headers={"cookie": cookie}
)
list(client.api_call("slackbot.responses.list", data={"limit": 1000}))

The token and cookie were obtained from the enterprise admin site.
ex) https://tossteam.slack.com/admin

@lre12 Thanks for your response. Now I understand your point. You're attempting to use this SDK to call an endpoint that is not available for 3rd party apps. (Indeed, you can call slackbot.responses.list when you use an xoxc- prefix token that you obtained from the Slack client app or web browser, but this functionality is not publicly available).

We're willing to make the code even more robust for potential future changes on the public platform, but we do not support your specific use case with private/hidden APIs. We would appreciate it if you could understand this.

Ah, I understand. Thank you.