1.0.0
1.0.0
First major version release ๐
This release includes a few exciting new bits, as well as a couple breaking changes.
Breaking Changes
- The type
FunctionHandler
is no longer exported, as it was deprecated in favor of theSlackFunctionHandler
type. Alternatively, you can also update to use theSlackFunction
helper also included in this release, and described below. DefineType()
no longer acceptscallback_id
as a property, which has been deprecated in favor ofname
. If you're usingcallback_id
still, you can safely change it toname
.- The
options.client_secret_env_key
property has been removed fromDefineOAuth2Provider()
in favor of using theadd-secret
command of the slack cli. If you were setting this previously, you can remove it, and useslack add-secret
instead to provide the value.
Message metadata event schemas
You can define schemas for your Message metadata events via a new DefineEvent()
function. This will both provide validation that metadata posted matches the defined event schema, as well as provide discoverability in the future.
export const MyEvent = DefineEvent({
name: "my_event",
type: Schema.types.object,
properties: {
id: { type: Schema.types.string },
summary: { type: Schema.types.string },
},
required: ["id", "summary"],
});
export default Manifest({
...,
events: [MyEvent],
});
Easier function handlers with SlackFunction()
Now that functions can do quite a few things, like action and view handlers, we wanted to provide a simplified API for defining both the main function handler, as well as any additional optional handlers for interactivity, or a new unhandledEvent
handler, which will get called for any events your function receives that aren't otherwise handled.
import { SlackFunction, DefineFunction } from "deno-slack-sdk/mod.ts";
export const ReverseString = DefineFunction({
//... function definition
});
export default SlackFunction(ReverseString, async ({ inputs }) => {
// ... main function handler
}).addBlockActionsHandler(
"approve_request",
async ({ inputs }) => {
// ... block_actions handler
},
).addViewClosedHandler(
"approval_modal",
async ({ view, inputs }) => {
// ... view_closed handler
},
).addViewSubmissionHandler(
"approval_modal",
async ({ view, inputs }) => {
// ... view_submission handler
},
).addUnhandledEventHandler(({ body }) => {
console.log("unhandled event handler");
});
A more exhaustive set of the PRs included in this release
- First pass at view handler documentation by @filmaj in #82
- Exposing team_id to FunctionContext by @filmaj in #78
- Check for additionalProperties to be set to false by @shapirone in #87
- removing client_secret_env_key from manifest by @uhunnyslack in #83
- Add new attribute hint to Function parameters by @achautha in #89
- Make the workflow callback_id generic by @shapirone in #88
- Simpler functions with handlers - SlackFunctionHandlers by @selfcontained in #84
- Default token_management_enabled:true for runOnSlack:false apps by @srajiang in #90
- Add support for custom metadata events by @shapirone in #86
- Remove some deprecated items by @selfcontained in #91
New Contributors
- @uhunnyslack made their first contribution in #83
Full Changelog: 0.2.0...1.0.0