Live data from Hacker News

Build a WhatsApp Chatbot with Python, Flask and Twilio

twilio.com

31–40 of 66 posts

Re: Build a WhatsApp Chatbot with Python, Flask and Twilio

#31
post #5
post #4

This is funny because just today I decided to join Telegram to develop a bot.

Telegram bot writing is silly easy. If you use the python module you can basically just write the whole thing as a set of functions in a file (with decorators that watch telegram for triggers) and one function that automatically polls and does all the responding at the end. I managed to bang out a few when I had a day off a few months back. Very satisfying.

Writing a Telegram bot is easy yes but writing a good one isn't. There are some very tricky things involved which you basically can not know and wont find in the Documentation. It forces you to run into problems first and then look for solutions. Especially if your bot gets decent amount of traffic something in the range of 1msg/s and above.

The people at https://t.me/BotDevelopment (unofficial) are your best chance for support because Telegram (bot) support is a joke.

Re: Build a WhatsApp Chatbot with Python, Flask and Twilio

#32

I really didn't like the WhatsApp approach on this. Basically only partnering with few big vendors like twilio and then asking people to build apps via them (by basically paying for it). Other apps like telegram allows anyone to directly interact with them

FB paid something like 20bn for Whatsapp almost 6 years ago. Something like 4bn was paid in cash. How do you make that money back if: a) users do not pay a subscription and b) ads are not printed in the app? You leverage the app's immense user base asking businesses to pay for API services so they can implement chat-bots, notifications, in-app tools, etc. Why using res-sellers, like carriers use re-sellers to sell SM…

They don't necessarily need to put ads in the app. They can simply transfer that personal information to their larger people profiles making their existing ad networks more valuable. It could additionally be simply a play to keep someone _else_ from getting said data. (I think your argument still makes sense, just another angle on that part).

Re: Build a WhatsApp Chatbot with Python, Flask and Twilio

#33

Chatbots on Whatsapp are kind of hard from a UX point of view because the platform don't support rich elements like buttons or webviews (unlike Facebook messenger). I hope Whatsapp adds these kind of features soon, otherwise users will get frustrated when interacting with bots and never use it to talk to businesses again. And no, AI/NLP is not the answer to this because users are lazy and prefer to tap on buttons tha…

“... rich elements like buttons or webviews (unlike Facebook messenger). I hope Whatsapp adds these kind of features soon”. I on the other hand hope they never add these kind of features. If I wish to converse with bots, spam, ads etc. I could always reinstall fb messenger or enjoy the pop ups on every other website. I know I’m being naive but I hope whatsapp is left alone by fb.

Re: Build a WhatsApp Chatbot with Python, Flask and Twilio

#34

Chatbots on Whatsapp are kind of hard from a UX point of view because the platform don't support rich elements like buttons or webviews (unlike Facebook messenger). I hope Whatsapp adds these kind of features soon, otherwise users will get frustrated when interacting with bots and never use it to talk to businesses again. And no, AI/NLP is not the answer to this because users are lazy and prefer to tap on buttons tha…

No thank you. I like whatsapp for its simplicity. If I wanted a copy of Messenger or Telegram I would use those instead.

Re: Build a WhatsApp Chatbot with Python, Flask and Twilio

#35

Hey all, I'm the engineering manager for teams at Twilio responsible for WhatsApp integration, among other channels. We're more than happy to answer any technical or general questions -- fire away with replies. Will keep an eye on it today.

Will this be available in Germany as well? My company is already using your services for sms and happy about it.

Re: Build a WhatsApp Chatbot with Python, Flask and Twilio

#36
I'm about to release a bot for Whatsapp for NanaGram (https://nanagram.co). Amped!

The user experience of SMS-first products is novel and fun. There's something magical about snapping a photo and just texting it to a unique NanaGram number powered by Twilio. It takes just a couple seconds. I'm excited to deliver the same experience through Whatsapp to customers around the globe and people on wifi.

