Arduino Whatsapp Messages - Send Whatsapp Messages Using Pi or Arduino


4,997

5

I am an electronic engineer and i have been working on embedded system , Iot and Artificial intel...

There was a time when SMS was one of the most powerful communication tools but with the arrival of Android phones and social networks, the trend has changed and people have switched to Whatsapp due to simplicity and the cheap messaging service which helps you send multimedia easily.

originally posted at https://highvoltages.co/tutorial/arduino-tutorial/arduino-whatsapp-messages-send-whatsapp-messages-using-pi/

People have been using GSM to send the alert message using Arduino but with the change of trend, we should change our approach too. So, in this instructable, we will be going to discuss how to integrate WhatsApp alert messages using Arduino and it will save the money you would have spent on GSM module.

NOTE: You can use this method for Arduino, raspberry pi or you can use it simply with python on any platform.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Setup Twilio Account

We will be using Twilio API for python to send WhatsApp Alert message. In order to get started with twilio, you will have to follow the following steps,

  1. Go to www.twilio.com .
  2. Sign up for an account.
  3. Verify your number.
  4. Then navigate to SMS chatbot.
  5. Give your project a name.
  6. A flow chart will be opened, but as we are using Twilio API for python we do not need that instead go to programmable SMS.
  7. Go to WhatsApp.
  8. Activate sandbox by going into the sandbox.
  9. Then you will be given a WhatsApp number and a code, you will have to send SMS with that code to the number.
  10. Your number will be added and then you will have to go to the console and copy your Account SID and auth token.

Step 2: Install Twilio Library and Run Basic Code

Now make sure you have python installed in your laptop or Raspberry Pi. Go to terminal or command prompt and write,

pip install twilio 

then paste your account SID and auth token in code and run the program,

# Download the helper library from https://www.twilio.com/docs/python/install

from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/console

account_sid = 'AC1d8ea8f74325f727ccbd85a78e20e23a'

auth_token = 'your_auth_token'

client = Client(account_sid, auth_token)

message = client.messages.create(

body='Hello there!',

from_='whatsapp:+14155238886',

to='whatsapp:+15005550006'

)

print(message.sid)

Step 3: Arduino Connection

Make Arduino connection and upload the following code,

int val;
int tempPin = 0;

void setup() { Serial.begin(9600); }

void loop() { val = analogRead(tempPin); float mv = ( val/1024.0)*5000; float cel = mv/10; if(cel>=22.00){ Serial.println(cel); } delay(1000); }

Step 4: Video Tutorial

Step 5: Follow Us on Social Media

Be the First to Share

    Recommendations

    • Made with Math Contest

      Made with Math Contest
    • Multi-Discipline Contest

      Multi-Discipline Contest
    • Robotics Contest

      Robotics Contest

    Discussions