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 FoxPro 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
Google Vision
Hungary NAV Invoicing
IBM Text to Speech
Ibanity
IntakeQ
JCC Cyprus
Jira
Lightspeed
MYOB
Magento
Mailgun
Malaysia MyInvois

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
Salesforce
SendGrid
Shippo
Shopify
Shopware
Shopware 6
SimpleTexting
Square
Stripe
SugarCRM
TicketBAI
TikTok Shop
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 FoxPro) 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

LOCAL loHttp
LOCAL lnSuccess
LOCAL loReq
LOCAL loResp
LOCAL loSbResponseBody
LOCAL loJResp
LOCAL lnRespStatusCode
LOCAL lnReturnCode
LOCAL lcReturnCodeText
LOCAL lcData
LOCAL loJsonData
LOCAL lcUserName
LOCAL lnAccountId
LOCAL lcAccountName
LOCAL lcAccountTitle
LOCAL lcFirstName
LOCAL lcLastName
LOCAL lcLastSentOn
LOCAL lnSendCount
LOCAL lnIsFavorite
LOCAL lnId
LOCAL lnFromUserId
LOCAL lnFromMailBoxId
LOCAL lnFromUserType
LOCAL lcFromUserName
LOCAL lcFromUserFullName
LOCAL lcFromUserAccountName
LOCAL lcFromUserAccountTitle
LOCAL lnToUserId
LOCAL lnToUserType
LOCAL lcToUserMailboxId
LOCAL lcToUserName
LOCAL lcToUserFullName
LOCAL lcEmailAddress
LOCAL lcPassword
LOCAL lcSubject
LOCAL lcPatientMedTunnelId
LOCAL lcBody
LOCAL lcDateReceived
LOCAL lcDisplayDateReceived
LOCAL lnViewCount
LOCAL lcViewedOn
LOCAL lnAttachmentCount
LOCAL lnStatus
LOCAL lnParentMessageId
LOCAL lnDistributionListId
LOCAL lcDistributionListName
LOCAL lcBodyHistory
LOCAL lcReadReceiptCallbackUrl
LOCAL lnSendGlobalNotifications
LOCAL i
LOCAL lnCount_i

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

* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.Http')
loHttp = CreateObject('Chilkat.Http')

* 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

* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.HttpRequest')
loReq = CreateObject('Chilkat.HttpRequest')
loReq.HttpVerb = "POST"
loReq.Path = "/MedTunnelMsg/api/Message/SendMessage"
loReq.ContentType = "multipart/form-data"
loReq.AddParam("ApplicationId","yourApplicationId")
loReq.AddParam("LocationId","yourLocationId")
loReq.AddParam("MedTunnelId","yourMedTunnelId")
loReq.AddParam("MedTunnelPassword","yourMedTunnelPassword")
loReq.AddParam("To","recipientsMedTunnelId")
loReq.AddParam("Body","Test")

loResp = loHttp.SynchronousRequest("server.medtunnel.com",443,1,loReq)
IF (loHttp.LastMethodSuccess = 0) THEN
    ? loHttp.LastErrorText
    RELEASE loHttp
    RELEASE loReq
    CANCEL
ENDIF

* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.StringBuilder')
loSbResponseBody = CreateObject('Chilkat.StringBuilder')
loResp.GetBodySb(loSbResponseBody)
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.JsonObject')
loJResp = CreateObject('Chilkat.JsonObject')
loJResp.LoadSb(loSbResponseBody)
loJResp.EmitCompact = 0

? "Response Body:"
? loJResp.Emit()

lnRespStatusCode = loResp.StatusCode
? "Response Status Code = " + STR(lnRespStatusCode)
IF (lnRespStatusCode >= 400) THEN
    ? "Response Header:"
    ? loResp.Header
    ? "Failed."
    RELEASE loResp
    RELEASE loHttp
    RELEASE loReq
    RELEASE loSbResponseBody
    RELEASE loJResp
    CANCEL
ENDIF

RELEASE loResp

* 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

