Skip to content

Call the Slack API

POST
/api/v1/integrations/slack/request
curl --request POST \
--url https://digize.com/api/v1/integrations/slack/request \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: 5f1c2a8e-3b7d-4c55-9a0e-1f2d3c4b5a69' \
--header 'x-api-key: <x-api-key>' \
--data '{ "method": "GET", "url": "example", "query": { "additionalProperty": [ "example" ] }, "headers": { "additionalProperty": "example" }, "body": "example", "content": { "upload": "example", "range": { "first": 1, "last": 1 }, "text": "example", "type": "example" }, "files": [ { "field": "example", "upload": "example", "range": { "first": 1, "last": 1 }, "filename": "example" } ] }'

Calls Slack’s own API on the workspace’s behalf, signed in with its Slack connection, and returns what Slack answered: any endpoint the connection reaches, with any method, query and body. Slack’s errors come back as its answer, with their status. A file goes by upload: put it with integrations.files.createUpload, then name it in content (the whole body), files (a multipart form), either with a range of its bytes, or as { “$upload”: id } inside body (base64 in JSON). A file Slack answers with comes back as base64, and the answer has Slack’s headers. The Web API at https://slack.com/api, one method per path, such as GET /conversations.list or POST /chat.postMessage with a JSON body, as the workspace’s bot (it can post, and list channels). Methods named …list, …info, …history, …replies, …members or get… only read. An answer’s ok is false when Slack refused it.

Needs the settings:write permission.

Idempotency-Key
string
>= 1 characters <= 255 characters

Makes the request safe to send again: for 24 hours the same key and request answer the first response without repeating the change.

Example

5f1c2a8e-3b7d-4c55-9a0e-1f2d3c4b5a69
Media typeapplication/json
object
method

The endpoint’s method.

string
default: GET
Allowed values: GET POST PUT PATCH DELETE
url
required

A full URL under one of the API’s base URLs, or a path starting with /, which goes after the first.

string
>= 1 characters <= 4000 characters
query

Query parameters, added to any already in the URL.

object
key
additional properties
Any of:
string
headers

Only headers the description says a call may set. The call is signed in without any.

object
key
additional properties
string
body

The body: JSON, or a form’s fields for an API that takes forms. A value { “$upload”: “” } is swapped for that upload’s bytes as base64, or { “$upload”: “”, “as”: “dataUrl” } for a data URL, for APIs that take a file inside JSON, up to 10 MB in all. With files, an object field goes as a JSON part.

content

The whole body, sent exactly as given instead of body: an upload’s file, such as a PDF PUT to Click2Mail’s Batch API, or text. Give upload or text.

object
upload

An upload’s id, from integrations.files.createUpload.

string
/^upload_[0-9A-HJKMNP-TV-Z]{26}$/
range

Only these bytes of the upload, both included, such as a LinkedIn video part’s firstByte and lastByte, or a chunk of a resumable upload. Left out, the whole file.

object
first
required

The first byte, from 0.

integer
<= 9007199254740991
last
required

The last byte, included.

integer
<= 9007199254740991
text

Text, such as XML. Past 200,000 characters, upload it.

string
<= 200000 characters
type

The body’s content type, such as application/xml. Text needs one; an upload goes as the type it was uploaded with unless this says.

string
<= 200 characters
files

Uploaded files, sent as multipart/form-data with body‘s fields as the form’s other fields, such as Click2Mail’s /molpro/documents upload. A field whose value is an object goes as a JSON part, as QuickBooks’ and Salesforce’s uploads take a file’s details.

Array<object>
>= 1 items <= 10 items
object
field
required

The form field it goes in, such as file.

string
>= 1 characters <= 100 characters
upload
required

An upload’s id, from integrations.files.createUpload.

string
/^upload_[0-9A-HJKMNP-TV-Z]{26}$/
range

Only these bytes of the upload, both included, such as a LinkedIn video part’s firstByte and lastByte, or a chunk of a resumable upload. Left out, the whole file.

object
first
required

The first byte, from 0.

integer
<= 9007199254740991
last
required

The last byte, included.

integer
<= 9007199254740991
filename

The file’s name as the service sees it. Defaults to the name it was uploaded with.

string
>= 1 characters <= 200 characters

Done

Media typeapplication/json
object
status
required

The service’s HTTP status. A refusal comes back like any answer, with what the service said in body, rather than as an error.

integer
>= -9007199254740991 <= 9007199254740991
contentType
required
string | null
body
required

JSON as parsed, or text. Past 1000000 characters it’s the answer’s start as text and truncated is true: ask for less, such as fewer fields or a smaller page. Secrets in it, such as access tokens and passwords, are hidden.

truncated
required
boolean
binary
required

The answer is a file, such as a PDF: body is its bytes as base64, up to 10 MB. Past that body is null and truncated is true.

boolean
location
required

Where a redirect points. It isn’t followed.

string | null
headers
required

The service’s answer’s headers, named in lowercase, without cookies: an upload part’s etag, a Link to the next page, a resumable upload’s range.

object
key
additional properties
string

Example generated

{
"status": 1,
"contentType": "example",
"body": "example",
"truncated": true,
"binary": true,
"location": "example",
"headers": {
"additionalProperty": "example"
}
}

What was sent isn’t valid (invalid).

Media typeapplication/json
object
error
required
object
code
required
string
Allowed values: invalid unauthorized forbidden not_found conflict too_large rate_limited unavailable internal
message
required
string
details
object
key
additional properties
any

Example

{
"error": {
"code": "invalid"
}
}

No key, or one that’s unknown, off or expired.

Media typeapplication/json
object
error
required
object
code
required
string
Allowed values: invalid unauthorized forbidden not_found conflict too_large rate_limited unavailable internal
message
required
string
details
object
key
additional properties
any

Example

{
"error": {
"code": "invalid"
}
}

The key doesn’t have the permission this needs.

Media typeapplication/json
object
error
required
object
code
required
string
Allowed values: invalid unauthorized forbidden not_found conflict too_large rate_limited unavailable internal
message
required
string
details
object
key
additional properties
any

Example

{
"error": {
"code": "invalid"
}
}

Nothing has that id (not_found).

Media typeapplication/json
object
error
required
object
code
required
string
Allowed values: invalid unauthorized forbidden not_found conflict too_large rate_limited unavailable internal
message
required
string
details
object
key
additional properties
any

Example

{
"error": {
"code": "invalid"
}
}

A request with the same Idempotency-Key is still running (conflict).

Media typeapplication/json
object
error
required
object
code
required
string
Allowed values: invalid unauthorized forbidden not_found conflict too_large rate_limited unavailable internal
message
required
string
details
object
key
additional properties
any

Example

{
"error": {
"code": "invalid"
}
}

The Idempotency-Key was used with a different request.

Media typeapplication/json
object
error
required
object
code
required
string
Allowed values: invalid unauthorized forbidden not_found conflict too_large rate_limited unavailable internal
message
required
string
details
object
key
additional properties
any

Example

{
"error": {
"code": "invalid"
}
}

Over the rate limit; see retry-after.

Media typeapplication/json
object
error
required
object
code
required
string
Allowed values: invalid unauthorized forbidden not_found conflict too_large rate_limited unavailable internal
message
required
string
details
object
key
additional properties
any

Example

{
"error": {
"code": "invalid"
}
}