Example app

Some more information on which fields from Trengo can be used in the side bar (Profile, Contact are most important)

You may choose to create a custom app to show business related information based on the current ticket. See the code example below (PHP) to illustrate how a custom app could work.

<?php

/**
 * Make sure the request is authorized by matching the auth_token from the URL to the secret. This secret can be found in your custom app configuration.
 */
if ($_GET['auth_token'] !== '{{ AUTH_TOKEN }}') {
    exit('Unauthorized');
}

/**
 * Grab the ticket ID from the URL. Trengo automatically appends this ID to the URL.
 */
$ticket_id = $_GET['ticket_id'];

/**
 * Fetch the complete ticket using the Rest API. 
 */
$ch = curl_init("https://app.trengo.com/api/v2/tickets/".$ticket_id);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer {{API_TOKEN}}',
    'Content-Type: application/json',
    'Accept: application/json',
]);
$ticket = json_decode(curl_exec($ch), true);

/**
 * Do whatever you want with $ticket :)
 */
print_r($ticket);

?>

Did this page help you?