Skip to main content

Introducing Webhooks and Callbacks support in SDKs and Developer Portals

· 4 min read

This enhancement allows developers to easily manage API notifications and event-driven workflows without extra setup. With type-safe handlers and configured signature verification, integration becomes simpler and more reliable.

Details

Webhooks and callbacks are widely used in APIs to deliver information asynchronously, notifying clients about events or providing results after a request has been initiated. Without SDK support, developers often need to write custom code for parsing payloads, verifying signatures, and mapping data. With this enhancement, all mentioned SDKs automatically generate type-safe handlers and utilities, giving developers a consistent and reliable way to work with event-driven APIs.

What's New in Developer Portal?

Callback Associated in API Endpoints: Each API endpoint page now includes a collapsible accordion listing all associated callbacks, making it easier to explore callback details without leaving the endpoint view.

Callback accordion in apiendpoit

Improved Documentation: Clearer descriptions and usage guidelines for callbacks and webhooks are now available, ensuring developers can integrate with confidence.

Ready to Use Examples: Updated code snippets in multiple languages demonstrate how to handle webhook payloads, making it faster to test and implement integrations.

webhook

What’s New in SDKs?

APIMatic now supports Webhooks and Callbacks in C#, Java, Python, Ruby and TypeScript SDKs.

  • Type Safe Webhook Handlers
  • Type Safe Callback Handlers
  • HMAC Signature Verification

Usage Example

Developers can now verify signatures and handle webhook events with type-safe parsing:

// Create the HttpRequestData from the incoming HttpRequest
var eventRequest = HttpRequestData.FromAspNetCoreParams(
Request.Method,
Request.Scheme,
Request.Host.ToString(),
Request.Path.ToString(),
Request.QueryString.ToString(),
Request.Headers,
Request.Body,
Request.Query,
Request.Cookies,
Request.Protocol,
Request.ContentType,
Request.ContentLength
);

// Use the provided handler to verify and parse the incoming event
var handler = new PaymentHandler("hmac-secret-key");

var eventParsingResult = await handler.VerifyAndParseEventAsync(eventRequest);
var result = eventParsingResult.MatchSome<string>(
verifiedPaymentEvent: payment => $"Payment verification received {payment}",
signatureVerificationFailed: error => $"Signature verification failed {error}",
unknown: () => "Unknown event received"
);

Learn more about webhooks and callbacks