GithubHelp home page GithubHelp logo

darkalphaxteam / cyber-x-whatsapp-bot Goto Github PK

View Code? Open in Web Editor NEW
187.0 9.0 1.8K 631 KB

CYBER-X 2.0 WHATSAPP BOT BY DARKALPHAXTEAM

Home Page: https://github.com/darkalphaxteam/CYBER-X-WHATSAPP-BOT

JavaScript 99.84% Procfile 0.16%
whatsapp-bot cyber-x

cyber-x-whatsapp-bot's Introduction

CYBER-X WHATSAPP BOT

GIF

Authors

Support Group

Own

MIT License GPLv3 License AGPL License

Heroku Deployment

  1. Scan QR - Click here

  2. Fork the Repo - Click here

  3. Go app.json and Change "repostory" Url's user name to your user name ( Line 04 )

  4. Create your own Heroku template Link https://heroku.com/deploy?template={Your repo Link}

  5. Deploy now without Heroku Suspend

Features

  • Group Commands
  • Download Commands
  • 24 Work time
  • Full Costermizable
  • Free Deployments
  • Latest Baileys Using
  • 2x Respond Speed
  • Amazing Commands

Support

For support, email [email protected] or After deploying the bot you can join the CYBER-X support group by using the .joinsup command…

Feedback

If you have any feedback, please reach out to us at [email protected]

Environment Variables

To run this project, you will need to add the following environment variables to your .env file

SESSION_ID

HEROKU_APP_NAME

HEROKU_API_KEY

Script

If you need this non Obb Script or Make you own script with me ( Money propose Only ) - DARK_ALPHA

Info

Attention: You dont have permission to edit this script

Special Thanks: Vihanga YT, Nima , Sanuwa , Black Amda and Ravindu Manoj

Copyrights

This is the result of our team's hard work and our team owns the bot's rights and code rights. Therefore, you have no chance to change and submit our bot under any circumstances.

⚖️ CYBER - X DEVELOPER TEAM 2K23 ⚖️

DARK ALPHA
Founder & Developer
ROSHAN CHAMIKA
CO- Owner & CO-Coder
MR.NIMA
CO-Owner & CO-Coder
Akash Niranjana
Beta Tester
Nadun Dilhara
Bug Tester
Tharusha Suwahas
Bug Tester

cyber-x-whatsapp-bot's People

Contributors

darkalphaxteam avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cyber-x-whatsapp-bot's Issues

𝐒𝐓𝐑𝐄𝐄𝐓𝐊𝐈𝐍𝐆 ²⁰²⁴

import json
from dotenv import load_dotenv
import os
import requests
import aiohttp
import asyncio

--------------------------------------------------------------

Load environment variables

--------------------------------------------------------------

load_dotenv()
ACCESS_TOKEN = os.getenv("ACCESS_TOKEN")
RECIPIENT_WAID = os.getenv("RECIPIENT_WAID")
PHONE_NUMBER_ID = os.getenv("PHONE_NUMBER_ID")
VERSION = os.getenv("VERSION")

APP_ID = os.getenv("APP_ID")
APP_SECRET = os.getenv("APP_SECRET")

--------------------------------------------------------------

Send a template WhatsApp message

--------------------------------------------------------------

def send_whatsapp_message():
url = f"https://graph.facebook.com/{VERSION}/{PHONE_NUMBER_ID}/messages"
headers = {
"Authorization": "Bearer " + ACCESS_TOKEN,
"Content-Type": "application/json",
}
data = {
"messaging_product": "whatsapp",
"to": RECIPIENT_WAID,
"type": "template",
"template": {"name": "hello_world", "language": {"code": "en_US"}},
}
response = requests.post(url, headers=headers, json=data)
return response

Call the function

response = send_whatsapp_message()
print(response.status_code)
print(response.json())

--------------------------------------------------------------

Send a custom text WhatsApp message

--------------------------------------------------------------

NOTE: First reply to the message from the user in WhatsApp!

def get_text_message_input(recipient, text):
return json.dumps(
{
"messaging_product": "whatsapp",
"recipient_type": "individual",
"to": recipient,
"type": "text",
"text": {"preview_url": False, "body": text},
}
)

def send_message(data):
headers = {
"Content-type": "application/json",
"Authorization": f"Bearer {ACCESS_TOKEN}",
}

url = f"https://graph.facebook.com/{VERSION}/{PHONE_NUMBER_ID}/messages"

response = requests.post(url, data=data, headers=headers)
if response.status_code == 200:
    print("Status:", response.status_code)
    print("Content-type:", response.headers["content-type"])
    print("Body:", response.text)
    return response
else:
    print(response.status_code)
    print(response.text)
    return response

data = get_text_message_input(
recipient=RECIPIENT_WAID, text="Hello, this is a test message."
)

response = send_message(data)

--------------------------------------------------------------

Send a custom text WhatsApp message asynchronously

--------------------------------------------------------------

Does not work with Jupyter!

async def send_message(data):
headers = {
"Content-type": "application/json",
"Authorization": f"Bearer {ACCESS_TOKEN}",
}

async with aiohttp.ClientSession() as session:
    url = "https://graph.facebook.com" + f"/{VERSION}/{PHONE_NUMBER_ID}/messages"
    try:
        async with session.post(url, data=data, headers=headers) as response:
            if response.status == 200:
                print("Status:", response.status)
                print("Content-type:", response.headers["content-type"])

                html = await response.text()
                print("Body:", html)
            else:
                print(response.status)
                print(response)
    except aiohttp.ClientConnectorError as e:
        print("Connection Error", str(e))

def get_text_message_input(recipient, text):
return json.dumps(
{
"messaging_product": "whatsapp",
"recipient_type": "individual",
"to": recipient,
"type": "text",
"text": {"preview_url": False, "body": text},
}
)

data = get_text_message_input(
recipient=RECIPIENT_WAID, text="Hello, this is a test message."
)

loop = asyncio.get_event_loop()
loop.run_until_complete(send_message(data))
loop.close()

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.