Pure inbound-payload builders for unit-testing your Slack endpoints.
These build the exact payloads Slack (and Slackbox.Simulator) POST to your
app — block_actions, view_submission, and Events API event_callback
envelopes — so you can drive your controllers/plugs directly, no UI or HTTP
server required. They delegate to the Slackbox.Simulator.build_* functions,
so the shapes stay identical to the live simulation loop.
Example
payload = Slackbox.Test.block_actions(action_id: "retry", user: "U1", channel: "#alerts")
conn = post(conn, "/slack/interactivity", Slackbox.Test.form_body(payload))For the Events API, POST the JSON directly instead:
payload = Slackbox.Test.event("app_mention", %{"text" => "<@U_BOT> hi"})
conn = post(conn, "/slack/events", Jason.encode!(payload))
Summary
Functions
Build a block_actions payload.
Build an Events API event_callback payload wrapping an event of type.
Encode payload as an application/x-www-form-urlencoded body for
interaction endpoints (payload=<json>).
Build Slack signing headers (x-slack-request-timestamp + x-slack-signature)
for body under secret, for tests that verify signature checking.
Build a view_submission payload.
Functions
Build a block_actions payload.
Options: :action_id, :value, :user (default "U_TEST"), :channel
(default "#test"), :message (default a minimal raw message map),
:response_url (default "https://example.test/response").
Build an Events API event_callback payload wrapping an event of type.
opts (a keyword list or map) is merged, with string keys, into the event.
Encode payload as an application/x-www-form-urlencoded body for
interaction endpoints (payload=<json>).
Build Slack signing headers (x-slack-request-timestamp + x-slack-signature)
for body under secret, for tests that verify signature checking.
Build a view_submission payload.
Options: :callback_id, :view_id (default "V_TEST"), :state
(default %{}), :user (default "U_TEST").