Chilkat Examples

ChilkatHOME.NET Core C#Android™AutoItCC#C++Chilkat2-PythonCkPythonClassic ASPDataFlexDelphi ActiveXDelphi DLLGoJavaLianjaMono C#Node.jsObjective-CPHP ActiveXPHP ExtensionPerlPowerBuilderPowerShellPureBasicRubySQL ServerSwift 2Swift 3,4,5...TclUnicode CUnicode C++VB.NETVBScriptVisual Basic 6.0Visual FoxProXojo Plugin

Visual Basic 6.0 Web API Examples

Primary Categories

ABN AMRO
AWS Secrets Manager
AWS Security Token Service
AWS Translate
Activix CRM
Adyen
Alibaba Cloud OSS
Amazon Cognito
Amazon DynamoDB
Amazon MWS
Amazon Pay
Amazon Rekognition
Amazon SP-API
Amazon Voice ID
Aruba Fatturazione
Azure Maps
Azure Monitor
Azure OAuth2
Azure Storage Accounts
Backblaze S3
Banco Inter
Belgian eHealth Platform
Bitfinex v2 REST
Bluzone
BrickLink
Bunny CDN
CallRail
CardConnect
Cerved
ClickBank
Clickatell
Cloudfare
Constant Contact
DocuSign
Duo Auth MFA
ETrade
Ecwid
Egypt ITIDA
Egypt eReceipt
Etsy
Facebook
Faire
Frame.io
GeoOp
GetHarvest
Global Payments
Google People
Google Search Console
Google Translate
Hungary NAV Invoicing
IBM Text to Speech
Ibanity
IntakeQ
Jira
Lightspeed
MYOB
Magento
Mailgun
Mastercard

MedTunnel
MercadoLibre
MessageMedia
Microsoft Calendar
Microsoft Group
Microsoft Tasks and Plans
Microsoft Teams
Moody's
Okta OAuth/OIDC
OneLogin OIDC
OneNote
OpenAI ChatGPT
PRODA
PayPal
Paynow.pl
Peoplevox
Populi
QuickBooks
Rabobank
Refinitiv
Royal Mail OBA
SCiS Schools Catalogue
SII Chile
SMSAPI
SOAP finkok.com
SendGrid
Shippo
Shopify
Shopware
Shopware 6
SimpleTexting
Square
Stripe
SugarCRM
TicketBAI
Trello
Twilio
Twitter API v2
Twitter v1
UPS
UniPin
VoiceBase
Vonage
WaTrend
Walmart v3
Wasabi
WhatsApp
WiX
WooCommerce
WordPress
Xero
Yahoo Mail
Yapily
Yousign
ZATCA
Zendesk
Zoom
_Miscellaneous_
eBay
effectconnect
hacienda.go.cr

 

 

 

(Visual Basic 6.0) MedTunnel: Send Message Text Only

See more MedTunnel Examples

Demonstrates the MedTunnel SendMessage method to send a message to one or more recipients.

For more information, see https://server.medtunnel.com/apidocs/html/M_MedTunnelMsg_Controllers_MessageController_SendMessage.htm

Chilkat ActiveX Downloads

ActiveX for 32-bit and 64-bit Windows

' This example assumes the Chilkat API to have been previously unlocked.
' See Global Unlock Sample for sample code.

Dim http As New ChilkatHttp
Dim success As Long

' Implements the following CURL command:

' curl https://server.medtunnel.com/MedTunnelMsg/api/Message/SendMessage -X POST -k 
'         -F "ApplicationId=yourApplicationId" -F "LocationId=yourLocationId" 
'         -F "MedTunnelId=yourMedTunnelId" -F "MedTunnelPassword=yourMedTunnelPassword" 
'         -F "To=recipientsMedTunnelId" 
'         -F "Body=Test of SendMessage"

' Use the following online tool to generate HTTP code from a CURL command
' Convert a cURL Command to HTTP Source Code

