oauth2 type
This reference documents the Slack types at the platform level. Their availability and structure may differ in each SDK
Type: slack#/types/credential/oauth2
| Property | Type | Description |
|---|---|---|
default | The type that is being described. | An optional parameter default value. |
description | string | An optional parameter description. |
examples | An array of the type being described. | An optional list of examples. |
hint | string | An optional parameter hint. |
title | string | An optional parameter title. |
type | string | String that defines the parameter type. |
Declare an oauth2 type:
- JSON manifest
- Deno Slack SDK
// ...
"github_access_token_id": {
"type": "slack#/types/credential/oauth2",
"oauth2_provider_key": "github"
}
// ...
// ...
githubAccessTokenId: {
type: Schema.slack.types.oauth2,
oauth2_provider_key: "github",
},
// ...
OAuth2 example
In this example, we use the oauth2 type for an input parameter in a custom function. To read more about a full implementation of oauth2, check out External authentication.
export const CreateIssueDefinition = DefineFunction({
callback_id: "create_issue",
title: "Create GitHub issue",
description: "Create a new GitHub issue in a repository",
source_file: "functions/create_issue.ts",
input_parameters: {
properties: {
githubAccessTokenId: {
type: Schema.slack.types.oauth2,
oauth2_provider_key: "github",
},
url: {
type: Schema.types.string,
description: "Repository URL",
},
// ...
},
output_parameters: {
properties: {
GitHubIssueNumber: {
type: Schema.types.number,
description: "Issue number",
},
GitHubIssueLink: {
type: Schema.types.string,
description: "Issue link",
},
},
required: ["GitHubIssueNumber", "GitHubIssueLink"],
},
});