Class: SlackWebApi::WorkflowsController

Inherits:
BaseController show all
Defined in:
lib/slack_web_api/controllers/workflows_controller.rb

Overview

WorkflowsController

Constant Summary

Constants inherited from BaseController

BaseController::GLOBAL_ERRORS

Instance Attribute Summary

Attributes inherited from BaseController

#config, #http_call_back

Instance Method Summary collapse

Methods inherited from BaseController

#initialize, #new_parameter, #new_request_builder, #new_response_handler, user_agent, user_agent_parameters

Constructor Details

This class inherits a constructor from SlackWebApi::BaseController

Instance Method Details

#workflows_step_completed(token, workflow_step_execute_id, outputs: nil) ⇒ ApiResponse

Indicate that an app’s step in a workflow completed execution. scope: workflow.steps:execute identifier that maps to the correct workflow step execution. from your step. Keys of this object reflect the configured key properties of your [outputs](/reference/workflows/workflow_step#output) array from your workflow_step object.

Parameters:

  • token (String)

    Required parameter: Authentication token. Requires

  • workflow_step_execute_id (String)

    Required parameter: Context

  • outputs (String) (defaults to: nil)

    Optional parameter: Key-value object of outputs

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/slack_web_api/controllers/workflows_controller.rb', line 19

def workflows_step_completed(token,
                             workflow_step_execute_id,
                             outputs: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/workflows.stepCompleted',
                                 Server::DEFAULT)
               .header_param(new_parameter(token, key: 'token')
                              .is_required(true))
               .query_param(new_parameter(workflow_step_execute_id, key: 'workflow_step_execute_id')
                             .is_required(true))
               .header_param(new_parameter('application/x-www-form-urlencoded', key: 'Content-Type'))
               .query_param(new_parameter(outputs, key: 'outputs'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('slackAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(DefaultSuccessTemplate.method(:from_hash))
                .is_api_response(true)
                .local_error('default',
                             'Typical error response',
                             DefaultErrorTemplateException))
    .execute
end

#workflows_step_failed(token, workflow_step_execute_id, error) ⇒ ApiResponse

Indicate that an app’s step in a workflow failed to execute. scope: workflow.steps:execute identifier that maps to the correct workflow step execution. message property that should contain a human readable error message.

Parameters:

  • token (String)

    Required parameter: Authentication token. Requires

  • workflow_step_execute_id (String)

    Required parameter: Context

  • error (String)

    Required parameter: A JSON-based object with a

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/slack_web_api/controllers/workflows_controller.rb', line 52

def workflows_step_failed(token,
                          workflow_step_execute_id,
                          error)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/workflows.stepFailed',
                                 Server::DEFAULT)
               .header_param(new_parameter(token, key: 'token')
                              .is_required(true))
               .query_param(new_parameter(workflow_step_execute_id, key: 'workflow_step_execute_id')
                             .is_required(true))
               .query_param(new_parameter(error, key: 'error')
                             .is_required(true))
               .header_param(new_parameter('application/x-www-form-urlencoded', key: 'Content-Type'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('slackAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(DefaultSuccessTemplate.method(:from_hash))
                .is_api_response(true)
                .local_error('default',
                             'Typical error response',
                             DefaultErrorTemplateException))
    .execute
end

#workflows_update_step(token, workflow_step_edit_id, inputs: nil, outputs: nil, step_name: nil, step_image_url: nil) ⇒ ApiResponse

Update the configuration for a workflow extension step. scope: workflow.steps:execute identifier provided with view_submission payloads used to call back to workflows.updateStep. required from a user during configuration. This is the data your app expects to receive when the workflow step starts. **Please note**: the embedded variable format is set and replaced by the workflow system. You cannot create custom variables that will be replaced at runtime. [Read more about variables in workflow steps here](/workflows/steps#variables). objects used during step execution. This is the data your app agrees to provide when your workflow step was executed. be used to override the step name that is shown in the Workflow Builder. can be used to override app image that is shown in the Workflow Builder.

Parameters:

  • token (String)

    Required parameter: Authentication token. Requires

  • workflow_step_edit_id (String)

    Required parameter: A context

  • inputs (String) (defaults to: nil)

    Optional parameter: A JSON key-value map of inputs

  • outputs (String) (defaults to: nil)

    Optional parameter: An JSON array of output

  • step_name (String) (defaults to: nil)

    Optional parameter: An optional field that can

  • step_image_url (String) (defaults to: nil)

    Optional parameter: An optional field that

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# File 'lib/slack_web_api/controllers/workflows_controller.rb', line 99

def workflows_update_step(token,
                          workflow_step_edit_id,
                          inputs: nil,
                          outputs: nil,
                          step_name: nil,
                          step_image_url: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/workflows.updateStep',
                                 Server::DEFAULT)
               .header_param(new_parameter(token, key: 'token')
                              .is_required(true))
               .query_param(new_parameter(workflow_step_edit_id, key: 'workflow_step_edit_id')
                             .is_required(true))
               .header_param(new_parameter('application/x-www-form-urlencoded', key: 'Content-Type'))
               .query_param(new_parameter(inputs, key: 'inputs'))
               .query_param(new_parameter(outputs, key: 'outputs'))
               .query_param(new_parameter(step_name, key: 'step_name'))
               .query_param(new_parameter(step_image_url, key: 'step_image_url'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('slackAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(DefaultSuccessTemplate.method(:from_hash))
                .is_api_response(true)
                .local_error('default',
                             'Typical error response',
                             DefaultErrorTemplateException))
    .execute
end