Events
Subscribing
receiver.on('match.card', ({ match, team, booking }, context) => {
console.log(context.id, context.timestamp, booking.type)
})
receiver.on('*', (data, context) => log(context.event, data))
receiver.off('match.card')
Each handler receives the payload, typed from the event name, and a context:
id: the delivery ID, stable across attempts, to use as an idempotency key;event: the event name;timestamp: the emission date declared by the service.
on('*', …) receives every event, and off() removes every handler of an event. All types are exported by @fca.gg/lfp-webhooks/types, including LfpEventMap, the table that maps each event name to its payload.
Schedule
| Event | Payload |
|---|---|
match.scheduled | match: the announced match (Fixture) |
match.rescheduled | match, previousDate, date |
match.schedule | match: the detailed schedule (ScheduledMatch), with stadium, broadcasters and watch link |
match.broadcasters_update | match: the same, when broadcasters change |
Before the match
| Event | Payload |
|---|---|
match.lineup | match, official, assistants, and for homeTeam / awayTeam: formation, kit, manager, players |
Periods
match.kickoff, match.half_time, match.second_half, match.extra_time_first_half, match.extra_time_second_half, match.shootout, match.full_time, match.abandoned and match.postponed share the same payload:
match: the match summary;stats: start, stop and duration of each period;homeTeam/awayTeam:stats(possession, shots, shots off target, saves, in total and per half),goals,bookings,substitutions.
The lists are complete since the start of the match: filter on period if you only want the last one. Enough to post a recap without calling the API.
Match events
| Event | Payload |
|---|---|
match.goal | match, team (home or away), score, goal |
match.goal_confirmed | the same, once the goal is confirmed (after a video review, for example) |
match.goal_cancelled | match, team, score, goal in a reduced form |
match.card | match, team, booking |
match.card_confirmed | the same, once the card is confirmed |
match.card_cancelled | match, team, booking in a reduced form |
match.substitution | match, team, substitution (subOff, subOn) |
A goal carries its type (goal, own or penalty), its minute, its period, the scorer, the assists, and originalDecision when it went through a video review. A card carries its color (Yellow, Red), its type (Yellow, SecondYellow, StraightRed), its reason, and the booked player or manager.
Players in a match event are reduced to id, showName and number: position, bust and stats belong to the lineup. Read them from match.lineup or with the API client.
The period of a card or a substitution is translated from the Opta code when known, and passed as is otherwise: do not treat it as a closed list.
State and standings
| Event | Payload |
|---|---|
match.update | the full match state (MatchSnapshot): stadium, result, officials, and for each team score, manager, goals, players, cards, substitutions and stats |
standings.update | competition, season, table: the standings, row by row |
The match summary
Almost every event carries match, a summary of the match: matchId, competition, season, matchDay, period, matchTime, watchUrl, and for homeTeam / awayTeam: id, name, short, score and logo.