Kyurasi

kyurasi.com/@junmannn_yoon

zoom webhook verification with ruby on rails

def zoom_verification request_signature = request.headers['X-ZM-Signature'] request_timestamp = request.headers['X-ZM-Request-Timestamp'] # Construct the message string message = "v0:#{request_timestamp}:#{request.body.read}" # Create hash for verification hash_for_verify = OpenSSL::HMAC.hexdigest('sha256', "YOUR_ZOOM_SECRET_TOKEN_HERE", message) expected_signature = "v0=#{hash_for_verify..

zoom webhook verification with ruby on rails

📅
junmannnyoonjunmannnyoon
13
#webhook verification ruby#zoom rails#zoom ruby#zoom webhook verification#zoom webhook verification in rails
💡이 글의 요약

def zoom_verification request_signature = request.headers['X-ZM-Signature'] request_timestamp = request.headers['X-ZM-Request-Timestamp'] # Construct the message string message = "v0:#{request_timestamp}:#{request.body.read}" # Create hash for verification hash_for_verify = OpenSSL::HMAC.hexdigest('sha256', "YOUR_ZOOM_SECRET_TOKEN_HERE", message) expected_signature = "v0=#{hash_for_verify..

def zoom_verification
  request_signature = request.headers['X-ZM-Signature']
  request_timestamp = request.headers['X-ZM-Request-Timestamp']

  # Construct the message string
  message = "v0:#{request_timestamp}:#{request.body.read}"

  # Create hash for verification
  hash_for_verify = OpenSSL::HMAC.hexdigest('sha256', "YOUR_ZOOM_SECRET_TOKEN_HERE", message)
  expected_signature = "v0=#{hash_for_verify}"

  # Validate the request signature
  if request_signature == expected_signature
      if params[:event] == 'endpoint.url_validation'
          plain_token = params[:payload][:plainToken]
          hash_for_validate = OpenSSL::HMAC.hexdigest('sha256', "YOUR_ZOOM_SECRET_TOKEN_HERE", plain_token)
          Rails.logger.info "hash_for_validate : #{hash_for_validate}"

          response = {
          message: {
              plainToken: plain_token,
              encryptedToken: hash_for_validate
          },
          status: 200
          }
          render json: response[:message], status: response[:status]
      else
          # Your business logic here (e.g., API requests to Zoom or third parties)
          response = { message: 'Authorized request to Zoom Webhook sample.', status: 200 }
          render json: response, status: response[:status]
      end
  else
      response = { message: 'Unauthorized request to Zoom Webhook sample.', status: 401 }
      render json: response, status: response[:status]
  end
end

 

 

+ add the def zoom_verification as url in routes.rb and publish.

 

 

For other frameworks or languages, change a little bit on hashing. If that is too hard, just copy and paste to GPT or Perplexity or whatever and ask for code variation

 

마지막 수정: 2025. 2. 25.