lnReturnCode = loJResp.IntOf("ReturnCode")
lcReturnCodeText = loJResp.StringOf("ReturnCodeText")
lcData = loJResp.StringOf("Data")

* Load the Data into another JSON object and parse..
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.JsonObject')
loJsonData = CreateObject('Chilkat.JsonObject')
loJsonData.Load(lcData)
loJsonData.EmitCompact = 0
? loJsonData.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
* }
* 

lnId = loJsonData.IntOf("Id")
lnFromUserId = loJsonData.IntOf("FromUserId")
lnFromMailBoxId = loJsonData.IntOf("FromMailBoxId")
lnFromUserType = loJsonData.IntOf("FromUserType")
lcFromUserName = loJsonData.StringOf("FromUserName")
lcFromUserFullName = loJsonData.StringOf("FromUserFullName")
lcFromUserAccountName = loJsonData.StringOf("FromUserAccountName")
lcFromUserAccountTitle = loJsonData.StringOf("FromUserAccountTitle")
lnToUserId = loJsonData.IntOf("ToUserId")
lnToUserType = loJsonData.IntOf("ToUserType")
lcToUserMailboxId = loJsonData.StringOf("ToUserMailboxId")
lcToUserName = loJsonData.StringOf("ToUserName")
lcToUserFullName = loJsonData.StringOf("ToUserFullName")
lcEmailAddress = loJsonData.StringOf("EmailAddress")
lcPassword = loJsonData.StringOf("Password")
lcSubject = loJsonData.StringOf("Subject")
lcPatientMedTunnelId = loJsonData.StringOf("PatientMedTunnelId")
lcBody = loJsonData.StringOf("Body")
lcDateReceived = loJsonData.StringOf("DateReceived")
lcDisplayDateReceived = loJsonData.StringOf("DisplayDateReceived")
lnViewCount = loJsonData.IntOf("ViewCount")
lcViewedOn = loJsonData.StringOf("ViewedOn")
lnAttachmentCount = loJsonData.IntOf("AttachmentCount")
lnStatus = loJsonData.IntOf("Status")
lnParentMessageId = loJsonData.IntOf("ParentMessageId")
lnDistributionListId = loJsonData.IntOf("DistributionListId")
lcDistributionListName = loJsonData.StringOf("DistributionListName")
lcBodyHistory = loJsonData.StringOf("BodyHistory")
lcReadReceiptCallbackUrl = loJsonData.StringOf("ReadReceiptCallbackUrl")
lnSendGlobalNotifications = loJsonData.BoolOf("SendGlobalNotifications")
i = 0
lnCount_i = loJsonData.SizeOfArray("AttachmentNames")
DO WHILE i < lnCount_i
    loJsonData.I = i
    i = i + 1
ENDDO
i = 0
lnCount_i = loJsonData.SizeOfArray("AllRecipients")
DO WHILE i < lnCount_i
    loJsonData.I = i
    lnId = loJsonData.IntOf("AllRecipients[i].Id")
    lcUserName = loJsonData.StringOf("AllRecipients[i].UserName")
    lnAccountId = loJsonData.IntOf("AllRecipients[i].AccountId")
    lcAccountName = loJsonData.StringOf("AllRecipients[i].AccountName")
    lcAccountTitle = loJsonData.StringOf("AllRecipients[i].AccountTitle")
    lcFirstName = loJsonData.StringOf("AllRecipients[i].FirstName")
    lcLastName = loJsonData.StringOf("AllRecipients[i].LastName")
    lcEmailAddress = loJsonData.StringOf("AllRecipients[i].EmailAddress")
    lcLastSentOn = loJsonData.StringOf("AllRecipients[i].LastSentOn")
    lnSendCount = loJsonData.IntOf("AllRecipients[i].SendCount")
    lnIsFavorite = loJsonData.BoolOf("AllRecipients[i].IsFavorite")
    i = i + 1
ENDDO

RELEASE loHttp
RELEASE loReq
RELEASE loSbResponseBody
RELEASE loJResp
RELEASE loJsonData


 

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