Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

use api whatsapp 1

sal21

Programmer
Apr 26, 2004
446
IT
Ho to use this api curl in vb6.


Code:
curl --request POST \
  --url https://api.ultramsg.com/yyyyyyyyyyyyyy/messages/chat \
  --header 'content-type: application/x-www-form-urlencoded' \
  --data-urlencode 'token=xxxxxxxxxxxxxxxx' \
 --data-urlencode 'to=+393515342919' \
 --data-urlencode 'body=WhatsApp API on UltraMsg.com works good'
 
To be honest, yuo could have just leveraged the solution to your previous Twillo post.

So something like the following:

Rich (BB code):
Option Explicit

Public Sub whatsapp()
    Dim url As String
    Dim postdata As String
    Dim xmlhttp As Object
    
    ' Prepare POST data
    postdata = "token=" & encodeURL("yyyyyyyyyyyyyy") & "&to=" & encodeURL("+393515342919") & "&body=" & encodeURL("WhatsApp API on UltraMsg.com works good")

    ' Create an XMLHTTP object
    Set xmlhttp = CreateObject("MSXML2.XMLHTTP")
    url = "https://api.ultramsg.com/xxxxxxxxxxxxxx/messages/chat"
    
    ' Make the POST request
    xmlhttp.Open "POST", url, False
    xmlhttp.SetRequestHeader "Content-Type", "application/x-www-form-urlencoded"
    xmlhttp.Send postdata
End Sub


Public Function encodeURL(str As String) As String
    Dim ScriptEngine As Object
    Dim encoded As String

    Set ScriptEngine = CreateObject("scriptcontrol")
    ScriptEngine.Language = "JScript"
    encoded = ScriptEngine.Run("encodeURI", str)
    encodeURL = encoded
End Function
 
Last edited:
Tks bro,
Sorry but not Remember i have post similar questione about Twillo.
 

Part and Inventory Search

Sponsor

Back
Top