Skip to main content
Question

send in from Excel to a subscriber

  • 28 July 2024
  • 0 replies
  • 16 views

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 subscribersr0].id=1195263093
set subscribersr0].message=Hello from ManyChat 1!
set subscribersr1].id=1195263093
set subscribersr1].message=Hello from ManyChat 2!
set subscribersr2].id=1122334455
set subscribersr2].message=This is a test message.
set subscribersr3].id=2233445566
set subscribersr3].message=Another test message.

REM Loop through the list of subscribers
for /L %%i in (0, 1, 3) do (
    set "SUBSCRIBER_ID=!subscriberss%%i].id!"
    set "MESSAGE=!subscribersu%%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!

Reply