Private Sub SendPostRequest
Dim job As HttpJob
job.Initialize("Job1", Me)
' URL of the API
Dim url As String = "https://api.melroselabs.com/signal/message"
' Create the payload as a JSON object
Dim payload As Map
payload.Initialize
payload.Put("systemid", "[YourAPISystemIDHere]")
payload.Put("password", "[YourAPIPasswordHere]")
payload.Put("destination", "[DestinationPhoneNumberInInternationalFormat(No + Needed)]")
payload.Put("text", "[Your message text]")
payload.Put("scheduled", "2024-09-04T11:26:51.922Z") 'Skip this to send straight away
' Convert payload to JSON
Dim json As JSONGenerator
json.Initialize(payload)
Dim payloadString As String = json.ToString
' Headers
job.GetRequest.SetHeader("accept", "application/json")
job.GetRequest.SetHeader("content-type", "application/json")
' Send POST request with JSON payload
job.PostString(url, payloadString)
' Wait for the response
Wait For (job) JobDone(job As HttpJob)
If job.Success Then
' Print the response
Log(job.GetString)
Else
Log("Error: " & job.ErrorMessage)
End If
job.Release
End Sub