WorldCupBot will notify a Slack channel/group for every matches during a FIFA World Cup.
The API haven't changed since the Russia World Cup 2018.
Which means you can use that bot for every FIFA World Cup, you just need to update ID_COMPETITION
& ID_SEASON
.
World Cup | ID_COMPETITION |
ID_SEASON |
---|---|---|
FIFA World Cup Russia 2018™ | 17 | 254645 |
FIFA U-20 World Cup Poland 2019 | 104 | 281971 |
FIFA Women's World Cup France 2019™ | 103 | 278513 |
FIFA World Cup Qatar 2022™ | 17 | 255711 |
If the competition you are looking for isn't defined below, here is how you can find these numbers:
- determine when the competition will start (for example
2022-11-19T00:00:00Z
) - go to
https://api.fifa.com/api/v3/calendar/matches?from=DATE_START&language=en&count=500
and replaceDATE_START
with the previous date (be careful to use the same format) - look for the competition (for example
FIFA World Cup Qatar 2022
) - get the correspondant values:
IdSeason
IdCompetition
That bot is using the "unofficial" FIFA json API (the one used for their mobile apps).
It will post a message :
- when a match starts
- for every red/yellow card
- for the half time and end time
- and of course, for every goal
Here is a preview of the United States vs Wales match (during the 2022 edition).
![worldcup-slack-bot sample](https://user-images.githubusercontent.com/62333/203157864-06b82dc3-b792-474b-b24e-f966c9bd3b5f.png)
- PHP >= 5.5 (I guess?)
- You need to create a Slack Apps with an incoming webhooks:
- Jump at https://api.slack.com/messaging/webhooks (you have to login)
- Create a Slack app
- Enable Incoming Webhooks
- Create an Incoming Webhook (you'll then select the channel used for that bot)
- Grab the link like
https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX
and put it inSLACK_URL
- Clone this repo
- Set up a cron to run every minute:
* * * * * cd /path/to/folder && php worldCupNotifier.php >> worldCupNotifier.log
The code is ugly but it works.
Everything is posted in french, but feel free to fork and use your own language. FYI, FIFA API can provide text in en/fr/de/es/pt.