Building NanaGram SMS-first has been a challenge. There have been all kinds of gotchas:

1) AT&T started blocking any number permanently across its network last January if it contains a hyperlink or email address, even if the customer interacts with the number. I had to create separate messages just for the 12.5% AT&T users.

2) Twilio only works when you have cell service. If you're indoors with wifi only, the text won't go through.

3) Images are downsized in an unpredictable way by the carriers. If you're sending 1 or a couple images, they're pretty good quality. If you send ~5+ photos, they get downsized pretty far and luckily they're still good enough for 4x6 photo printing. Certain carriers like cricket are super aggressive with downsizing.

4) When Apple users with iCloud enabled share more than 1 image, it generates a sharing album which has been a beast to support. Then there's the added challenge of Apple's recent move to HEIC/HEIF images.

5) Twilio doesn't support group threads (WhatsApp doesn't yet, either)

... I could go on and on.

Getting approval from Whatsapp took a while. I first applied about a year ago and didn't hear anything, then applied again and was approved a few weeks ago. I'm guessing the approval layer is to ensure only high-quality bots make the cut. They also have an approval layer for all of your messages sent outside a 24-hour window of the last user interaction. The approval for that took a few days.

Integration with WhatsApp has been surprisingly easy. I basically just had to change "+1{number}" to "whatsapp+1{number}"

Re: Build a WhatsApp Chatbot with Python, Flask and Twilio

#37
post #21

This is nice but quite expensive. Up to 0.09$ per message inbound or outbound! Pricing for Template messages Outbound template messages to WhatsApp destinations have two different components: Edit: Here's the price breakdown. [0] > Twilio charges a flat fee of $0.005 per message for all WhatsApp messaging. This applies to all incoming messages, outbound Template and Session messages. > WhatsApp also charges a per-mes…

Howdy! It's actually $0.005. Agree that a nickel would be expensive ;)

Re: Build a WhatsApp Chatbot with Python, Flask and Twilio

#38
post #21

This is nice but quite expensive. Up to 0.09$ per message inbound or outbound! Pricing for Template messages Outbound template messages to WhatsApp destinations have two different components: Edit: Here's the price breakdown. [0] > Twilio charges a flat fee of $0.005 per message for all WhatsApp messaging. This applies to all incoming messages, outbound Template and Session messages. > WhatsApp also charges a per-mes…

I think it's actually $0.005 which is 1/2 a cent. I hope so, at least!

Re: Build a WhatsApp Chatbot with Python, Flask and Twilio

#39
post #36

I'm about to release a bot for Whatsapp for NanaGram ( https://nanagram.co ). Amped! The user experience of SMS-first products is novel and fun. There's something magical about snapping a photo and just texting it to a unique NanaGram number powered by Twilio. It takes just a couple seconds. I'm excited to deliver the same experience through Whatsapp to customers around the globe and people on wifi. Building NanaGram…

> 1) AT&T started blocking any number permanently across its network last January if it contains a hyperlink or email address, even if the customer interacts with the number. I had to create separate messages just for the 12.5% AT&T users.

I don't follow - they blocked any number which replied with a hyperlink or email?

Can users of AT&T not send them to each other?

Re: Build a WhatsApp Chatbot with Python, Flask and Twilio

#40

Hey all, I'm the engineering manager for teams at Twilio responsible for WhatsApp integration, among other channels. We're more than happy to answer any technical or general questions -- fire away with replies. Will keep an eye on it today.

So are you planning to offer any sort of NLU services or just the webhook?

Absolutely, Autopilot (https://www.twilio.com/autopilot) handles a lot of the low level natural language processing bits you'd otherwise have to build with nltk or TextBlob (if you're working in Python). The Autopilot Python quickstart in our Docs is probably the easiest way to see how it works: https://www.twilio.com/docs/autopilot/quickstart/python and then you can connect WhatsApp to Autopilot using these instructions https://www.twilio.com/blog/build-whatsapp-bots-twilio-autop...
Post reply on HN