Web API calls, pagination and error handling
How to call Slack Web API methods correctly: RPC-style method URLs, token placement, JSON body rules, reading ok and error instead of the HTTP status, cursor pagination that stops only on an empty next_cursor, conversation types and scopes, and fixing common chat.postMessage errors.
Implement the Web API in your app.
~7 min read · 8 practice questions ·
What the exam expects
- Address a Web API method by its RPC-style URL and send its arguments in a format Slack accepts.
- Apply the JSON body rules: explicit
Content-type: application/json, bearer token in theAuthorizationheader, one argument style per request, an object rather than an array. - Detect failure from the
okboolean and theerrorcode, not from the HTTP status, and tell errors from warnings. - Write a cursor pagination loop that ends only when
next_cursoris empty, null or missing. - Get the right conversations from
conversations.listwith thetypesargument and matching scopes, and fixnot_in_channeland missing notification text onchat.postMessage.
Key terms: method (a Web API operation such as conversations.create), bearer token (the token sent as Authorization: Bearer xoxb-...), ok/error (the success flag and machine-readable failure code in every response), cursor (the next_cursor pointer to the next page), conversation types (public_channel, private_channel, mpim, im).
Key facts
- Detail
https://slack.com/api/METHOD_FAMILY.method, not REST
- Detail
Authorizationheader preferred; never a query parameter
- Detail
- Must be a bearer token in the header, not a JSON attribute
- Detail
- Returns
json_not_object
- Detail
- Top-level
ok;erroron failure;warningwithok: true
- Detail
next_cursorempty, null or missing
- Detail
- Recommend 100-200; maximum 1000, may vary per method
conversations.list default- Detail
typesdefaults topublic_channel
- Detail
- Need
groups:read
- Detail
chat:write.publicfor public channels
text with blocks- Detail
- Fallback for notifications and screen readers
Sources for this section (5)
- Why does a Web API call that returns HTTP 200 still need inspection?
- When is a cursor-paginated collection finished?
- Which error does a JSON array body return?
- Why might `conversations.list` return only public channels for a bot invited to private ones?
- When does a bot get `not_in_channel`, and what are the two fixes?
The questions are free to read. Answers with their sources and self-grading are included with the pack.
Keep reading with the Slack Developer pack
- Core concepts
- Exam traps
- Worked scenario
The pack includes:
- All 38 lessons of the Slack Developer guide, with reading progress
- Interactive decision walks and step-by-step sequence steppers
- Inline practice questions and one-click topic practice (8 questions for this lesson)
- An official source cited for every claim
- An AI tutor that answers from the guide
- Unlimited timed practice exams