Closed thorwebdev closed 2 years ago
grammY is a framework for the Telegram Bot API. What do you mean by "support for the WhatsApp Cloud API"?
This is like opening an issue in discordjs/discord.js and asking for Telegram support.
The scope of grammY is limited to the Telegram Bot API. Supporting any other APIs is not a goal of this project. This includes APIs designed by Meta.
There are several reasons why the WhatsApp API won't be supported. I won't list them all, but give example reasons from the different dimension of such an undertaking.
From a technological point of view, trying to bring WhatsApp support to grammY is pointless. grammY is tailored towards the Telegram Bot API and tries to be the perfect match for it. The WhatsApp Cloud API works fundamentally different in almost every respect. For example, sent messages are delivered via callback which means that neither the API nor the client nor the middleware system nor filter queries transfer well. As a result, there would be virtually no code that could be shared between the projects. Hence, it's better to start a separate project, rather than trying to add this to grammY.
From a strategic point of view, we only have limited time and people to work on things. Every minute someone spends on a WhatsApp integration is not being spent on making the library work better for Telegram. It makes more sense to do one thing really well, than to try to do two things poorly.
From a social point of view, we can observe that the grammY contributors are a relatively diverse set of people, spread across cultures, languages, timezones, levels of experience, and age groups. However, there is one common denominator that everyone agrees on: we all use Telegram, and most of us use it quite regularly. It is not clear why this shared interest would work for WhatsApp with the same set of people in the community. This means that we need to assume that a new community would have to be built from scratch. (I'm ignoring the fact that you cannot have a community on WhatsApp at all because of too tight group size limits.)
From a motivational point of view, we need to take into account that there are factors that motivate people to contribute to one project but not another. A reason many people contribute to grammY is because it is an outstanding piece of technology, and this creates some sort of perfectionism among the people. We aspire to build something better than anything else out there. In contrast, frankly speaking, the WhatsApp Cloud API has a horrible design in many respects. I fail to see how any good library could be built around that. Without a great project, you have one fewer source of motivation for people to contribute. Without people, there is no code, so trying to support WhatsApp will be a lonely task and hence hard to do.
From an ideological point of view, I like to do open source because it empowers people. The WhatsApp Cloud API is a commercial product and you need to pay in order to use it at a scale that can make any difference in the world. This may be attractive to businesses, but I don't think open source is the right model for this. The absence of good OSS libraries for WhatsApp indicates that this is true.
From a moral point of view, it is Meta. This company does so many things systematically and consistently wrong that I would not know how to justify spending my free time on supporting them.
On the bright side, you are still able to write a tutorial for a WhatsApp bot on supabase because you do not need a framework for that. It will not be as easy (all of the above reason contribute to that) but it's still possible, and it will likely work well enough for companies who actually want to use the API.
@KnorpelSenf thanks for your thoughtful response. I agree that a separate project makes more sense, I only hope that whoever/ifever someone takes it on that they take inspiration from grammY, because it's absolutely beautiful, thanks for everyone's work here! 💚
I guess for now I'll be fighting with the Graph API directly 😉
Thank you, that's great to hear! Good luck :)
In response to our grammY Supabase example some folks were asking about a WhatsApp API example, and since I love grammY's DX I was wondering if you had any plans to add support for the WhatsApp Cloud API?
I came across this project https://github.com/tawn33y/whatsapp-cloud-api/issues/18 but it doesn't look like it supports Deno (yet).