도움말 및 문서
- Help and documentation
- Introduction to rootly
- 빠른 시작 가이드
- 알림
- On-Call
- 인시던트
- 회고
- 조치 항목
- 지표
- 워크플로우
- 인시던트 구성
- AI
- 알림
- 사용자 관리
- 팀 관리
- Liquid
- Contacting support
웹훅
Webhooks
페이로드
각 이벤트 페이로드는 event와 data 객체를 속성으로 가진 JSON 객체입니다. event 객체는 이벤트를 보유하고, data 속성은 이벤트가 발생한 시점의 리소스 표현을 보유합니다.
지원되는 이벤트
Copy
Ask AI
incident.created
incident.updated
incident.mitigated
incident.resolved
incident.cancelled
incident.deleted
incident.scheduled.created
incident.scheduled.updated
incident.scheduled.in\_progress
incident.scheduled.completed
incident.scheduled.deleted
incident\_post\_mortem.created
incident\_post\_mortem.updated
incident\_post\_mortem.published
incident\_post\_mortem.deleted
alert.created
pulse.created
웹훅 확인
각 웹훅 HTTP 요청에는 X-Rootly-Signature
헤더가 포함되어 있어 요청이 Rootly에서 왔는지 확인하는 데 사용됩니다. 서명 헤더에는 t=로 시작하는 타임스탬프와 v=로 시작하는 서명이 포함되어 있습니다.
Text
Copy
Ask AI
X-Rootly-Signature:
t=1492774588,
v1=6657a869e8ecebeda32affa62cdca3fa51cad7e77a0e56ff536d0ce8e108d8bd
요청을 확인하려면 타임스탬프와 요청 본문을 연결하고 웹훅 구성에서 사용 가능한 웹훅 비밀을 사용하여 SHA256 HMAC 다이제스트를 생성하십시오. HMAC 다이제스트는 제공된 서명과 일치해야 합니다.
Ruby
Copy
Ask AI
require 'openssl'
# Assuming 'request' is an object representing the incoming HTTP request
header = request.headers['X-Rootly-Signature']
parts = header.split(',')
timestamp = parts[0].split('t=').last
signature = parts[1].split('v1=').last
secret = 'webhook secret'
# Reading the request body
request_body = request.body
# Create a signature using HMAC SHA256
expected_signature = OpenSSL::HMAC.hexdigest('SHA256', secret, timestamp + request_body)
# Compare the computed signature with the received signature
is_valid = expected_signature == signature
Python
Copy
Ask AI
import hmac
import hashlib
header = request.headers['X-Rootly-Signature']
parts = header.split(',')
timestamp = parts[0].split('t=')[1]
signature = parts[1].split('v1=')[1]
secret = "webhook secret"
# Reading the request body
request_body = request.data # or request.body depending on the framework
# Create a signature using HMAC SHA256
expected_signature = hmac.new(
key=secret.encode(),
msg=(timestamp + request_body).encode(),
digestmod=hashlib.sha256
).hexdigest()
# Compare the computed signature with the received signature
is_valid = expected_signature == signature
JS
Copy
Ask AI
const crypto = require('crypto');
// Assuming 'request' is an object representing the incoming request
const header = request.headers['x-rootly-signature'];
const parts = header.split(',');
const timestamp = parts[0].split('t=')[1];
const signature = parts[1].split('v1=')[1];
const secret = "webhook secret";
// Reading the request body
// Ensure that the request body is raw or a string
const request_body = request.body;
// Create a HMAC SHA256 signature
const expectedSignature = crypto.createHmac('sha256', secret)
.update(timestamp + request_body)
.digest('hex');
// Compare the computed signature with the received signature
const isValid = expectedSignature === signature;
이 페이지가 도움이 되었나요?
어시스턴트
Responses are generated using AI and may contain mistakes.