The Way Of Life: April 2023
Google

Sunday, April 09, 2023

How to Make WhatsApp Office Visit / Clinic Notification on Skyward


As we know, until this article has been released. On Skyward, we are unable to make notifications through WhatsApp. Like Office Visit / Clinic Notification, Skyward only has e-mail notification. And the good news is, today I will share, how to make Office Visit Notification through WhatsApp using Skyward API and WhatsApp API.

First, you have to download Qmlative SDK from Skyward. If you have not used the Qmlativ SDK Explorer, you can download it by going to the Partner Portal, navigating to Documentation, clicking on Qmlativ, choosing "C# SDK", then choosing "Download" and then clicking the "Click here to download" link.  Once you have downloaded and extracted the .zip file, open up the folder and find the "QmlativSDKExplorer.exe.config" file and replace the following values:

  1. BaseUrl : this should be the API Url that you are using to connect
  2. Key : this should be your client key
  3. Secret : this should be your client secret

Once you've done that save and close the config file, then run the QmlativSDKExplorer.exe file.  Once it launches, simply click "Explore", and you should see something like the following image.

In the box on the left, expand the "Health" node, then scroll down to the "NameOfficeVisit" node and expand it, then expand the "Fields" node, and select each of the fields that you would want to include in the response from that object (note: there may not be many from this object that you're actually interested in at this time).  Scroll a little further down to the "Relationships" node and expand that node, and you will see all the relationships available to the NameOfficeVisit object, such as "Name", expand the nodes that you are interested in pulling data from, and you will notice that they, too, have "Fields" and "Relationships" nodes under them.  Also note, the grayed out nodes are not unavailable, they are usually relationships that will tend to create cartesian products if they are used, so they are not recommended.

Or you can download my xml saved items setting here.

It’s important to save your selected item to generate query on Qmlativ SDK because Skyward have maybe a hundred or thousand fields on the database and connections for sure. From my experience, it is hard to remember the selected field and intuitively choose the correct field. that’s why saving your selected fields is really important.

Skyward Qmlative SDK Explorer

Choosing your selected field on the SDK Explorer.

  • Health
    • NameOfficeVisit
      • Fields
        • NameOfficeVisitID
        • CreatedTime
        • EntityID
        • NameID
      • Relationships
        • Name
          • Demographics.Name
            • Fields
              • FirstName
              • LastName
              • ...

After you have done with the selected field. You can scroll all the way back up to the "NameOfficeVisit" node, and select it (don't uncheck it), and you should see a "Preview Data" button on the right-side of the screen. When you click that "Preview Data" button you will notice that it will open a screen allowing you to preview the data, but it will also add an entry to the bottom panel of the original window with a GET request that you can copy (though it doesn't scroll to the right, so you will want to copy the line and the line below to make sure you get everything).

https://skyward.iscorp.com/yourbaseurlAPI/custom/1/Health/NameOfficeVisit/1/250?searchFields%5B0%5D=NameOfficeVisitID&searchFields%5B1%5D=CreatedTime&searchFields%B2%5D=EntityID&searchFields%5B3%5D=NameID&searchFields%5B4%5D=Name.FirstName&seachFields%5B5%5D=Name.LastName&searchFields%5B6%5D=Name.Student.PrimaryStudentFamily.PrimaryStudentGuardian.NameGuardian.PrimaryNamePhone.PhoneNumber

Using that information, you can then translate it into your POST request by copying the search fields over to your query fields for your POST.  The only thing I would recommend is taking off the "%5B" and "%5D" after the "searchField" as it is unnecessary. But if you still using that code, it will still work, but just makes your query unnecessarily longer.


Now, with postman you can test the link to query data.

API Call Testing - postman

Don't forget to filter the result, for example only today's office visit transaction. you must add some code on the body request like code below.

{

    "SearchSort": [

    {

        "FieldName": "CreatedTime",

        "DocumentationIsComplete": true,

        "Descending": false

    }],

    "SearchCondition": {

        "DateTimeSearchCondition": {

            "ConditionType": "Greater",

            "FieldName": "CreatedTime",

            "Value": "2023-03-29T00:00:00"

        }

    }

}


Then in my project, I’m using Visual Basic 6 to connect with WA API from the provider. The paramater that I’ve used are :

  1. API URL
  2. Authorization 

You can download my code about API Call Using Visual Basic 6 here

And here is the code for call WA API.

url = "https://demo.waapi.id/demo1/api/chats/6281000000000(yourdestinationwanumber)/messages?direct=false"

xmlhttp.Open "POST", url, False

message= "Dear, " + "*" + GridResult.TextMatrix(1, 10) + "*" + "\n"

message = message + " " + "\n"

message = message + "We would like to inform you that " + "*" + GridResult.TextMatrix(1, 3) + "*" + " has visited school clinic." + "\n"

message = message + " " + "\n"

message = message + "Office Visit Reason(s): " + GridResult.TextMatrix(1, 5) + "\n"

message = message + "Treatment(s): " + GridResult.TextMatrix(1, 6) + "\n"

message = message + "Disposition(s): " + GridResult.TextMatrix(1, 4) + "\n"

message = message + "Examined By: " + GridResult.TextMatrix(1, 7) + "\n"

message = message + "Comment: " + GridResult.TextMatrix(1, 8) + "\n"

message = message + " " + "\n"

message = message + " " + "\n"

message = message + "Thank You." + "\n"

message = message + "Your School Name"


'create the body of the POST

sentitybody = "{" + vbCrLf + """text""" & ":""" & message + """" + vbCrLf + "}"


xmlhttp.setRequestHeader "Authorization", "Bearer" & " " & "8jRuDTXCwqqeqwewqkbVdfsderwr"

xmlhttp.setRequestHeader "Content-Type", "application/json"

Visual Basic WhatsApp Clinic Notification

The Image below is the result of the WhatsApp Clinic Notification.


Clinic WhatsApp Notification


Software :

Microsoft Visual Basic 6.0

Postman

WhatsApp API

Skyward Qmlative SDK

Skyward

related links:

Aplikasi untuk Mengirim Pesan WhatsApp Otomatis

Labels: , , ,