Skip to main content

How to integrate

The TestFreaks integration in Engage involves Interactions and custom contact attributes. A custom automation trigger will be added in a later iteration. Follow the steps below to integrate.

1 - Enable Interactions

Start by activating Interactions for your Engage tenant (ask your Voyado PM to do this for you).

See here for more about Interactions in Engage.

2 - Define the interaction schema

Every Interaction in Engage is defined by a schema. Here is the structure of the schema used for the TestFreaks integration:

{
  "id": "completedProductRating",
  "displayName": "Completed TestFreaks review",
  "jsonSchema": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "productSku": {
        "type": "string",
        "displayName": "Sku",
        "showInContactCard": "true"
      },
      "rating": {
        "type": "integer",
        "displayName": "Rating",
        "showInContactCard": "true"
      },
      "comment": {
        "type": "string",
        "displayName": "Comment",
        "showInContactCard": "true"
      }
    }
  }
}

To create the Interaction, this schema is sent to the endpoint:

POST api/v2/interactionschemas

Tip

TestFreaks will set up the schema on their end.

3 - Create the custom attributes

TestFreaks uses some custom contact attributes in Engage to send review information. You'll need to set there attributes up first. Navigate to Administration > Configure Engage and then Contact attributes. Now create the following three custom attributes:

Id

Name

Type

Description

reviewLatest

Review Latest

Date

The most recent date of a review.

reviewLatestValue

Review Latest Value

Integer

The score / value of the contact's latest review.

reviewAverageGrade

Review Average Grade

Number

The contact's overall review rating.

Make these attributes "Segmentable", "Exportable" and "Read-only in contact card".

You should also map these three custom attributes to a specific contact panel giving you an easy way to view them (for example, a tab on the contact card named "Rating and Review").

Important

Be sure to pick the correct Type for the custom attributes.

Here is a payload sent from TestFreaks to Engage to update these attributes for a contact:

{
    "reviewAverageGrade":4.5,
    "reviewLatest":"2024-11-20T13:00:00.000Z",
    "reviewLatestValue":5,
    "interests":"sport"
}

This is sent to this endpoint:

POST api/v2/contacts/{contactId}

Or for API v3:

PATCH api/v3/contacts/{contactId}

4 - Send the interaction

Once the schema has been created and posted, you can send interactions of this type. In the case of the schema above, the interactions you send will look like this:

{
  "schemaId": "completedProductRating",
  "contactId": "ea50e150-e12a-49f9-a496-b21001450d55",
  "createdDate": "2022-07-05T09:26:01.000Z",
  "payload": {
    "productSku": "17184225",
    "rating": 5,
    "comment": "Ett bra grepp precis som jag förväntade mig. "
  }
}

Important

The schemaId (is this case "completedProductRating") must match the one used in the schema definition payload.

This payload is sent to the interactions endpoint:

POST api/v2/interactions

The interaction can be picked up in Engage by a custom automation trigger and used to start an automation. An example of the response is:

{
  "id": "gvwixukdja3w5v6afac47pkoi27346i52wyeu37faaqik76cocyjv4ih2gj7zwyiojsxm2lfo5jwk3tu",
  "self": {
    "contactId": "6e48d16c-05c0-46bd-be1d-b06f0085c2b0",
    "href": "https://qaretail1.acceptanstest.voyado.com/api/v3/interactions/gvwixukdja3w5v6afac47pkoi27346i52wyeu37faaqik76cocyjv4ih2gj7zwyiojsxm2lfo5jwk3tu",
    "created": "2023-12-14T10:56:16+00:00"
  }
}

The Interaction details can be viewed on the contact card, on the "Interactions" tab.

5 - Set up the custom automation trigger

Important

This functionality is coming soon.

Set up the custom trigger according to the instructions here.

  1. Name the custom trigger “Testfreaks review”

  2. Give it the triggerId of “sendReview”

  3. Add the three fields to be used in the custom trigger's payload:

    • Name: reviewHTML

      Description: The products to review

    • Name: type

      Description: Type of send-out

    • Name: language

      Description: Language in TestFreaks