## <center> Hello everyone</center> In this post, we are going to learn how to send a message to WhatsApp using JavaScript/node.js. In this video, we will send some messages to my WhatsApp number through a small piece of code. We are going to use Twilio Node Library. This will help us connect our code to the WhatsApp. So let's begin the tutorial. * First of all, if you don't have the Nodejs installed please install it from the official site. * Now go to the [Twilio](https://www.twilio.com/) website and create a free account.  After creating the account login to your account and click on the three dots.  Now click on the programmable SMS .  Click on the whatsapp beta and then activate the sanbox  Now send the given code to the given number in order to connect your WhatsApp number.  You will get a message like this after sending the code to the number.  Now go back to the main page of Twilio and copy the following keys.  Open VS Code and install the Twilio library by running the following command. ``` npm install twilio``` Wait for the installation and then copy-paste the below code to a newly .js file ``` const accountSid =YOUR_SID; const authToken = YOUR_KEY; const client = require('twilio')(accountSid, authToken); client.messages .create({ from: 'whatsapp:+14155238886', body: 'Hello from nodejs', to: RECIVER-NUMBER }) .then(message => console.log(message.sid)); ``` Assign the keys to the variables.  In my case, I have created a JSON file and everything ting is in the JSON. Just for privacy purpose you can just assign them to the variables. Let's run the script now  If your message is sent successfully you should get output like this  As you can see the messages are successfully sent. If you want to change the message just change the text in body and rerun the code.  <center> **I think this much is enough for today. Now if you like the post please upvote and comment if you want to give me some advise** </center>
author | pakgamer |
---|---|
permlink | how-to-send-message-to-whatsapp-using-javascript-node-js-twilio |
category | hive-148441 |
json_metadata | {"tags":["hive-148441","programming"],"image":["https://images.hive.blog/DQmVv1rMr1hNN65NKtdPsrztau6niEPy8QSRBywBPavZSqP/image.png","https://images.hive.blog/DQmYszS4CmEi7sCaNoudz7z3Ar5AgxBKoJnG9CHHosSvBUD/image.png","https://images.hive.blog/DQmf6cL6SYh3d7o5irBc7T4QxP7paG7fbxWX5632qa9uVf6/image.png","https://images.hive.blog/DQmcXv4dt75ScA3ktKNNuSoWTe3bSmCA8JJgZqfDCAUNUXn/image.png","https://images.hive.blog/DQmV6fZR72VeZSnzmb5ckHJU4XGZMYBM8GgcgC9TpYJrCLS/image.png","https://images.hive.blog/DQmcTDG4gXjPKH18FQVCBNYWvWtx1dUoYeGgv4LZmgsZUcC/image.png","https://images.hive.blog/DQmNyDPWL8pnMaXFHdna7e6F1bCUxpuxQU5U1WNiJ8Yn8F5/image.png","https://images.hive.blog/DQmUFvTAx7PpbWHNh4jDEJEZTYUGL9MYDKcxpikSNyJCZoX/image.png","https://images.hive.blog/DQmPsqeoAdF9zwbdu3FqiErcTjgamsGPRTX8ypjRtTvbawk/image.png","https://images.hive.blog/DQmeHDq85awE7gTgme7pt6agz2utgh3WPKMGMamiUWVgZcL/image.png","https://images.hive.blog/DQmdY8HQq6bYUQs4m5hScTx5U1S1nXvZbrNq4gmEN7KBXCw/image.png","https://images.hive.blog/DQmd3WcHH8i6U2JkmnrvEvd4FwjDQxJtG3Tnhzxdjswktdx/ntitled-1.png"],"links":["https://www.twilio.com/"],"app":"hiveblog/0.1","format":"markdown"} |
created | 2020-06-20 19:43:51 |
last_update | 2020-06-20 19:43:51 |
depth | 0 |
children | 2 |
last_payout | 2020-06-27 19:43:51 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 5.722 HBD |
curator_payout_value | 5.479 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 3,198 |
author_reputation | 19,304,605,112,640 |
root_title | "How To Send Message TO WhatsApp Using JavaScript/Node.js-- Twilio" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 98,081,822 |
net_rshares | 26,908,178,852,596 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
gerber | 0 | 130,273,832,380 | 1.9% | ||
daan | 0 | 58,373,756,000 | 8% | ||
ezzy | 0 | 149,978,790,261 | 1.9% | ||
arcange | 0 | 59,025,451,824 | 2% | ||
exyle | 0 | 188,903,849,913 | 1.9% | ||
raphaelle | 0 | 1,552,892,359 | 2% | ||
netaterra | 0 | 37,957,909,858 | 1.71% | ||
lordneroo | 0 | 1,687,884,145 | 9.2% | ||
frankk | 0 | 10,129,958,496 | 10% | ||
dune69 | 0 | 6,458,036,985 | 1.9% | ||
eliel | 0 | 18,659,687,562 | 10% | ||
mys | 0 | 712,323,785 | 0.19% | ||
improv | 0 | 1,250,673,554 | 1.5% | ||
d-pend | 0 | 27,049,810,519 | 1% | ||
furious-one | 0 | 16,274,015,583 | 20% | ||
raili | 0 | 1,071,997,242 | 10% | ||
runicar | 0 | 94,596,718,546 | 9.2% | ||
codingdefined | 0 | 14,518,130,005 | 6% | ||
shitsignals | 0 | 587,496,164 | 1.9% | ||
stinawog | 0 | 1,598,090,614 | 10% | ||
pardeepkumar | 0 | 19,525,185,134 | 9.2% | ||
felander | 0 | 7,944,744,057 | 1.9% | ||
crokkon | 0 | 2,165,457,419 | 8% | ||
accelerator | 0 | 54,551,034,790 | 5% | ||
yogacoach | 0 | 687,061,899 | 0.95% | ||
roleerob | 0 | 2,226,660,857 | 0.38% | ||
deathwing | 0 | 1,915,519,762 | 1.9% | ||
investegg | 0 | 841,425,309,226 | 21.21% | ||
nathanpieters | 0 | 2,935,398,823 | 9.5% | ||
caladan | 0 | 6,803,208,752 | 1.9% | ||
blockbrothers | 0 | 697,863,810 | 0.95% | ||
emrebeyler | 0 | 45,164,778,001 | 1.9% | ||
arindammroy | 0 | 764,273,929 | 19% | ||
ocupation | 0 | 22,739,340,177 | 9.2% | ||
kamchore | 0 | 316,202,823,640 | 100% | ||
enjoyinglife | 0 | 2,262,213,279 | 9.2% | ||
adityajainxds | 0 | 5,054,384,253 | 10% | ||
upmewhale | 0 | 21,731,930,588,287 | 19% | ||
mmmmkkkk311 | 0 | 166,262,666,736 | 2.5% | ||
nealmcspadden | 0 | 37,854,292,680 | 1.9% | ||
bala41288 | 0 | 48,767,890,411 | 20% | ||
curx | 0 | 34,891,636,228 | 10% | ||
purefood | 0 | 19,941,399,234 | 1.9% | ||
chronocrypto | 0 | 67,911,934,179 | 1.9% | ||
cadawg | 0 | 3,738,550,683 | 1.33% | ||
kristves | 0 | 13,921,828,368 | 13% | ||
pkocjan | 0 | 757,618,556 | 1.52% | ||
ofildutemps | 0 | 873,979,429 | 10% | ||
mindtrap | 0 | 305,843,491,600 | 9.2% | ||
bestboom | 0 | 7,357,420,013 | 1.9% | ||
onepercentbetter | 0 | 5,149,164,036 | 2.5% | ||
freddio | 0 | 25,708,240,527 | 15% | ||
medicoilustrado | 0 | 741,905,519 | 100% | ||
sustainablelivin | 0 | 540,281,617 | 5% | ||
steem.services | 0 | 704,017,975,017 | 10% | ||
pladozero | 0 | 77,195,183,608 | 10% | ||
nateaguila | 0 | 288,020,533,259 | 8% | ||
merlion | 0 | 886,266,934 | 2.5% | ||
digital.mine | 0 | 198,042,840,165 | 1% | ||
swisswitness | 0 | 1,103,630,153 | 1.9% | ||
milaan | 0 | 3,529,735,056 | 9.2% | ||
attention-seeker | 0 | 6,406,153,821 | 100% | ||
tech-coin | 0 | 3,937,999,224 | 100% | ||
dlike | 0 | 23,939,886,436 | 1.9% | ||
coinmarketcal | 0 | 45,563,611,862 | 77% | ||
engrave | 0 | 24,532,569,676 | 1.8% | ||
bobby.madagascar | 0 | 681,257,170 | 0.47% | ||
laissez-faire | 0 | 73,619,587 | 100% | ||
artistsrising | 0 | 17,890,384,313 | 100% | ||
followjohngalt | 0 | 10,255,980,443 | 1.9% | ||
infinite-love | 0 | 595,904,025 | 10% | ||
ctime | 0 | 568,802,923,527 | 5% | ||
goodcontentbot | 0 | 798,676,689 | 15% | ||
coinmarketcal2 | 0 | 9,667,958,854 | 100% | ||
hungrybear | 0 | 126,882,435 | 2.5% | ||
daijiworld | 0 | 12,646,301,181 | 100% | ||
bergelmirsenpai | 0 | 594,980,155 | 10% | ||
iamjohn | 0 | 544,663,601 | 9.5% | ||
milu-the-dog | 0 | 792,331,998 | 1.9% | ||
jferdous | 0 | 355,612,580 | 25% | ||
triplea.bot | 0 | 642,310,455 | 1.9% | ||
steem.leo | 0 | 49,628,836,294 | 1.9% | ||
freddio.sport | 0 | 4,392,720,456 | 15% | ||
asteroids | 0 | 10,885,877,349 | 1.9% | ||
valerianis | 0 | 895,624,179 | 7.6% | ||
mapxv | 0 | 10,792,027,776 | 29% | ||
botante | 0 | 20,068,229,023 | 10% | ||
pakgamer | 0 | 20,036,231,071 | 100% | ||
maxuvd | 0 | 20,983,435,246 | 6% | ||
gerbo | 0 | 0 | 1.9% | ||
chicoduro | 0 | 853,074,893 | 100% | ||
sacrosanct | 0 | 2,699,808,633 | 9.2% | ||
ribary | 0 | 580,694,270 | 0.95% | ||
mice-k | 0 | 7,472,344,988 | 1.9% | ||
steemcityrewards | 0 | 427,916,313 | 1.9% | ||
dpend.active | 0 | 594,660,633 | 0.38% | ||
fengchao | 0 | 1,421,053,951 | 2% | ||
gitplait | 0 | 60,291,454,858 | 100% | ||
polish.hive | 0 | 4,894,374,325 | 1.9% | ||
dcityrewards | 0 | 46,834,598,023 | 1.9% | ||
hf18 | 0 | 12,630,007,001 | 100% | ||
hivecur | 0 | 4,230,259,384 | 1.9% |
Another good tutorial. @pakgamer you efforts for sharing knowledge by making amazing tutorial are laudable. We are looking for people like you in our community. Your post has been curated with @gitplait community account because this is the kind of publications we like to see in our community. Join our Community on [Hive](https://hive.blog/trending/hive-103590) and Chat with us on [Discord](https://discord.com/invite/CWCj3rw).
author | gitplait-mod1 |
---|---|
permlink | qc9m61 |
category | hive-148441 |
json_metadata | {"users":["pakgamer","gitplait"],"links":["https://hive.blog/trending/hive-103590","https://discord.com/invite/CWCj3rw"],"app":"hiveblog/0.1"} |
created | 2020-06-21 07:30:03 |
last_update | 2020-06-21 07:30:03 |
depth | 1 |
children | 0 |
last_payout | 2020-06-28 07:30:03 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 433 |
author_reputation | 64,455,719,431 |
root_title | "How To Send Message TO WhatsApp Using JavaScript/Node.js-- Twilio" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 98,090,105 |
net_rshares | 0 |
Congratulations @pakgamer! You have completed the following achievement on the Hive blockchain and have been rewarded with new badge(s) : <table><tr><td><img src="https://images.hive.blog/60x70/http://hivebuzz.me/@pakgamer/upvotes.png?202006220304"></td><td>You distributed more than 500 upvotes. Your next target is to reach 600 upvotes.</td></tr> </table> <sub>_You can view [your badges on your board](https://hivebuzz.me/@pakgamer) And compare to others on the [Ranking](https://hivebuzz.me/ranking)_</sub> <sub>_If you no longer want to receive notifications, reply to this comment with the word_ `STOP`</sub> ###### Support the HiveBuzz project. [Vote](https://hivesigner.com/sign/update_proposal_votes?proposal_ids=%5B%22109%22%5D&approve=true) for [our proposal](https://peakd.com/me/proposals/109)!
author | hivebuzz |
---|---|
permlink | hivebuzz-notify-pakgamer-20200622t074647000z |
category | hive-148441 |
json_metadata | {"image":["http://hivebuzz.me/notify.t6.png"]} |
created | 2020-06-22 07:46:45 |
last_update | 2020-06-22 07:46:45 |
depth | 1 |
children | 0 |
last_payout | 2020-06-29 07:46:45 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 812 |
author_reputation | 370,776,866,904,634 |
root_title | "How To Send Message TO WhatsApp Using JavaScript/Node.js-- Twilio" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 98,108,331 |
net_rshares | 0 |