-
-
Notifications
You must be signed in to change notification settings - Fork 347
Description
Is your request related to a new offering from AWS?
Related to Legacy incoming webhooks deprecatation and providing support for the new incoming webhooks which only accept content type "application/json".
Is your request related to a problem? Please describe.
Yes, when creating a new Slack App or Slack Workflow Builder App, integration fails due to content type and json structure (for Workflow Builder Apps).
Describe the solution you'd like.
Implement a non-breaking / backwards compatible solution by adding new Terraform Input Variables that support options for recommended "application/json" content type, parsing to a flat json format (supporting Workflow Builder Apps and custom Slack Apps), and mapping parsed fields to custom variable names. See more details below.
Terraform
- "content_type_json": boolean true or false (default)
- Defaulting to false will not change anything all new variables are ignored, it is transparent to the user. Providing a non-breaking backwards compatible default configuration.
- If 'true' then the content-type request header will be set to "application/json" and the request url will not be encoded.
- "create_flat_json": boolean true or false (default). IGNORED if "content_type_json" equals false
- If ignored, payload is current json structure.
- If true, new json parser to create custom flat json key: value structure (Note: Workflow Builder Apps DO NOT support nested json).
- Exact field names will be determined during PR, but as an example - key names (name, description, reason, state_old, state_new, link, etc). Values will be all be type string and all fields whether there is a value or not will be submitted in the POST request, this is a requirement of Slack Workflow Builder apps.
- "message_map": Optional - map of field names to custom variable names. IGNORED if "content_type_json" equals false and/or "create_flat_json" equals false
- If ignored, payload is current json structure.
- Fields not included in the mapping, are ignored and not included in the request. ONLY fields which are explicitly defined in the "message_map" will be included.
- If null, ALL fields will be included in the request using their default key name as defined in the documentation (included in the PR)
Lambda
- Add environment variables for CONTENT_TYPE_JSON, CREATE_FLAT_JSON, AND MESSAGE_MAP
- Add logic to support request call changes based on content type
- If not CONTENT_TYPE_JSON - change nothing
- Otherwise set the content type request header to "application/json" and skip url encoding
- Implement new parsers to support flat json formatting
- Use the existing parsers as a starting point to determine all fields being parsed and create new parser that captures the same data into a flat json structure
- Implement parsing the json to the provided message_map structure
- Use this to map the internal names to provided variable names for the json stucture
Documentation
- All new variables, default values, what they do and how to use.
- Default field names and values, how to map using the new variables, with examples
Future considerations aka seperate PR:
Implement new BlockKit formatting parsers as described by Slack: https://api.slack.com/messaging/webhooks#advanced_message_formatting
Describe alternatives you've considered.
I tried to create a Slack Workflow App but new workflow apps using incoming-webhooks must be content type "application/json".
Tried other trigger options, using Workflow Builder Apps etc, but the offering is limited and when we created the Webhook for the Workflow Builder App and tried to define json, fields it didn't work as it must be "application/json" and flat json structure