4

How to integrate WhatsApp with rails application? or how to send a message using rails application.

Is there any gem or plugin available?

Deepak Mahakale
  • 22,834
  • 10
  • 68
  • 88
Santosh Kumbhar
  • 183
  • 3
  • 15

3 Answers3

1

You can use twilio for sending whatsapp messages -
https://www.twilio.com/whatsapp
They only problem is that they don't provide service for sending whatsapp messages in India as of today.

But you can send whatsapp messages in India using textlocal(third party service provider). You can find documentation here - https://api.textlocal.in/docs/send-whatsapp

You can use this gem as well - https://github.com/getninjas/whatsapp
To use this gem, you would require to follow the documentation provided by facebook. https://developers.facebook.com/docs/whatsapp/getting-started

Vivek Kumar
  • 2,625
  • 2
  • 25
  • 33
1

This gem could be useful for the Whatsapp Cloud API.

https://github.com/ignacio-chiazzo/whatsapp_sdk

This is an example:

client = WhatsappSdk::Api::Client.new(ACCESS_TOKEN) # replace this with a valid access_token
messages_api = WhatsappSdk::Api::Messages.new(client)
phone_numbers_api = WhatsappSdk::Api::PhoneNumbers.new(client)

phone_numbers_api.registered_number("107878721936019")
phone_numbers_api.registered_numbers("114503234599312") 

messages_api.send_text(sender_id: SENDER_ID, recipient_number: RECEIPIENT_NUMBER, message: "hola")
messages_api.send_location(
  sender_id: SENDER_ID, recipient_number: RECEIPIENT_NUMBER, 
  longitude: 45.4215, latitude: 75.6972, name: "nacho", address: "150 elgin street"
)

More examples on this file.

Ignacio Chiazzo
  • 947
  • 11
  • 25
-1

I found a couple of them but I haven't tried them and the last commit was 3-4 years ago so not sure if they still work,

https://github.com/ongair/whatsapi

https://github.com/wawandco/whathor

Subash
  • 3,128
  • 6
  • 30
  • 44