Dim req As New ChilkatHttpRequest
req.HttpVerb = "POST"
req.Path = "/MedTunnelMsg/api/Message/SendMessage"
req.ContentType = "multipart/form-data"
req.AddParam "ApplicationId","yourApplicationId"
req.AddParam "LocationId","yourLocationId"
req.AddParam "MedTunnelId","yourMedTunnelId"
req.AddParam "MedTunnelPassword","yourMedTunnelPassword"
req.AddParam "To","recipientsMedTunnelId"
req.AddParam "Body","Test"

Dim resp As ChilkatHttpResponse
Set resp = http.SynchronousRequest("server.medtunnel.com",443,1,req)
If (http.LastMethodSuccess = 0) Then
    Debug.Print http.LastErrorText
    Exit Sub
End If

Dim sbResponseBody As New ChilkatStringBuilder
success = resp.GetBodySb(sbResponseBody)
Dim jResp As New ChilkatJsonObject
success = jResp.LoadSb(sbResponseBody)
jResp.EmitCompact = 0

Debug.Print "Response Body:"
Debug.Print jResp.Emit()

Dim respStatusCode As Long
respStatusCode = resp.StatusCode
Debug.Print "Response Status Code = " & respStatusCode
If (respStatusCode >= 400) Then
    Debug.Print "Response Header:"
    Debug.Print resp.Header
    Debug.Print "Failed."

    Exit Sub
End If

' Sample JSON response:
' (Sample code for parsing the JSON response is shown below)

' {
'   "ReturnCode": 1,
'   "ReturnCodeText": "Success",
'   "Data": "{\"Id\":989432,\"FromUserId\":36990,\"FromMailBoxId\":36965, ... \"SendGlobalNotifications\":false}"
' }

' Sample code for parsing the JSON response...
' Use the following online tool to generate parsing code from sample JSON:
' Generate Parsing Code from JSON

Dim ReturnCode As Long
ReturnCode = jResp.IntOf("ReturnCode")
Dim ReturnCodeText As String
ReturnCodeText = jResp.StringOf("ReturnCodeText")
Dim Data As String
Data = jResp.StringOf("Data")

' Load the Data into another JSON object and parse..
Dim jsonData As New ChilkatJsonObject
success = jsonData.Load(Data)
jsonData.EmitCompact = 0
Debug.Print jsonData.Emit()

' {
'   "Id": 989436,
'   "FromUserId": 36990,
'   "FromMailBoxId": 36965,
'   "FromUserType": 0,
'   "FromUserName": "...",
'   "FromUserFullName": "...",
'   "FromUserAccountName": "...",
'   "FromUserAccountTitle": "...",
'   "ToUserId": 36990,
'   "ToUserType": 1,
'   "ToUserMailboxId": "36965",
'   "ToUserName": "...",
'   "ToUserFullName": "...",
'   "EmailAddress": "",
'   "Password": "",
'   "Subject": "",
'   "PatientMedTunnelId": "",
'   "Body": "Test",
'   "DateReceived": "4/29/2021 2:29:18 PM",
'   "DisplayDateReceived": "04/29/2021  2:29 PM",
'   "ViewCount": 0,
'   "ViewedOn": "",
'   "AttachmentCount": 0,
'   "AttachmentNames": [
'   ],
'   "AllRecipients": [
'     {
'       "Id": 989436,
'       "UserName": "...",
'       "AccountId": 0,
'       "AccountName": "...",
'       "AccountTitle": "",
'       "FirstName": "...",
'       "LastName": "...",
'       "EmailAddress": "",
'       "LastSentOn": "",
'       "SendCount": 0,
'       "IsFavorite": false
'     }
'   ],
'   "Status": 1,
'   "ParentMessageId": 989436,
'   "DistributionListId": 0,
'   "DistributionListName": "",
'   "BodyHistory": "",
'   "ReadReceiptCallbackUrl": null,
'   "SendGlobalNotifications": false
' }
' 

Dim UserName As String
Dim AccountId As Long
Dim AccountName As String
Dim AccountTitle As String
Dim FirstName As String
Dim LastName As String
Dim LastSentOn As String
Dim SendCount As Long
Dim IsFavorite As Long

