Slack.Web.Apps.Datastore (SlackKit v1.0.0-alpha.0)

View Source

Summary

Functions

Delete items from a datastore in bulk

Get items from a datastore in bulk

Creates or replaces existing items in bulk

Count the number of items in a datastore that match a query

Delete an item from a datastore

Get an item from a datastore

Creates a new item, or replaces an old item with a new item.

Query a datastore for items

Edits an existing item's attributes, or adds a new item if it does not already exist.

Functions

bulk_delete(datastore, ids, optional_params \\ %{})

Delete items from a datastore in bulk

API reference

Rate limit: Tier 3: 50+ per minute
Scopes:

View on docs.slack.dev ↗

Required Params

  • datastore - name of the datastore
  • ids - IDs of items to be deleted ex: ["7c6dd137", "c7d6d731"]

Optional Params

  • app_id -

Errors the API can return:

  • app_not_hosted - The app developer is not using a Slack-hosted environment. App datastores are exclusively available for Slack-hosted apps.
  • datastore_error - Datastore error
  • datastore_migration_in_progress - The datastore is currently unavailable due to an in progress Enterprise org migration.
  • free_team_not_allowed - Datastore put not allowed on a free team.
  • invalid_app_id - The app_id provided is not valid for team and user.
  • invalid_datastore - The provided datastore is invalid.
  • partial_failure - some items failed to be deleted
  • restricted_plan_level - Feature is not available on this team
  • team_quota_exceeded - Total number of requests exceeded team quota.
  • unknown_method - This method does not exist

See the Common Errors guide for errors returned by every Web API method.

bulk_get(datastore, ids, optional_params \\ %{})

Get items from a datastore in bulk

API reference

Rate limit: Tier 3: 50+ per minute
Scopes:

View on docs.slack.dev ↗

Required Params

  • datastore - name of the datastore
  • ids - items' ids ex: ["7c6dd137", "c7d6d731"]

Optional Params

  • app_id -

Errors the API can return:

  • app_not_hosted - The app developer is not using a Slack-hosted environment. App datastores are exclusively available for Slack-hosted apps.
  • datastore_error - Datastore error
  • datastore_migration_in_progress - The datastore is currently unavailable due to an in progress Enterprise org migration.
  • free_team_not_allowed - Datastore put not allowed on a free team.
  • invalid_app_id - The app_id provided is not valid for team and user.
  • invalid_datastore - The provided datastore is invalid.
  • partial_failure - some items failed to be retrieved
  • restricted_plan_level - Feature is not available on this team
  • team_quota_exceeded - Total number of requests exceeded team quota.
  • unknown_method - This method does not exist

See the Common Errors guide for errors returned by every Web API method.

bulk_put(datastore, items, optional_params \\ %{})

Creates or replaces existing items in bulk

API reference

Rate limit: Tier 3: 50+ per minute
Scopes:

View on docs.slack.dev ↗

Required Params

  • datastore - name of the datastore
  • items - attribute names and values of the items; limit of 25 ex: [{"id": "7c6dd137", "favourite_meal": "Shawarma", "reason": "Who doesn't like Shawarma?"}]

Optional Params

  • app_id -

Errors the API can return:

  • app_not_hosted - The app developer is not using a Slack-hosted environment. App datastores are exclusively available for Slack-hosted apps.
  • datastore_error - Datastore error
  • datastore_migration_in_progress - The datastore is currently unavailable due to an in progress Enterprise org migration.
  • free_team_not_allowed - Datastore put not allowed on a free team.
  • invalid_app_id - The app_id provided is not valid for team and user.
  • invalid_datastore - The provided datastore is invalid.
  • partial_failure - some items failed to be updated
  • restricted_plan_level - Feature is not available on this team
  • team_quota_exceeded - Total number of requests exceeded team quota.
  • unknown_method - This method does not exist

See the Common Errors guide for errors returned by every Web API method.

count(datastore, optional_params \\ %{})

Count the number of items in a datastore that match a query

API reference

Rate limit: Tier 3: 50+ per minute
Scopes:

View on docs.slack.dev ↗

Required Params

  • datastore - Name of the datastore

Optional Params

  • app_id - Required if calling with user token
  • expression - A query filter expression ex: #artist = :artist_name
  • expression_attributes - A map of attributes referenced in expression ex: { "#artist": "artist" }
  • expression_values - A map of values referenced in expression ex: { ":artist_name": "Fred Rogers" }

Errors the API can return:

  • app_not_hosted - The app developer is not using a Slack-hosted environment. App datastores are exclusively available for Slack-hosted apps.
  • datastore_error - Datastore error
  • datastore_migration_in_progress - The datastore is currently unavailable due to an in progress Enterprise org migration.
  • free_team_not_allowed - Datastore query not allowed on a free team.
  • invalid_app_id - The app_id provided is not valid for team and user.
  • invalid_datastore - The provided datastore is invalid.
  • restricted_plan_level - Feature is not available on this team
  • team_quota_exceeded - Total number of requests exceeded team quota.

See the Common Errors guide for errors returned by every Web API method.

delete(datastore, id, optional_params \\ %{})

Delete an item from a datastore

API reference

Rate limit: Tier 4: 100+ per minute
Scopes:

