coffeebeforecode

sendMessageTest.py

Aug 28th, 2021
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.95 KB | None | 0 0
  1. import subprocess
  2. import sys
  3.  
  4. def install(package):
  5.     subprocess.check_call([sys.executable, "-m", "pip", "install", package])
  6.  
  7. install("pyautogui")
  8. install("pandas")
  9.  
  10. import pyautogui as pg
  11. import webbrowser as web
  12. import time
  13. import pandas as pd
  14.  
  15. message = '''Greetings from Sigma Xi,%0a
  16. %0a
  17. Thank you for registering for Sigma Xi’s Rendezvous: The Research Stream. We are delighted to have you join us for Episode 1 of our talk show series.%0a
  18. %0a
  19. Our speaker, Mr. Anshuman Acharya, will guide you through the complexities of research and help you dive deeper into what it takes to start and develop your career around research and development. He'll walk you through his journey of getting into the field of research and provide valuable insights on the everyday life of a research expert.%0a
  20. %0a
  21. The event will be on the 29th of August, 2021 from 5:00 pm to 6:30 pm on MS Teams.%0a
  22. %0a
  23. Looking forward to seeing you there. You can join the event through the link given below.%0a
  24. %0a
  25. For any queries, contact:%0a
  26. Rujul Srivatsava%0a
  27. %2B91 8595347523%0a
  28. %0a
  29. Event Details:%0a
  30. %0a
  31. Name: Rendezvous%0a
  32. Date: 29th August 2021%0a
  33. Timing: 5:00 pm to 6:30 pm%0a
  34. Meeting Link:  bit.ly/SigmaXiRendezvousEp1 %0a
  35. %0a
  36. Find us on:%0a
  37. %0a
  38. LinkedIn: %0a
  39. www.linkedin.com/company/sigma-xi-vit/mycompany/ %0a
  40. %0a
  41. Instagram: %0a
  42. www.instagram.com/sigmaxi.vit/ %0a
  43. %0a
  44. Facebook: %0a
  45. www.facebook.com/SigmaXiVIT/ %0a
  46. %0a
  47. Regards%0a
  48. Team Sigma Xi VIT'''
  49.  
  50. workbook = pd.read_excel('test.xlsx')
  51.  
  52. data_dict = workbook.to_dict('list')
  53. numbers = data_dict['Number']
  54. first = True
  55. for num in numbers:
  56.     print("Sending message to", int(num))
  57.     time.sleep(4)
  58.     web.open("https://web.whatsapp.com/send?phone="+f"91{int(num)}+"+"&text="+message)
  59.     if first:
  60.         time.sleep(6)
  61.         first=False
  62.     width,height = pg.size()
  63.     pg.click(width/2,height/2)
  64.     time.sleep(8)
  65.     pg.press('enter')
  66.     time.sleep(8)
  67.     pg.hotkey('ctrl', 'w')
Add Comment
Please, Sign In to add comment