notion-db-pages-payload-for-slack

Generate payload.json from Notion DB pages query result for Slack message

MIT License

Stars
0
Committers
1

Slack send payload generate GitHub Action

Generate a Slack send payload json file from Notion DB query result.

Setup

Usage

  • This action is supposed to be used with slackapi/slack-github-action
  • This action generate a payload data file to ./payload.json
    • And then you passing it to slackapi/slack-github-action.payload-file-path.

Notion DB pages example

Slack Notify message example

name: Send filtered Notion DB pages action
on:
  push:
    branches: [ "main" ]
  workflow_dispatch:

jobs:
  notify:
    runs-on: ubuntu-latest

    steps:
      - name: Generate send payload for slack
        uses: litencatt/[email protected]
        env:
          NOTION_API_TOKEN: ${{ secrets.NOTION_API_TOKEN }}
          NOTION_DB_ID: ${{ secrets.NOTION_DB_ID }}
        with:
          header: Header
          description: Description
          filter: |
            {
              "property": "Select",
              "select": {
                "equals": "Foo"
              }
            }

      - name: Send custom JSON data to Slack workflow
        id: slack
        uses: slackapi/[email protected]
        with:
          payload-file-path: "./payload.json"
        env:
          SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
          SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK