SDK Dokümantasyonu
Official SDKs for 8 languages. Install via your package manager and start sending webhooks in seconds.
📦
Node.js SDK
StableKurulum
npm install hooksniff-sdk
Hızlı Başlangıç
import { HookSniff } from 'hooksniff-sdk';
const hr = new HookSniff({ apiKey: process.env.HOOKSNIFF_API_KEY! });
// Create an endpoint
const endpoint = await hr.endpoints.create({
url: 'https://myapp.com/webhook',
description: 'Production webhook',
});
console.log('Endpoint:', endpoint.id);
// Send a webhook
const delivery = await hr.webhooks.send({
endpointId: endpoint.id,
event: 'order.created',
data: { order_id: '12345', total: 99.99, currency: 'USD' },
});
console.log('Delivery:', delivery.id, delivery.status);İmza Doğrulama
import express from 'express';
import { verifySignature } from 'hooksniff-sdk';
const app = express();
app.post('/webhook', express.raw({ type: 'application/json' }), (req, res) => {
const signature = req.headers['x-hooksniff-signature'] as string;
if (!verifySignature(req.body, signature, 'whsec_your_secret')) {
return res.status(401).send('Invalid signature');
}
const event = JSON.parse(req.body);
console.log('Received:', event.event);
res.status(200).send('OK');
});TypeScript Desteği
import type { Endpoint, Delivery, WebhookEvent } from 'hooksniff-sdk';
const endpoints: Endpoint[] = await hr.endpoints.list();
const delivery: Delivery = await hr.webhooks.send({
endpointId: 'ep_abc123',
event: 'user.created',
data: { email: 'user@example.com' } satisfies WebhookEvent,
});🐍
Python SDK
StableKurulum
pip install hooksniff
Hızlı Başlangıç
import hooksniff
import os
client = hooksniff.Client(api_key=os.environ["HOOKSNIFF_API_KEY"])
# Create an endpoint
endpoint = client.endpoints.create(
url="https://myapp.com/webhook",
description="Production webhook"
)
print(f"Endpoint ID: {endpoint.id}")
# Send a webhook
delivery = client.webhooks.send(
endpoint_id=endpoint.id,
event="order.created",
data={"order_id": "12345", "total": 99.99, "currency": "USD"}
)
print(f"Delivery ID: {delivery.id}, Status: {delivery.status}")İmza Doğrulama
from flask import Flask, request, abort
import hooksniff
app = Flask(__name__)
@app.route("/webhook", methods=["POST"])
def handle_webhook():
signature = request.headers.get("X-HookSniff-Signature")
if not hooksniff.verify_signature(
payload=request.data,
signature=signature,
secret="whsec_your_signing_secret"
):
abort(401)
event = request.json
print(f"Received: {event['event']}")
return "", 200🦀
Rust SDK
StableKurulum
cargo add hooksniff
Hızlı Başlangıç
use hooksniff::HookSniffClient;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = HookSniffClient::new(
std::env::var("HOOKSNIFF_API_KEY")?
);
// Create an endpoint
let endpoint = client.create_endpoint()
.url("https://myapp.com/webhook")
.description("Production webhook")
.send()
.await?;
println!("Endpoint: {}", endpoint.id);
// Send a webhook
let delivery = client.send_webhook()
.endpoint_id(&endpoint.id)
.event("order.created")
.data(serde_json::json!({
"order_id": "12345",
"total": 99.99
}))
.send()
.await?;
println!("Delivery: {}", delivery.id);
Ok(())
}🐹
Go SDK
StableKurulum
go get github.com/servetarslan02/hooksniff-go
Hızlı Başlangıç
package main
import (
import type { Metadata } from 'next';
// Revalidate every hour for ISR
export const revalidate = 3600;
export const metadata: Metadata = {
title: 'SDK Libraries',
description: 'Official SDK libraries for HookSniff in multiple languages',
};
"fmt"
"os"
hooksniff "github.com/servetarslan02/hooksniff-go"
)
func main() {
cfg := hooksniff.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HOOKSNIFF_API_KEY"))
client := hooksniff.NewAPIClient(cfg)
// Create an endpoint
endpoint, _, _ := client.EndpointsApi.CreateEndpoint(nil).Execute()
fmt.Printf("Endpoint: %s\n", endpoint.Id)
// Send a webhook
delivery, _, _ := client.WebhooksApi.SendWebhook(nil).Execute()
fmt.Printf("Delivery: %s\n", delivery.Id)
}💎
Ruby SDK
StableKurulum
gem install hooksniff
Hızlı Başlangıç
require 'hooksniff'
client = HookSniff::Client.new(api_key: ENV['HOOKSNIFF_API_KEY'])
# Create an endpoint
endpoint = client.endpoints.create(
url: 'https://myapp.com/webhook',
description: 'Production webhook'
)
puts "Endpoint: #{endpoint.id}"
# Send a webhook
delivery = client.webhooks.send(
endpoint_id: endpoint.id,
event: 'order.created',
data: { order_id: '12345', total: 99.99 }
)
puts "Delivery: #{delivery.id}"🐘
PHP SDK
StableKurulum
composer require hooksniff/hooksniff-php
Hızlı Başlangıç
<?php
require 'vendor/autoload.php';
$client = new \HookSniff\Client(getenv('HOOKSNIFF_API_KEY'));
// Create an endpoint
$endpoint = $client->endpoints->create([
'url' => 'https://myapp.com/webhook',
'description' => 'Production webhook',
]);
echo "Endpoint: {$endpoint->id}\n";
// Send a webhook
$delivery = $client->webhooks->send([
'endpoint_id' => $endpoint->id,
'event' => 'order.created',
'data' => ['order_id' => '12345', 'total' => 99.99],
]);
echo "Delivery: {$delivery->id}\n";🧪
Elixir SDK
StableKurulum
{:hooksniff, "~> 0.3.0"}Hızlı Başlangıç
# In your mix.exs deps:
# {:hooksniff, "~> 0.3.0"}
{:ok, client} = HookSniff.Client.new(api_key: System.get_env("HOOKSNIFF_API_KEY"))
# Create an endpoint
{:ok, endpoint} = HookSniff.Endpoints.create(client, %{
url: "https://myapp.com/webhook",
description: "Production webhook"
})
IO.puts("Endpoint: #{endpoint.id}")
# Send a webhook
{:ok, delivery} = HookSniff.Webhooks.send(client, %{
endpoint_id: endpoint.id,
event: "order.created",
data: %{order_id: "12345", total: 99.99}
})
IO.puts("Delivery: #{delivery.id}")☕
C# SDK
StableKurulum
dotnet add package HookSniff
Hızlı Başlangıç
using HookSniff;
var client = new HookSniffClient(
apiKey: Environment.GetEnvironmentVariable("HOOKSNIFF_API_KEY")
);
// Create an endpoint
var endpoint = await client.Endpoints.CreateAsync(new CreateEndpointRequest
{
Url = "https://myapp.com/webhook",
Description = "Production webhook"
});
Console.WriteLine($"Endpoint: {endpoint.Id}");
// Send a webhook
var delivery = await client.Webhooks.SendAsync(new SendWebhookRequest
{
EndpointId = endpoint.Id,
Event = "order.created",
Data = new { order_id = "12345", total = 99.99 }
});
Console.WriteLine($"Delivery: {delivery.Id}");Coming Soon
These SDKs are in development and will be available on their package registries soon.
☕ JavaComing Soon
io.github.servetarslan02:hooksniff-sdkMaven Central
🟣 KotlinComing Soon
io.github.servetarslan02:hooksniff-sdkMaven Central
🍎 SwiftComing Soon
HookSniff (SPM)Swift Package Manager