By completing this tutorial, you will:
matchEventSuggestedSelection endpoint to receive live match events and suggest potential betsmarket or eventMarkets endpoint to return localized markets/odds dataBefore implementing the Flash Bet-related endpoints, ensure you have:
srEntityId) managed and configured in your channel through the Moderation UIFlash Bet uses a two-step real-time flow:
matchEventSuggestedSelection: Triggered when a match event occurs in the chat. The widget calls this to ask your adapter what specific market or outcome should be suggested to the user for this incident. This endpoint returns a selection definition (specifying the match event, market ID, optional specifiers, and optional recommended outcome).market or eventMarkets: The widget takes the selection signature returned by matchEventSuggestedSelection and passes it directly as the request argument (args.selection) to resolve and subscribe to the actual market details (display names, active outcomes, outcomes' status, decimal odds, etc.) from market or eventMarkets.To fully support the Flash Bet UX, your custom adapter object implements:
matchEventSuggestedSelection (required) — Translates incoming match incidents (like goals, bookings, or tennis points) into potential market or outcome selections.market or eventMarkets (required, mutually exclusive) — Supplies the active selections, outcome naming, and current odds to the Flash Bet UI, and provides the mechanism to push real-time status updates (like suspending or deactivating a selection to trigger a temporary suspension).Start by registering your adapter object using the global SIR function. Ensure only one adapter is registered per page load.
const adapter = {
endpoints: {
// Endpoints will go here
}
};
SIR('registerAdapter', adapter);Add the matchEventSuggestedSelection endpoint to suggestion list. This endpoint receives the incident's metadata via args and returns structured market selections.
const adapter = {
endpoints: {
matchEventSuggestedSelection: (args, callback) => {
// args example:
The selections returned in Step 2 are resolved and rendered using either the market endpoint or the eventMarkets endpoint. Do not implement both. Choose based on your API capability and layout:
market + availableMarketsForEvent): Implement this if your API serves market data and odds based on specific market/selection IDs (and specifiers), allowing subscription to individual markets.eventMarkets): Implement this if your API only serves market data and odds on an event level, returning all markets for the entire event ID in a single payload.marketChoose this option if your system's API allows fetching and subscribing to updates by specific market/selection IDs.
const marketCallbaks = {};
const adapter = {
endpoints: {
market: (args, callback)
eventMarketsChoose this option to supply and update markets for the entire match fixture collectively.
const eventMarketsCallbacks = {};
const adapter = {
endpoints: {
eventMarkets: (args, callback) => {
// args example:
If a match incident occurs that pauses play (like a goal revision or court medical timeout) right before outcomes resolve, you should suspend the active Flash Bet to prevent users from placing invalid bets.
By default, the suspension is held in the UI for 65 seconds (configurable in your Moderation UI settings). To trigger this state, execute your active endpoint callback with an updated market status.
// Retreive active callback saved during step 3 Option A
const key = "sr:match:12345:202:setnr=1";
const activeCallback = marketCallbaks[key];
if (activeCallback) {
// Notify widget that the market is suspended
activeCallback(undefined, {
market: {
id: "202",
name: "Next Game Winner - Set 1"
If you wish to keep the flash bet Timer active but temporarily lock outcomes from being clicked, update outcome status parameters to "deactivated" or set the market status to "deactivated".
if (activeCallback) {
activeCallback(undefined, {
market: {
id: "202",
name: "Next Game Winner - Set 1",
status: "deactivated", // Countdown stays active, outcomes disabled
outcomes: [
{ id: "1", name: "Player A", status:
For reference, inspect the type definitions inside your Adapter API reference:
| Property | Type | Description |
|---|---|---|
selections | Selection[] | Array of suggested outcome or market selection objects |
{
"selections": [
{
"event": "sr:match:12345",
"market": "202",
"specifiers": "setnr=1",
"type": "uf"
}
]
}