First request, first event
In five stops you send a request that opens a support ticket, add a webhook endpoint and verify the signature of the event that arrives. Pick the language of the SDK samples once; it stays selected down the page. You can go back to the developers page for the overview. The glossary defines the idea under webhook.
- Identity
- A scoped OAuth client credential or an API key, on your server only
- Base path
- /api/v1
- Write requests
- The Idempotency-Key header is required
- Webhook
- HTTPS endpoint, HMAC-SHA256 signature
- Languages
- TypeScript, .NET, Python
Prepare your server identity
You connect to BirAsistan from your server. The identity is a scoped OAuth client credential or an API key. The key stays on your server; it is never placed in a browser, in client apps or in the query string of a webhook address. The webhook signing secret is a separate value and does not replace the API key.
BIRASISTAN_API_URL=<test environment or production base address>BIRASISTAN_API_KEY=<stays on your server>Choose your SDK and import it
The starting languages are TypeScript, .NET and Python. The names are @birasistan/sdk, BirAsistan.Sdk and birasistan-sdk; in Python the import name is birasistan. The samples show the SDK interface. This page does not claim that an SDK is published to a registry, so it gives no install command. Coverage is on the SDK page.
import { BirAsistanClient } from '@birasistan/sdk';const client = new BirAsistanClient({ baseUrl: process.env.BIRASISTAN_API_URL!, credential: () => process.env.BIRASISTAN_API_KEY!,});// BirAsistan.Sdk// The HttpClient factory and the credential function are supplied through dependency injection.# birasistan-sdkimport birasistanSend your first request
Open a support ticket. A write request needs an Idempotency-Key. On a timeout, send the request again with the same key and do not generate a new one; your app derives the key from a durable job id. A successful response returns 201.
const ticket = await client.tickets.create({ subject: 'Late order', description: 'The customer asked for a call back.', priority: 'high', departmentId: departmentId,}, { idempotencyKey: persistedRequestKey });var result = await client.Tickets.CreateAsync( new CreateTicketRequest( Subject: "Late order", Description: "The customer asked for a call back.", Priority: TicketPriority.High, DepartmentId: departmentId), new RequestOptions(IdempotencyKey: persistedRequestKey), cancellationToken);ticket = await client.tickets.create( subject="Late order", description="The customer asked for a call back.", priority="high", department_id=department_id, idempotency_key=persisted_request_key,){ "id": "44444444-4444-4444-8444-444444444444", "tenantId": "11111111-1111-4111-8111-111111111111", "subject": "Late order", "description": "The customer asked for a call back.", "priority": "high", "departmentId": "55555555-5555-4555-8555-555555555555"}Add a webhook endpoint
The endpoint must use HTTPS. After you register it, you confirm access with a verification challenge; deliveries are never sent to internal addresses. The eventTypes field lists the events you subscribe to, and the names are in the event catalog. Every endpoint has its own signing secret. Delivery and retry rules are on the webhooks page.
POST /api/v1/webhook-endpointsIdempotency-Key: <key derived from a durable job id>Content-Type: application/json{ "url": "https://example.com/birasistan/events", "eventTypes": ["call.ended", "ticket.created"]}Verify the signature
Every delivery carries a BirAsistan-Signature header: t=timestamp, v1=lowercase hex HMAC. Verify over the raw body. Do not parse the body and sign a re-serialized copy.
- Split the header. Read the t and v1 values. The header format and the body size are checked first.
- Check the timestamp. Reject the request if the difference is more than 300 seconds.
- Compute the signature. Join the timestamp, a dot and the raw body, then compute HMAC-SHA256 with the secret.
- Compare. Use a constant-time comparison. A matching signature does not show the event was not processed before; deduplicate with BirAsistan-Event-Id.
import hashlibimport hmacimport re# raw_body: the raw bytes, read before any parsingmatch = re.fullmatch(r't=([0-9]{1,12}),v1=([0-9a-f]{64})', signature_header)timestamp = int(match.group(1))if abs(now - timestamp) > 300: raise ValueError('timestamp_outside_tolerance')signed = str(timestamp).encode('ascii') + b'.' + raw_bodyexpected = hmac.new(secret.encode('utf-8'), signed, hashlib.sha256).hexdigest()if not hmac.compare_digest(expected, match.group(2)): raise ValueError('signature_mismatch')Test environment and test vector
The fixed vector below is for testing your verification offline.
- Base address
- While you develop, set the SDK client's base address to the test environment; the samples show where that line goes.
- Credentials
- Test environment keys are separate from production keys.
- Data
- The samples use made-up identifiers, keys and phone numbers; you replace them with your own.
- Test vector
- The secret, timestamp and body below produce a valid signature. If a single byte is added to the body, your verification must reject it. The secret is a sample, not a real secret.
secret: whsec_documentation_fixture_only_not_a_real_secrettimestamp: 1796212800BirAsistan-Signature: t=1796212800,v1=b5fb7325cd10fbd668fabdb1c089693821644530a5783336303d7f86348122a6body: {"specversion":"1.0","id":"aaaaaaaa-aaaa-4aaa-8aaa-000000000003","source":"urn:birasistan:core","type":"call.ended","time":"2026-12-02T12:00:00Z","subject":"calls/22222222-2222-4222-8222-222222222222","datacontenttype":"application/json","dataschema":"https://docs.birasistan.com/schemas/v1/call-ended","tenantid":"11111111-1111-4111-8111-111111111111","traceid":"0123456789abcdef0123456789abcdef","data":{"tenantId":"11111111-1111-4111-8111-111111111111","callId":"22222222-2222-4222-8222-222222222222","endedAt":"2026-12-02T12:00:00Z","outcome":"completed","durationMs":180000,"aiActiveMs":95000,"humanActiveMs":60000,"sequence":10,"terminationReason":"completed","businessOutcome":"solved"}}Common mistakes
| Symptom | Cause |
|---|---|
| The signature does not match | The body may have been parsed and re-serialized, or a layer in front of your handler changed it. The signature is computed over the raw bytes of the body. |
| A valid signature is rejected as out of date | The difference between the timestamp and your server clock is more than 300 seconds. Watch your clock synchronization. |
| The same event is processed twice | A valid signature does not show the event was not processed before. A retry carries the same BirAsistan-Event-Id; store the id durably and deduplicate. |
| 409 idempotency_conflict | The same Idempotency-Key was used with a different body. One key per logical operation, the same body for the same operation. |
| 409 operation_in_progress | The first request sent with the same key is still being processed. Wait for the Retry-After time and retry with the same key. |
| A duplicate record after a timeout | A new key was generated when the request was resent. After a timeout, use the same key. |
| 428 precondition_required or 412 version_conflict | The update was sent without If-Match, or the ETag is stale. Read the resource again and send with the current ETag. |
| 429 rate_limited | You hit the request limit. Wait for the Retry-After time and use growing waits with jitter on repeats. |