Ok,
Is there currently a way to integrate with Ignition?
Is there an open-source platform that provides an API or is it possible through custom scripting?
Probably. What have you tried? The 'turn key' solution is not available until 8.3. Anything you can find in the meantime is going to take some effort on your part.
You don't need Webdev for outgoing HTTP calls; you can use system.net.httpClient - you'll just have to figure out how to authenticate and make the appropriate requests to Whatsapp.
**API generate python script. ** (Run through CMD, for example python app.py) FAST API
from fastapi import FastAPI, HTTPException, Request
from pydantic import BaseModel
import pywhatkit
import uvicorn
import asyncio
app = FastAPI()
# Define the expected request body
class MessageRequest(BaseModel):
phone: str
message: str
@app.post("/send")
async def send_message(req: MessageRequest):
if not req.phone or not req.message:
raise HTTPException(status_code=400, detail="Missing phone or message")
try:
await asyncio.to_thread(pywhatkit.sendwhatmsg_instantly,req.phone, req.message)
return {"status": "success", "details": "Message sent"}
except Exception as e:
raise HTTPException(status_code=500, detail=str(e))
if __name__ == "__main__":
uvicorn.run(app, host="0.0.0.0", port=5005)
Problem: Each time the HTTP POST script is triggered from Ignition, a new WhatsApp Web session is opened in the browser, causing the previous session to close. Ideally, WhatsApp Web should run in the background without launching a new browser window or tab on every execution.
Is it possible to execute WhatsApp Web in the background (headless mode or via backend service) when sending messages, so that the browser does not visibly open during each message trigger?
The user should only need to link WhatsApp Web to the mobile device once.
After the initial linking, message triggers should occur silently, without visibly opening WhatsApp Web in the browser.
You should not be calling system.net.httpClient() for every operation. The client object it returns is expected to be reused. Place that assignment outside your function at the outer level of a project library script module, so that it will be cached.
I don't know enough about WhatsApp to help further. I don't think this is Ignition-controlled behavior. (The script console doesn't have any connection to a browser itself.)
Is it possible to execute WhatsApp Web in the background (headless mode or via backend service) when sending messages, so that the browser does not visibly open during each message trigger?
The user should only need to link WhatsApp Web to the mobile device once.
After the initial linking, message triggers should occur silently, without visibly opening WhatsApp Web in the browser.