Skip to content

Add WebHook event models #40

Open
Open
@sebastianblesgen

Description

@sebastianblesgen

If I try to implement a webhook, I don't find the models for the body of the POST performed by Mailgun.

EventItem can be used but it's just part of the bod. There is also the signature part. Both are wrapped in a model.

This is what I did in Kotlin with Spring Boot (Java is similar)

   @PostMapping("/events")
    fun eventHook(@RequestBody event: Event) {
        val correlationId = event.eventData.message.headers.messageId
        val timestamp = event.signature.timestamp
        // ....
    }

    data class Event(
        val signature: Signature,
        @JsonProperty("event-data")
        val eventData: EventItem
    )

    data class Signature(
        val token: String,
        val timestamp: String,
        val signature: String
    )

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions