HameSlack

説明

このプラグインは Slack と WordPress を連携します。

コアコンセプト

By default, this plugin does nothing. It’s true.
Slack has many API integration, but hameslack uses 2 of them.

上に行くほど簡単です。このプラグインはあなたが Slack でやりたいことに集中できるよう、Slack と WordPress の間の接続を助けます。

利用事例

複数の編集者による WordPress サイトでの利用事例のリストです。

  • 簡単なレビュー待ちの投稿通知を Slack に送ります。
  • Difficult Post access summary to slack once a week, because my colleague doesn’t open Google Analytics.
  • 非常に難しい Slack の会話変換を行い、1件の投稿としてインタビュー投稿を作成します。

For more details, please read the Addons documentation.

連携方法

一番シンプルな使い方は Slack への投稿です。以下のように使います:

do_action( 'hameslack', $text_to_post, $attachments, $channel );

Function hameslack_post( $content, $attachment, $channel ) is also available, but I prefer to use do_action to avoid annoying if ( function_exists('func_name')).

きちんと設定すればすべて正しく動きます。

Deprecated API

  • Sending Invitation deprecated at 2.0: this endpoint was unofficial and official one is only for Enterprise grid. Users now can send invitation reqeust from their profile page.
  • Outgoind Webhook deprecated at 2.0: Slack recommends Events API instead.

インストール

プラグインレポジトリから

インストールをクリックして有効化します。

From GitHub

Download from Releases and you can use it. Any pull requests are welcomed.

Enter Credentials

To post a message to slack, you need Payload URL. Create an app and activate “Incoming Webhooks”.
Now you can get payload URL.

To get Bot Token, go to “OAuth & Permissions”. By installing your app to your workspace, Bot token will be generated.

何かをします

As mentioned above, this plugin does nothing by default. Enable built-in addons from the settings page, or read the Addons documentation to write your own.

リクエストが有りましたら、GitHub でイシューをたててください。

Development

This plugin requires custom code to work with your Slack workspace. Here’s how to set up a local development environment.

Prerequisites

Getting Started

Install dependencies

npm install composer install

Start WordPress local environment

npm start

Build assets

npm run package

Watch for changes during development

npm run watch

Receiving Slack Webhooks Locally

Slack requires a public HTTPS URL for Event Subscriptions and Interactive Components. Use Cloudflare Tunnel to expose your local environment:

In a separate terminal, start the tunnel

npm run tunnel

This gives you a temporary public URL like https://random-name.trycloudflare.com. Then:

  1. Go to your Slack App settings
  2. Update Event Subscriptions Request URL to https://random-name.trycloudflare.com/wp-json/hameslack/v1/...
  3. Update Interactivity & Shortcuts Request URL similarly
  4. The URL changes each time you restart the tunnel

Note: Make sure WordPress permalink settings are not set to “Plain” — pretty permalinks are required for /wp-json/ to work through the tunnel.

NPM Scripts

Command
Description

npm start
Start wp-env

npm run package
Build all assets (CSS + JS)

npm run watch
Watch for file changes

npm run tunnel
Open Cloudflare Tunnel to localhost:8888

npm run lint
Run ESLint + Stylelint

npm run fix
Auto-fix lint errors

npm test
Run PHPUnit tests

スクリーンショット

  • このようなボットを作成可能です。
  • 設定画面からすべての設定を行います。
  • Outgoing Webhooks をカスタム投稿タイプとして作成します。

評価

このプラグインにはレビューがありません。

貢献者と開発者

HameSlack はオープンソースソフトウェアです。以下の人々がこのプラグインに貢献しています。

貢献者

“HameSlack” をあなたの言語に翻訳しましょう。

開発に興味がありますか ?

コードを閲覧するか、SVN リポジトリをチェックするか、開発ログRSS で購読してみてください。

変更履歴

2.2.0

  • Add hook-based addon system with settings UI.
  • Add built-in addons: Pending Review Notify (Incoming Webhook sample) and Slash Command Dashboard (Bot Token sample).
  • Fix double URL-encoding in hameslack_bot_request() for POST requests.

2.1.0

  • Bump required versions: PHP 7.4 and WP 6.6

2.0.0

  • Remove invitation feature and users now can send a simple message to specific channel to request invitation.
  • Bot is required.

1.2.0

  • gianism が有効化されている場合は、Slack アカウントでログインできるようになります。

1.1.1

  • REST APIのバグを修正

1.1.0

  • 招待リクエスト機能を追加。

1.0.2

  • 自動デプロイを追加。

1.0.0

  • 最初のリリース。