Developers
Chat widget developer guides
The widget is a chat inside your website or app. Visitors ask about matches, teams and players in their own words and get answers as text and cards: stats, form, line-ups, standings and your prices.
It shows a chat icon, a teaser with a short greeting about a game, and a chat panel. When a visitor taps "Add to slip" under a price, the widget hands the selection to your code.
Each guide covers one platform end to end, from the first line of code to the reference tables.
How it works
Our page
The chat is a page we host at your widget origin. The widget loads it and shows it in a panel or sheet. You do not build or proxy it.
Your callbacks
Your code stays in charge of your product. You pass in the signed-in visitor and the page they are on, and the widget calls you back:
onAddToSlipputs the selection in your bet slip and returns what happened.onEventreceives every visitor action, for your own analytics.onUnavailabletells you why the widget could not start.
What you need from us
Your SensibleStats contact sends you three values.
| Value | Example | What it is |
|---|---|---|
| Operator id | YOUR_OPERATOR_ID | Your account in our system. Part of every request. |
| Public key | YOUR_PUBLIC_KEY | Identifies your widget. |
| Widget origin | https://your-widget-host | The address the chat is served from. |
Websites also send us a list of allowed domains: every origin where the widget runs. Mobile apps ask us to switch mobile on for the account.
Pick your platform
Every guide has the same 13 sections, so you can move between them.
Web script
Any website where you can add a script tag to the page.
Read the guideReact
React and Next.js apps, where the widget is a component.
Read the guideiOS
Native iOS apps written in Swift and SwiftUI.
Read the guideAndroid
Native Android apps written in Kotlin with Android Views.
Read the guideFlutter
Flutter apps that ship to iOS and Android from one codebase.
Read the guideReact Native
React Native apps, where the widget is a component in a WebView.
Read the guide
Before you go live
Each guide covers these in detail.
- The operator id, public key and widget origin are in your config.
- Websites: every origin the widget runs on, staging included, is on the allowed-domains list we hold. Mobile: we have switched mobile on.
- You pass the signed-in visitor's id, a random id that never changes for that account.
- onAddToSlip adds the selection to your slip and answers within 10 seconds.
- You handle the reason when the widget cannot start, so a failed start never breaks your page.
- Websites: your Content Security Policy allows the widget origin. Mobile: your app opens links to other hosts outside the chat.
Need help? Your SensibleStats contact can answer questions about any guide and send the three values. Write to solutions@sensiblestats.com.