B4J Question How to send whatsapp message with attachment via B4J code?

amorosik

Expert
Licensed User
I'd like to create a program that listens for external requests and sends a WhatsApp message with attachments to a specific phone number
I see that many people use Internet Explorer as the loading method and then resort to sending keys, or Chrome and Selenium
Both options aren't satisfactory for me; the first is due to the inherent fragility of the sendkey, and the second because it requires external libraries that aren't always easy to load and use

Still using a free solution, and having WhatsApp Web active on any browser (for example Firefox), how can I enable the B4J code to send a message with attachments to a specific phone number?
 

AHilton

Active Member
Licensed User
Longtime User
Use the WhatsApp API or a 3rd party API service (Twilio, WASender, Vonage, Make, etc.). I've not used WhatsApp functionality, specifically, but the API is included in some of the ones I do use for SMS, MMS and so on.
 
Upvote 0
I'd like to create a program that listens for external requests and sends a WhatsApp message with attachments to a specific phone number
I see that many people use Internet Explorer as the loading method and then resort to sending keys, or Chrome and Selenium
Both options aren't satisfactory for me; the first is due to the inherent fragility of the sendkey, and the second because it requires external libraries that aren't always easy to load and use

Still using a free solution, and having WhatsApp Web active on any browser (for example Firefox), how can I enable the B4J code to send a message with attachments to a specific phone number?
IMHO, Green API is the best option. Its free for up to certain level. https://green-api.com/en . I am using it to send daily Good Morning messages with images to my whatsapp group :p ( I am using Google App Script)
 

Attachments

  • greenAPI.png
    greenAPI.png
    44.4 KB · Views: 41
Upvote 0

Mariano Ismael Castro

Active Member
Licensed User
Longtime User
You can use GreenApi with the free plan.

More information
 
Upvote 0

amorosik

Expert
Licensed User
On the free Developer plan, you can interact with 3 chats total (contacts or groups), and receive notifications from only 3 chats. I understand that you will be sending to only 1 fixed phone number so the 3 chat limit is not a problem unless you are receiving message from multiple chats but are sending file to 1 specific phone number .

Yes, I wrote to a specific number
I wrote it to avoid anyone thinking I was sending to a WhatsApp group
Actually, I'd like to send the message first to phone 1, then to phone 2, etc.
 
Upvote 0
Yes, I wrote to a specific number
I wrote it to avoid anyone thinking I was sending to a WhatsApp group
Actually, I'd like to send the message first to phone 1, then to phone 2, etc.
Ha, Ok. I don't know how to do it in B4J but you can create your own WhatsApp web instance and interact with it in node js using "whiskeysockets/baileys". It will create QR to link just like whatsapp web. After linking, you can send files to anyone who sends key word to your WhatsApp number. Perhaps you can figure out how to link b4j to it?
Here is example code in node js, if you want:
 
Upvote 0
Top