Dim Id As Long
Id = jsonData.IntOf("Id")
Dim FromUserId As Long
FromUserId = jsonData.IntOf("FromUserId")
Dim FromMailBoxId As Long
FromMailBoxId = jsonData.IntOf("FromMailBoxId")
Dim FromUserType As Long
FromUserType = jsonData.IntOf("FromUserType")
Dim FromUserName As String
FromUserName = jsonData.StringOf("FromUserName")
Dim FromUserFullName As String
FromUserFullName = jsonData.StringOf("FromUserFullName")
Dim FromUserAccountName As String
FromUserAccountName = jsonData.StringOf("FromUserAccountName")
Dim FromUserAccountTitle As String
FromUserAccountTitle = jsonData.StringOf("FromUserAccountTitle")
Dim ToUserId As Long
ToUserId = jsonData.IntOf("ToUserId")
Dim ToUserType As Long
ToUserType = jsonData.IntOf("ToUserType")
Dim ToUserMailboxId As String
ToUserMailboxId = jsonData.StringOf("ToUserMailboxId")
Dim ToUserName As String
ToUserName = jsonData.StringOf("ToUserName")
Dim ToUserFullName As String
ToUserFullName = jsonData.StringOf("ToUserFullName")
Dim EmailAddress As String
EmailAddress = jsonData.StringOf("EmailAddress")
Dim Password As String
Password = jsonData.StringOf("Password")
Dim Subject As String
Subject = jsonData.StringOf("Subject")
Dim PatientMedTunnelId As String
PatientMedTunnelId = jsonData.StringOf("PatientMedTunnelId")
Dim Body As String
Body = jsonData.StringOf("Body")
Dim DateReceived As String
DateReceived = jsonData.StringOf("DateReceived")
Dim DisplayDateReceived As String
DisplayDateReceived = jsonData.StringOf("DisplayDateReceived")
Dim ViewCount As Long
ViewCount = jsonData.IntOf("ViewCount")
Dim ViewedOn As String
ViewedOn = jsonData.StringOf("ViewedOn")
Dim AttachmentCount As Long
AttachmentCount = jsonData.IntOf("AttachmentCount")
Dim Status As Long
Status = jsonData.IntOf("Status")
Dim ParentMessageId As Long
ParentMessageId = jsonData.IntOf("ParentMessageId")
Dim DistributionListId As Long
DistributionListId = jsonData.IntOf("DistributionListId")
Dim DistributionListName As String
DistributionListName = jsonData.StringOf("DistributionListName")
Dim BodyHistory As String
BodyHistory = jsonData.StringOf("BodyHistory")
Dim ReadReceiptCallbackUrl As String
ReadReceiptCallbackUrl = jsonData.StringOf("ReadReceiptCallbackUrl")
Dim SendGlobalNotifications As Long
SendGlobalNotifications = jsonData.BoolOf("SendGlobalNotifications")
Dim i As Long
i = 0
Dim count_i As Long
count_i = jsonData.SizeOfArray("AttachmentNames")
Do While i < count_i
    jsonData.I = i
    i = i + 1
Loop
i = 0
count_i = jsonData.SizeOfArray("AllRecipients")
Do While i < count_i
    jsonData.I = i
    Id = jsonData.IntOf("AllRecipients[i].Id")
    UserName = jsonData.StringOf("AllRecipients[i].UserName")
    AccountId = jsonData.IntOf("AllRecipients[i].AccountId")
    AccountName = jsonData.StringOf("AllRecipients[i].AccountName")
    AccountTitle = jsonData.StringOf("AllRecipients[i].AccountTitle")
    FirstName = jsonData.StringOf("AllRecipients[i].FirstName")
    LastName = jsonData.StringOf("AllRecipients[i].LastName")
    EmailAddress = jsonData.StringOf("AllRecipients[i].EmailAddress")
    LastSentOn = jsonData.StringOf("AllRecipients[i].LastSentOn")
    SendCount = jsonData.IntOf("AllRecipients[i].SendCount")
    IsFavorite = jsonData.BoolOf("AllRecipients[i].IsFavorite")
    i = i + 1
Loop

 

© 2000-2024 Chilkat Software, Inc. All Rights Reserved.