Script Integration

Availability: since Release 2.8.0

If an event happen in BiG EVAL, the script integration is able to run a C#-based script as a subsequent action to this event. This opens a vast amount of possibilities as a full featured programming language is available to run these actions. Some examples are:

  • Restart a data load process
  • Reboot a server
  • Post a message to Slack or Microsoft Teams
  • Trigger actions in another application that doesn’t provide any webhooks
  • etc.

Creating a Script Integration

  1. Open System -> Integrations
  2. Click on “Script” in the “Add Integration” section.
  3. Enter a name and a description for the integration.
  4. Choose and refine the event that triggers the integration.
  5. Use the Script and Imports registers to define the C# script that will run in the case the event triggers it.
  6. Click on “Save”

Script Syntax

The script is based on C# 6.0 and allows accessing the full functionality of the corresponding .NET framework. You may use the Imports-register to define using. using System.Text;

Event Context

Access information about the event that triggered the script integration on the alert-context described in this article.

Querying Data and Meta data

see Querying Data or Meta data

Snippets

see Snippets

Placeholders

see Placeholders

Parameters

see Parameters

Parameter lists

see Parameter lists

Logging

see Logging

Example

The following example sends an HTTP-message to a specific HTTP-endpoint.

Imports:

using System;
using System.Collections;
using System.Net,System.Text;

Script:

try
{
    var message = "My Message";

    // Create a request using an URL that can receive a post.
    var request = WebRequest.Create("https://myapplication.com/api/hello");

    // Set the Method property of the request to POST.
    request.Method = "POST";

    // Construct the JSON-body to sendand convert it to a byte array.
    var json = "{ 'text':'" + message + "' }";
    var byteArray = Encoding.UTF8.GetBytes(json);

    // Set the ContentType property of the WebRequest.
    request.ContentType = "application/json";

    // Set the ContentLength property of the WebRequest.
    request.ContentLength = byteArray.Length;

    // Get the request stream.
    var dataStream = request.GetRequestStream();

    // Write the data to the request stream.
    dataStream.Write(byteArray, 0, byteArray.Length);

    // Close the Stream object.
    dataStream.Close();

    // Get the response.
    WebResponse response = request.GetResponse();
    var statusCode = ((HttpWebResponse)response).StatusCode;

    switch (statusCode)
    {
        case HttpStatusCode.OK:
            LogInfo("HTTP-Message successfully posted!");
            break;

        default:
            throw new Exception($"Couldn't post HTTP-Message. StatusCode: {statusCode}");
    }
}
catch (Exception ex)
{
    LogError(ex, "HTTP-Message couldn't be posted!");
}
Table of Contents