In december Telegram released “Voice chat” for groups, which is a very neat feature. This open ups for an idea I’ve had in the idea box for a couple of years: Crowdsourced traffic information
There can currently be 200 000 people in a Telegram group. The idea is to combine traffic information from P4 and Trafikverket with crowdsourced comments and observations. When something happens in traffic you can report live what you see. I’ve started the experiment here: https://t.me/skjutsgruppen_trafik
I’m looking into having a bot that publish traffic information from P4 and Trafikverket in the group, and been going through the first steps with BotFather. Seems to be not too difficult: https://core.telegram.org/bots
Anyone got any experience with building or best practices?
Not answering your question exactly*, but have you thought of faking it with IFTTT? It can post in your group eg relevant info from P4 and Trafikverket feeds. Might be worth it as a first step, to verify the concept.
Not much of a bot developer but I have a paying account on IFTTT, let me know if I can help.
That’s a very good idea! As you say, that could work as a proof of concept. I tried it right away. We have an IFTTT account for Skjutsgruppen, but it’s not a paid one so we will see if it makes a difference. I found an IFTTT that sends RSS to a Telegram group, and then found this RSS from P4: https://api.sr.se/api/rss/program/183
Had a look @mattiasjay and I’m afraid P4’s RSS won’t do. It seems the feed is updated a lot less frequently than the webpage you’re seeing (i.e. most recent item in the feed was from 2 days ago).
This is understandable since there are different pieces of code running here. For the webpage, they are using Trafikverkets API (here), which pulls data every time you load the page. For the RSS, I am guessing they are using some code that runs automatically every e.g. day. This doesn’t make sense in this page, but the RSS infrastructure is probably the same for the whole site.
I think the only reasonable option is to use the API itself. It’s not very difficult but it’s not easy either.
Sorry to be the bearer of bad news - wish I had more time to help you.
I don’t know much about telegram bot either and have never interacted with one before. I made a quick one directional bot with 2 lines of code that just posts new traffic information in the group, right now you can’t interact with it.
I can see maybe it’s possible to subscribe to only information for a selected region/city/road using commands but then it will be either 1vs1 chat or same region for all in the group and it would need bigger backend that listens to user commands.