Trx Monitoring: iframe integration

This guide describes integration of automatic documents request for transaction monitoring.

Integration Flow

1. Case Creation

  1. Obtain credentials from Intrepid Fox
  2. Send HTTP POST to https://int.dev.intrepidfox.app/api/v1/cases with JSON payload:
{
  "communication_id": "...",
  "invitation_email_recipients": "...",
  "case": {
    "case_kind": "monitoring",
    // ... other parameters described below ...
  }
}
👍

This endpoint uses HTTP Basic Authentication, so request shall include Authorization header

👍

ParameterValue formatDescription
communication_idstringOptional, any string ID generated at your end which can be used to reference this case later (for example, you can pass transaction reference number in this field)
invitation_email_recipientslist of email addressesOptional, email addresses to send invitation to the dialog:
["[email protected]", "[email protected]"]
company_idstringOptional, internal number of the client company
company_full_namestringFull legal name of the company including LLC etc.
company_reg_dateYYYY-MM-DDOptional, date of company registration
company_industry_classificationlist of classification entriesFor UK SIC codes, use the following structure:
[
{\"classification\": \"UKSIC2007\", code: \"01120\"},
{\"classification\": \"UKSIC2007\", code: \"01160\"}
]
account_opening_dateYYYY-MM-DDDate when account was opened
ultimate_debtorstringUltimate debtor
trx_directionstring ("incoming"/"outgoing")Select between 'incoming' and 'outgoing' transaction
trx_counterparty_full_namestringFull legal name of the company including LLC etc. or a person
trx_amountnumberAmount (decimal number, like 253.50)
trx_currencystring3-letter ISO 4217 currency code (like "EUR")
trx_dateYYYY-MM-DDTransaction date
trx_descriptionstringOptional, description of transaction
trx_ref_numberstringReference number of the transaction
moduleslist of moduleslist of the modules to be included into the conversation. like:
[
{\"module\": \"invoice\"},
{\"module\": \"contract\"},
{\"module\": \"transaction_rationale\"},
...
]

Modules

When creating a case via the API, you specify which "modules" will be turned on for the dialog with the user.

There are few dedicated modules which ask specific documents or specific information from the user. When these modules are used, the system will validate documents and user answers against predefined rules. For example, the system will validate that company names in the invoice and contract match or that transaction rationale from the user makes sense and is consistent with the documents, etc.

For the transaction monitoring cases, these dedicated modules are:

  • invoice
  • contract
  • transaction_rationale
  • charter_agreement
  • cargo_bill
  • company_proof_of_address

When this is not enough, you can request additional documents or additional information from the user.

To request additional documents, you can use "other_document" module for which you specify document name and intro text (instructions/questions) for the user. Here is how this module looks like in the json payload:

{
  "case": {
    "modules": [
      ...,
      {
        "module": "other_document",
        "document_name": "Transportation Documents",
        "question": "Please provide any document that contains information about the transportation of the items. Examples: a document outlining carrier information, shipping routes, or any required transit licenses."
      },
      ...
    ]
  }
}

The system will not perform any validation of the uploaded file(s).

To ask arbitrary questions to the user, you can use module "follow_up" for which you specify short subject of the question (for the form title) and the question itself. Here is how this module looks like in the json payload:

{
  "case": {
    "modules": [
      ...,
      {
        "module": "follow_up",
        "subject": "Business Volumes",
        "question": "Could you please provide currencies, monthly number of payments and FX volumes of your business?."
      },
      ...
    ]
  }
}

The system will perform basic validation of the user answers (will check that user answer is on-topic), but will not check answer against any documents.

You can include as many such modules (other_document / follow_up) as needed to collect all required information.

  1. Get conversation ID in the response
{
  "result": "case_created",
  "case_id": "...",
  "conversation_id": "..."  
}

2. iFrame launch

  1. Create a conversation Link
https://int.dev.intrepidfox.app/partner/[GET_A_PARTNER_CODE_FROM_US]?id=[add conversation_id here]
  1. Add html to your webpage
  1. Use script below to upload iframe with conversation, inserting the Link at p.1 into the LINK parameter
const iframe = document.createElement("iframe");
iframe.setAttribute("src", LINK);
iframe.setAttribute("frameborder", "0");
iframe.setAttribute("width", "100%");
iframe.setAttribute("height", "100%");
iframe.setAttribute("style", "min-height: 100vh");

const el = document.getElementById("intrepid-fox-container");
el?.appendChild(iframe);

window.addEventListener("message", (event) => {
  if (!["https://intrepidfox.app"].includes(event.origin) || !event.data.name)
    return;

  console.log(event.data.name);

//   wait for events with name chat-loaded/chat-is-finished
});
  1. Wait for the events at console.log(event.data.name)

chat-loaded - iframe loaded confirmation

chat-is-finished - the chat completed

  1. Once you get chat-is-finished, you close the iframe

3. Report and Documents Upload to Your Back-End

When the conversation finishes, Intrepid Fox will call webhook (send HTTP request to the endpoint hosted at your end) passing the JSON payload with results of the conversation.

👍

HTTP Basic Authentication is used in the webhook calls (so request will include Authorization header).

Payload format:

{
  "event":"chat_finished",
  "case_id":"...",
  "conversation_id":"...",
  "communication_id":"...",
  "pdf_report_link":"...",
  "web_report_link":"...",
  "client_documents": [
    {
      "document_id": "...",
      "document_type": "...",
      "document_name": "...",
      "rejected": "...",
      "download_link": "...",
      "original_files": [
        {
          "filename": "..."
        },
        ...
      ]
    },
    ...
  ]
}

Payload description:

ParameterValue formatDescription
eventstring "chat_finished"always
case_idUUID stringID of the case (the same which was returned by the POST /api/v1/cases request)
conversation_idUUID stringunique if of the conversation (the same which was returned by the POST /api/v1/cases request)
communication_idstringoptional, the same ID which was passed when creating the case (for example, you can pass your internal transaction reference number as communication_id)
pdf_report_linkstringURL for the report to download, secret-protected
web_report_linkstringURL to a web-report, password-protected
client_documentslist of the links to the files uploaded by the client