Skip to main content

team any  way i can send WhatsApp to  a subscriber from Excel i tried many way all fail  also from other  like batch file  

@echo off
setlocal enabledelayedexpansion

REM Set your ManyChat API key
set API_KEY=559135:6f1bf95ac1ceda72d7

REM Set the ManyChat API endpoint
set API_URL=https://api.manychat.com/fb/sending/sendContent

REM List of subscriber IDs and messages
set subscribers[0].id=1195263093
set subscribers[0].message=Hello from ManyChat 1!
set subscribers[1].id=1195263093
set subscribers[1].message=Hello from ManyChat 2!
set subscribers[2].id=1122334455
set subscribers[2].message=This is a test message.
set subscribers[3].id=2233445566
set subscribers[3].message=Another test message.

REM Loop through the list of subscribers
for /L %%i in (0, 1, 3) do (
    set "SUBSCRIBER_ID=!subscribers[%%i].id!"
    set "MESSAGE=!subscribers[%%i].message!"
    
    REM Create a JSON payload
    set "PAYLOAD={\"subscriber_id\": \"!SUBSCRIBER_ID!\",\"content\": {\"messages\": [{\"type\": \"text\", \"text\": \"!MESSAGE!\"}]}}"

    REM Send the request using curl
    curl -X POST %API_URL% ^
         -H "Content-Type: application/json" ^
         -H "Authorization: Bearer %API_KEY%" ^
         -d "!PAYLOAD!"

    echo Message sent to !SUBSCRIBER_ID!
)

pause
endlocal
 

 

error always  

"status":"error","message":"Validation error","details":{"messages":[{"message":"subscriber_id cannot be blank."}]}}Message sent 

 

 

anyone can support if this possible  

Be the first to reply!