Skip to main content

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​

EventPayload
match.scheduledmatch: the announced match (Fixture)
match.rescheduledmatch, previousDate, date
match.schedulematch: the detailed schedule (ScheduledMatch), with stadium, broadcasters and watch link
match.broadcasters_updatematch: the same, when broadcasters change

Before the match​

EventPayload
match.lineupmatch, 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​

EventPayload
match.goalmatch, team (home or away), score, goal
match.goal_confirmedthe same, once the goal is confirmed (after a video review, for example)
match.goal_cancelledmatch, team, score, goal in a reduced form
match.cardmatch, team, booking
match.card_confirmedthe same, once the card is confirmed
match.card_cancelledmatch, team, booking in a reduced form
match.substitutionmatch, 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.

note

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​

EventPayload
match.updatethe full match state (MatchSnapshot): stadium, result, officials, and for each team score, manager, goals, players, cards, substitutions and stats
standings.updatecompetition, 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.