Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions methods/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ $ slack run chat_post_message.py # Make the request

## What's on call

### blocks

- **[blocks.validate](https://docs.slack.dev/reference/methods/blocks.validate)**: Validates blocks, messages, and views Block Kit JSON payloads. [Implementation](./src/blocks/blocks_validate.py).

### chat

- **[chat.postMessage](https://docs.slack.dev/reference/methods/chat.postmessage)**: Sends a message to a channel. [Implementation](./src/chat/chat_post_message.py).
2 changes: 2 additions & 0 deletions methods/src/blocks/.slack/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
apps.dev.json
cache/
6 changes: 6 additions & 0 deletions methods/src/blocks/.slack/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"manifest": {
"source": "local"
},
"project_id": "00000000-0000-0000-0000-000000000000"
}
5 changes: 5 additions & 0 deletions methods/src/blocks/.slack/hooks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"hooks": {
"get-hooks": "python3 -m slack_cli_hooks.hooks.get_hooks"
}
}
Empty file.
15 changes: 15 additions & 0 deletions methods/src/blocks/blocks_validate.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from slack_sdk import WebClient
from slack_sdk.models.blocks import PlainTextObject, SectionBlock

# Initialize
client = WebClient()

# Call the blocks.validate method
response = client.blocks_validate(
blocks=[
SectionBlock(text=PlainTextObject(text="Hello world")),
],
)

# Inspect the response
print(response)
16 changes: 16 additions & 0 deletions methods/src/blocks/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"display_information": {
"name": "Slack API Methods",
"description": "Example implementations to call \"blocks\" methods"
},
"oauth_config": {
"scopes": {
"bot": []
}
},
"settings": {
"org_deploy_enabled": true,
"socket_mode_enabled": false,
"token_rotation_enabled": false
}
}