Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

So, enter the appropriate information into your first JSON Tool and keep the Body Type as "Request Parameters".

Image Modified

Info

Make sure to insert your own tenant ID

...

Other authentications flow would let you be more specific with your scope, like entering "Mail.send" but for client credentials it must have a value with the "/.default" suffixed to the application ID URI, which by default is "https://graph.microsoft.com/". Enter the link to the value with the name "scope".

Image Modified

The result of this request takes form of a JSON object, if your request was successful, the JSON object should look something like this:

...

The "access_token" property of this JSON object is what we need for our second JSON tool, and for this guide, we will store this value in a workflow variable. You can create a workflow variable by going to the "Process Property", which in Joget DX8, is accessible via the pencil icon beside your process' name.

Image Modified

Add as many variables as you need and name them appropriately.

...

For this guide, we will be using the first one, enter the appropriate information to your second JSON tool and make the Body Type as "Custom JSON Payload".

Getting userPrincipalName via Azure

This "id | userPrincipalName" refers to the ID or "principal name" of the user that will be sending the email. The format of an ID will be a 32 long random string separated into 5 sections, while the format of a principal name will look like an email address. Most emails and IDs will be invalid when placed in the request link, to see which emails are allowed, you can check it in your Azure profile.

...

And in that screen you can see a list of all the valid users, it should be filled with around a dozen dummy accounts and your account. Copy paste your or any of the "User Principal Name" in that list to your request link and this time the request will be valid.

Getting userPrincipalName and ID via GET Request

Optionally, you can extract both the "User Principal Name" and their ID, by doing a GET request to the link,

...

Feed this GET request with a non-expired access token and if the request is successful, you will be presented with an array of JSON objects that represents all of the user's information, including their "User Principal Name" and ID. It is also important to note, this is where that optional API permission "User.Read.All" is used. For this guide, this method will not be used.

The JSON Payload

After pasting the appropriate request link, time to feed it the JSON Payload

This JSON payload should consists of simply one JSON object called "message", in the documentation for this API, you could put many properties like custom HTMLs and file attachments. But the only properties that the JSON object must have is only the property "toRecipients", everything else can be left blank or deleted and the request would still be valid, but of course that wouldn't send a proper email, so put the properties you would normally find in an email like a "subject" and "content".

...

Enter the appropriate information for each property, you could either hard code the information in the JSON object, or use hash variables like in the code block above.

Request Headers

After the JSON payload, you will also need to insert the request headers. For this request, it needs two things for their header, "Content-type" and "Authorization". 

...