Create method 📢 Webhooks
Enrolls the user to receive event notifications via webhooks.
Usage
ts
import { MailChannelsClient, Webhooks } from 'mailchannels-sdk'
const mailchannels = new MailChannelsClient('your-api-key')
const webhooks = new Webhooks(mailchannels)
const { success, error } = await webhooks.create("https://example.com/api/webhooks/mailchannels")ts
import { MailChannels } from 'mailchannels-sdk'
const mailchannels = new MailChannels('your-api-key')
const { success, error } = await mailchannels.webhooks.create("https://example.com/api/webhooks/mailchannels")Params
endpointstringrequired: The URL to receive event notifications. Must be no longer than8000characters.
Response
successbooleanguaranteed: Whether the operation was successful.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 create (endpoint: string): Promise<SuccessResponse>Response type declarations
ts
interface ErrorResponse {
message: string;
statusCode: number | null;
type: ErrorType;
}ts
interface SuccessResponse {
success: boolean;
error: ErrorResponse | null;
}Source
Source • Playground • Docs • Tests