ActiveXperts Knowledge Base Article 7540034
Our mission at ActiveXperts Software is to deliver high quality Network Monitoring solutions and Windows Development components.
Our goal is to supplement these solutions with timely support resources that can help at many different levels.
The first thing you want to do is try to find the answer to your problem in the Knowledge Base.
If you cannot find an answer to your question in our Knowledge Base, or if you need additional information or assistance, please use our Contact Support form.
Here is a Powershell script:
# Twilio credentials
$AccountSid = "ACb12b4b9c8f3456abf46aa2cd2edda678"
$AuthToken = "d512e340c567e1b8a08300b4a71e2bb8"
# Telephone number: From number assigned to your Twilio account
$FromNumber = "whatsapp:+11234567890"
# Telephone number: To number
$ToNumber = "whatsapp:+31612345678"
# Message body
$MessageBody = "Hello sir/madam, this is a test Whatsapp sent from Powershell via Twilio."
# URL
$Uri = "https://api.twilio.com/2010-04-01/Accounts/$AccountSid/Messages.json"
# Basic Authentication
$Pair = "$AccountSid`:$AuthToken"
$EncodedCredentials = [Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes($pair))
$Headers = @{
Authorization = "Basic $EncodedCredentials"
}
# Request body
$Body = @{
From = $FromNumber
To = $ToNumber
Body = $MessageBody
}
# Send the message
try {
$Response = Invoke-RestMethod `
-Uri $Uri `
-Method Post `
-Headers $Headers `
-Body $Body
Write-Host "Whatsapp sent. SID = $($Response.sid)"
}
catch {
Write-Host "Status Code: $($_.Exception.Response.StatusCode.value__)"
Write-Host "Error:"
Write-Host $_
}
If you cannot find an answer to your question(s) in our Knowledge Base, or if you need additional information or assistance, please contact our Customer Support using our Contact Support Form
