Get Signing Key method 📢 Webhooks
Retrieves the public key used to verify signatures on incoming webhook payloads.
Usage
ts
import { MailChannelsClient, Webhooks } from 'mailchannels-sdk'
const mailchannels = new MailChannelsClient('your-api-key')
const webhooks = new Webhooks(mailchannels)
const { data, error } = await webhooks.getSigningKey('key-id')ts
import { MailChannels } from 'mailchannels-sdk'
const mailchannels = new MailChannels('your-api-key')
const { data, error } = await mailchannels.webhooks.getSigningKey('key-id')Params
idstringrequired: The ID of the key.TIP
The
idcan be found in thesignature-inputrequest header of the webhook notification askeyid.
Response
dataobject | nullnullableidstringguaranteed: The ID of the key.keystringguaranteed: The public key used to verify webhook signatures.
errorErrorResponse | nullnullable: Error information if the operation failed.messagestringguaranteed: A human-readable description of the error.statusCodenumber | nullnullable: The HTTP status code from the API, ornullif the error is not related to an HTTP request. This field is intended for diagnostic use only and should not be relied upon.typestringguaranteed: A string identifier for the type of error. This field is intended for diagnostic use only and should not be relied upon.
Type declarations
Signature
ts
async function getSigningKey (id: string): Promise<WebhooksSigningKeyResponse>Response type declarations
ts
interface ErrorResponse {
message: string;
statusCode: number | null;
type: ErrorType;
}ts
type DataResponse<T> = {
data: T;
error: null;
} | {
data: null;
error: ErrorResponse;
};Signing Key type declarations
ts
type WebhooksSigningKeyResponse = DataResponse<{
id: string;
key: string;
}>;Source
Source • Playground • Docs • Tests