View on docs.slack.dev ↗

Required Params

  • datastore - name of the datastore
  • id - item id

Optional Params

  • app_id -

Errors the API can return:

  • app_not_hosted - The app developer is not using a Slack-hosted environment. App datastores are exclusively available for Slack-hosted apps.
  • datastore_error - Datastore error
  • datastore_migration_in_progress - The datastore is currently unavailable due to an in progress Enterprise org migration.
  • free_team_not_allowed - Datastore delete not allowed on a free team.
  • invalid_app_id - The app_id provided is not valid for team and user.
  • invalid_datastore - The provided datastore is invalid.
  • restricted_plan_level - Feature is not available on this team

See the Common Errors guide for errors returned by every Web API method.

get(datastore, id, optional_params \\ %{})

Get an item from a datastore

API reference

Rate limit: Tier 4: 100+ per minute
Scopes:

View on docs.slack.dev ↗

Required Params

  • datastore - name of the datastore
  • id - item id

Optional Params

  • app_id -

Errors the API can return:

  • app_not_hosted - The app developer is not using a Slack-hosted environment. App datastores are exclusively available for Slack-hosted apps.
  • datastore_error - Datastore error.
  • datastore_migration_in_progress - The datastore is currently unavailable due to an in progress Enterprise org migration.
  • free_team_not_allowed - Datastore get not allowed on a free team.
  • invalid_app_id - The app_id provided is not valid for team and user.
  • invalid_datastore - The provided datastore is invalid.
  • restricted_plan_level - Feature is not available on this team
  • team_quota_exceeded - Total number of requests exceeded team quota.

See the Common Errors guide for errors returned by every Web API method.

put(datastore, item, optional_params \\ %{})

Creates a new item, or replaces an old item with a new item.

API reference

Rate limit: Tier 4: 100+ per minute
Scopes:

View on docs.slack.dev ↗

Required Params

  • datastore - name of the datastore
  • item - attribute names and values of the item

Optional Params

  • app_id -

Errors the API can return:

  • app_not_hosted - The app developer is not using a Slack-hosted environment. App datastores are exclusively available for Slack-hosted apps.
  • datastore_error - Datastore error
  • datastore_migration_in_progress - The datastore is currently unavailable due to an in progress Enterprise org migration.
  • free_team_not_allowed - Datastore put not allowed on a free team.
  • invalid_app_id - The app_id provided is not valid for team and user.
  • invalid_datastore - The provided datastore is invalid.
  • restricted_plan_level - Feature is not available on this team
  • team_quota_exceeded - Total number of requests exceeded team quota.

See the Common Errors guide for errors returned by every Web API method.

query(datastore, optional_params \\ %{})

Query a datastore for items

API reference

Rate limit: Tier 4: 100+ per minute
Scopes:

View on docs.slack.dev ↗

Required Params

  • datastore - Name of the datastore

Optional Params

  • app_id - Required if calling with user token
  • cursor - Set cursor to next_cursor returned by the previous call to list items in the next page ex: 5c3e53d5
  • expression - A query filter expression ex: #artist = :artist_name
  • expression_attributes - A map of attributes referenced in expression ex: { "#artist": "artist" }
  • expression_values - A map of values referenced in expression ex: { ":artist_name": "Fred Rogers" }
  • limit - The maximum number of items to evaluate for a given request (not necessarily the number of matching items). If the given request dataset size exceeds 1 MB before reaching the limit, the returned item count will likely be less than the limit. In any case where there are more items available beyond an imposed limit, a next_cursor value will be provided for use in subsequent requests. ex: 100

Errors the API can return:

  • app_not_hosted - The app developer is not using a Slack-hosted environment. App datastores are exclusively available for Slack-hosted apps.
  • datastore_error - Datastore error
  • datastore_migration_in_progress - The datastore is currently unavailable due to an in progress Enterprise org migration.
  • free_team_not_allowed - Datastore query not allowed on a free team.
  • invalid_app_id - The app_id provided is not valid for team and user.
  • invalid_datastore - The provided datastore is invalid.
  • restricted_plan_level - Feature is not available on this team
  • team_quota_exceeded - Total number of requests exceeded team quota.

See the Common Errors guide for errors returned by every Web API method.

update(datastore, item, optional_params \\ %{})

Edits an existing item's attributes, or adds a new item if it does not already exist.

API reference

Rate limit: Tier 4: 100+ per minute
Scopes:

View on docs.slack.dev ↗

Required Params

  • datastore - name of the datastore
  • item - attribute names and values to be updated

Optional Params

  • app_id -

Errors the API can return:

  • app_not_hosted - The app developer is not using a Slack-hosted environment. App datastores are exclusively available for Slack-hosted apps.
  • datastore_error - Datastore error
  • datastore_migration_in_progress - The datastore is currently unavailable due to an in progress Enterprise org migration.
  • free_team_not_allowed - Datastore put not allowed on a free team.
  • invalid_app_id - The app_id provided is not valid for team and user.
  • invalid_datastore - The provided datastore is invalid.
  • restricted_plan_level - Feature is not available on this team
  • team_quota_exceeded - Total number of requests exceeded team quota.

See the Common Errors guide for errors returned by every Web API method.