Cybertill post-request script

Introduction

Having installed the Cybertill connector, some setup is required before it can be used. You must:

Once this setup is complete, you can add instances for use in process flows.

Stage 1: Creating a post-request script

A post-request script is required to generate an authentication token from the given instance credentials. Follow the steps below to create this script.

Step 1 From the Patchworks dashboard, select scripts from the left-hand navigation menu.

Step 2 Click the create script button:

Step 3 In the name field, type the following:

Cybertill Post-Request Script

Step 4 In the description field, type the following:

Cybertill Auth Token Generator - Post Script

Step 5 Click in the language field and select PHP 8.1:

Step 6 Click the create button.

Step 7 The script is created and opened in edit mode - select and remove any placeholder code:

Step 8 Paste in the code below.

Post-request script code
 <?php

/**
 * Handler function.
 *
 * @param array $data [
 *      'payload'   => (string|null) the payload as a string|null
 *      'variables' => (array[string]string) any variables as key/value
 *      'meta'      => (array[string]string) any meta as key/value
 *    ]
 */

function handle($data)
{
    if (!isset($data['variables']['token'])) {
        throw new \Exception('Token has not been passed to script.');
    }

    if (!isset($data['variables']['auth_id'])) {
        throw new \Exception('Auth ID has not been passed to script.');
    }

    $token = sprintf('%s:%s', $data['variables']['token'], $data['variables']['auth_id']);

    $data['variables']['auth_token'] = base64_encode($token);

    return $data;
}

Step 9 Click the save and deploy button:

Step 10 Click the scripts element of the breadcrumb trail to exit back to your list of scripts and go to the next stage:

Stage 2: Applying the post-request script

Step 1 From the Patchworks dashboard, select connectors and instances from the left-hand navigation menu to access your installed connectors.

Step 2 Find your Cybertill connector and click the settings icon.

Step 3 Click the authentication option:

Step 4 Select the SOAP authentication method:

Step 5 In the lower panel, select the post-request script tab:

Step 6 Click in the select script field and select your Cybertill Post-Request Script:

Step 7 Select the latest version:

Step 8 Save changes:

Step 9 You can now add instances of this connector for use in process flows.

Last updated

#1409: Release notes - 11.12.24

Change request updated