Class Context

java.lang.Object
com.slack.api.bolt.context.Context
Direct Known Subclasses:
ActionContext, AttachmentActionContext, BlockSuggestionContext, DefaultContext, DialogCancellationContext, DialogSubmissionContext, DialogSuggestionContext, EventContext, GlobalShortcutContext, MessageShortcutContext, OAuthCallbackContext, SlashCommandContext, ViewSubmissionContext, WorkflowStepEditContext, WorkflowStepExecuteContext, WorkflowStepSaveContext

public abstract class Context extends Object
Represents a context behind a request from Slack API.
  • Field Details

    • slack

      protected Slack slack
    • logger

      public final org.slf4j.Logger logger
    • enterpriseId

      protected String enterpriseId
      Organization ID for Enterprise Grid.
    • teamId

      protected String teamId
      Workspace ID.
    • enterpriseInstall

      protected boolean enterpriseInstall
      Returns true if the token is issued by an enterprise install (= org-level installation)
    • botToken

      protected String botToken
      A bot token associated with this request. The format must be starting with `xoxb-`.
    • functionBotAccessToken

      protected String functionBotAccessToken
      The bot token associated with this "function_executed"-type event and its interactions. The format must be starting with `xoxb-`.
    • functionExecutionId

      protected String functionExecutionId
      The ID of function_executed event delivery.
    • botScopes

      protected List<String> botScopes
      The scopes associated to the botToken
    • botId

      protected String botId
      bot_id associated with this request.
    • botUserId

      protected String botUserId
      Bot user's user_id associated with this request.
    • requestUserId

      protected String requestUserId
      The user's ID associated with this request.
    • requestUserToken

      protected String requestUserToken
      The user token that is associated with the request user ID.
    • requestUserScopes

      protected List<String> requestUserScopes
      The scopes associated to the requestUserToken
    • authTestResponse

      protected AuthTestResponse authTestResponse
      The `auth.test` response received in authorization middleware
    • additionalValues

      protected final Map<String,String> additionalValues
  • Constructor Details

    • Context

      public Context()
  • Method Details

    • client

      public MethodsClient client()
    • asyncClient

      public AsyncMethodsClient asyncClient()
    • say

      Throws:
      IOException
      SlackApiException
    • ack

      public Response ack()
    • ackWithJson

      public Response ackWithJson(Object obj)
    • ack

      public Response ack(com.google.gson.JsonElement json)
    • toJson

      public com.google.gson.JsonElement toJson(Object obj)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getSlack

      public Slack getSlack()
    • getLogger

      public org.slf4j.Logger getLogger()
    • getEnterpriseId

      public String getEnterpriseId()
      Organization ID for Enterprise Grid.
    • getTeamId

      public String getTeamId()
      Workspace ID.
    • isEnterpriseInstall

      public boolean isEnterpriseInstall()
      Returns true if the token is issued by an enterprise install (= org-level installation)
    • getBotToken

      public String getBotToken()
      A bot token associated with this request. The format must be starting with `xoxb-`.
    • isAttachingFunctionTokenEnabled

      public boolean isAttachingFunctionTokenEnabled()
      When true, the framework automatically attaches context#functionBotAccessToken to context#client instead of context#botToken. Enabling this behavior only affects function_executed event handlers and app.action/app.view handlers associated with the function token.
    • getFunctionBotAccessToken

      public String getFunctionBotAccessToken()
      The bot token associated with this "function_executed"-type event and its interactions. The format must be starting with `xoxb-`.
    • getFunctionExecutionId

      public String getFunctionExecutionId()
      The ID of function_executed event delivery.
    • getBotScopes

      public List<String> getBotScopes()
      The scopes associated to the botToken
    • getBotId

      public String getBotId()
      bot_id associated with this request.
    • getBotUserId

      public String getBotUserId()
      Bot user's user_id associated with this request.
    • getRequestUserId

      public String getRequestUserId()
      The user's ID associated with this request.
    • getRequestUserToken

      public String getRequestUserToken()
      The user token that is associated with the request user ID.
    • getRequestUserScopes

      public List<String> getRequestUserScopes()
      The scopes associated to the requestUserToken
    • getAuthTestResponse

      public AuthTestResponse getAuthTestResponse()
      The `auth.test` response received in authorization middleware
    • getAdditionalValues

      public Map<String,String> getAdditionalValues()
    • setSlack

      public void setSlack(Slack slack)
    • setEnterpriseId

      public void setEnterpriseId(String enterpriseId)
      Organization ID for Enterprise Grid.
    • setTeamId

      public void setTeamId(String teamId)
      Workspace ID.
    • setEnterpriseInstall

      public void setEnterpriseInstall(boolean enterpriseInstall)
      Returns true if the token is issued by an enterprise install (= org-level installation)
    • setBotToken

      public void setBotToken(String botToken)
      A bot token associated with this request. The format must be starting with `xoxb-`.
    • setAttachingFunctionTokenEnabled

      public void setAttachingFunctionTokenEnabled(boolean attachingFunctionTokenEnabled)
      When true, the framework automatically attaches context#functionBotAccessToken to context#client instead of context#botToken. Enabling this behavior only affects function_executed event handlers and app.action/app.view handlers associated with the function token.
    • setFunctionBotAccessToken

      public void setFunctionBotAccessToken(String functionBotAccessToken)
      The bot token associated with this "function_executed"-type event and its interactions. The format must be starting with `xoxb-`.
    • setFunctionExecutionId

      public void setFunctionExecutionId(String functionExecutionId)
      The ID of function_executed event delivery.
    • setBotScopes

      public void setBotScopes(List<String> botScopes)
      The scopes associated to the botToken
    • setBotId

      public void setBotId(String botId)
      bot_id associated with this request.
    • setBotUserId

      public void setBotUserId(String botUserId)
      Bot user's user_id associated with this request.
    • setRequestUserId

      public void setRequestUserId(String requestUserId)
      The user's ID associated with this request.
    • setRequestUserToken

      public void setRequestUserToken(String requestUserToken)
      The user token that is associated with the request user ID.
    • setRequestUserScopes

      public void setRequestUserScopes(List<String> requestUserScopes)
      The scopes associated to the requestUserToken
    • setAuthTestResponse

      public void setAuthTestResponse(AuthTestResponse authTestResponse)
      The `auth.test` response received in authorization middleware