1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Zoom Webhookのvalidationを通す PHP編

Last updated at Posted at 2023-02-08

Zoom APIのWebhook機能を使用しようと思い、endpoint URLを入力したところこんなエラーが出ました。

Event notification endpoint URL - URL validation failed. Try again later

Using webhooks

ドキュメントを読むと、CRCという形式を返さないとvalidationが通らないとのこと。
Node.jsのサンプルしかなかったので、PHPで書き直してみました。

challenge-response check (CRC)

まず、Zoomアプリに記載されているSecret Tokenを用意します。
そしてエンドポイントのPHPを書きます。

$body = file_get_contents('php://input');
$bodyJson = json_decode($body, true);

// Secret Token
$consumer_secret = '***';

$hashForVerify  = hash_hmac( 'sha256', $bodyJson['payload']['plainToken'], $consumer_secret, false );

// CRCのレスポンス
$response =  [
    'plainToken' => $bodyJson['payload']['plainToken'],
    'encryptedToken' => $hashForVerify,
];

// ステータスコード200をセット
http_response_code ();
echo json_encode( $response );

これで無事validationが通りました。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?