Powershell kullanarak WhatsApp API’si Nasıl Gönderilir

Tanıtım

Bu eğitimde, Powershell kullanarak WhatsApp API üzerinden mesaj göndermek için basit örnekler oluşturacağız.

Powershell Kullanan İlk WhatsApp API Mesajı

$headers=@{}
$headers.Add("content-type", "application/x-www-form-urlencoded")
$response = Invoke-WebRequest -Uri 'https://api.ultramsg.com/instance1150/messages/vcard' -Method POST -Headers $headers -Body 'token=token_here&to=966550883606&vcard= BEGIN:VCARD\nVERSION:3.0\nN:lastname;firstname\nFN:firstname lastname\nTEL;TYPE=CELL;waid=14000000001:14000000002\nNICKNAME:nickname\nBDAY:01.01.1987\nX-GENDER:M\nNOTE:note\nADR;TYPE=home:;;;;;;\nADR;TYPE=work_:;;;;;;\nEND:VCARD&referenceId='

Resim Gönder

$headers=@{}
$headers.Add("content-type", "application/x-www-form-urlencoded")
$response = Invoke-WebRequest -Uri 'https://api.ultramsg.com/instance1150/messages/image' -Method POST -Headers $headers -Body 'token=token_here&to=966550883606&image=https://file-example.s3-accelerate.amazonaws.com/images/test.jpg&caption=image Caption&referenceId='

Belge Gönder

$headers=@{}
$headers.Add("content-type", "application/x-www-form-urlencoded")
$response = Invoke-WebRequest -Uri 'https://api.ultramsg.com/instance1150/messages/document' -Method POST -Headers $headers -Body 'token=token_here&to=966550883606&filename=hello.pdf&document=https://file-example.s3-accelerate.amazonaws.com/documents/cv.pdf&referenceId='

Ses Gönder

$headers=@{}
$headers.Add("content-type", "application/x-www-form-urlencoded")
$response = Invoke-WebRequest -Uri 'https://api.ultramsg.com/instance1150/messages/audio' -Method POST -Headers $headers -Body 'token=token_here&to=966550883606&audio=https://file-example.s3-accelerate.amazonaws.com/audio/2.mp3&referenceId='

Ses Gönder

$headers=@{}
$headers.Add("content-type", "application/x-www-form-urlencoded")
$response = Invoke-WebRequest -Uri 'https://api.ultramsg.com/instance1150/messages/voice' -Method POST -Headers $headers -Body 'token=token_here&to=966550883606&audio=https://file-example.s3-accelerate.amazonaws.com/voice/oog_example.ogg&referenceId='

Video Gönder

$headers=@{}
$headers.Add("content-type", "application/x-www-form-urlencoded")
$response = Invoke-WebRequest -Uri 'https://api.ultramsg.com/instance1150/messages/video' -Method POST -Headers $headers  -Body 'token=token_here&to=966550883606&video=https://file-example.s3-accelerate.amazonaws.com/video/test.mp4&referenceId='
$headers=@{}
$headers.Add("content-type", "application/x-www-form-urlencoded")
$response = Invoke-WebRequest -Uri 'https://api.ultramsg.com/instance1150/messages/link' -Method POST -Headers $headers -Body 'token=token_here&to=966550883606&link=https://en.wikipedia.org/wiki/COVID-19&referenceId='

Kişi Gönder

$headers=@{}
$headers.Add("content-type", "application/x-www-form-urlencoded")
$response = Invoke-WebRequest -Uri 'https://api.ultramsg.com/instance1150/messages/contact' -Method POST -Headers $headers -Body 'token=token_here&to=966550883606&[email protected]&referenceId='

Konum göndermek

$headers=@{}
$headers.Add("content-type", "application/x-www-form-urlencoded")
$response = Invoke-WebRequest -Uri 'https://api.ultramsg.com/instance1150/messages/contact' -Method POST -Headers $headers  -Body 'token=token_here&to=966550883606&[email protected]&referenceId='

Vcard gönder

$headers=@{}
$headers.Add("content-type", "application/x-www-form-urlencoded")
$response = Invoke-WebRequest -Uri 'https://api.ultramsg.com/instance1150/messages/vcard' -Method POST -Headers $headers -Body 'token=token_here&to=966550883606&vcard= BEGIN:VCARD\nVERSION:3.0\nN:lastname;firstname\nFN:firstname lastname\nTEL;TYPE=CELL;waid=14000000001:14000000002\nNICKNAME:nickname\nBDAY:01.01.1987\nX-GENDER:M\nNOTE:note\nADR;TYPE=home:;;;;;;\nADR;TYPE=work_:;;;;;;\nEND:VCARD&referenceId='

son olarak, Tam Whatsapp API Belgelerini ve SSS’yi görebilirsiniz.