Trx Monitoring: iframe integration
This guide describes integration of automatic documents request for transaction monitoring.
1. Case Creation
- Obtain credentials from Intrepid Fox
- 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
For detailed specification, see https://docs.intrepidfox.tech/reference/create_case_api_v1_cases_post
| Parameter | Value format | Description |
|---|---|---|
| communication_id | string | Optional, 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_recipients | list of email addresses | Optional, email addresses to send invitation to the dialog: ["[email protected]", "[email protected]"] |
| company_id | string | Optional, internal number of the client company |
| company_full_name | string | Full legal name of the company including LLC etc. |
| company_reg_date | YYYY-MM-DD | Optional, date of company registration |
| company_industry_classification | list of classification entries | For UK SIC codes, use the following structure: [ {\"classification\": \"UKSIC2007\", code: \"01120\"},{\"classification\": \"UKSIC2007\", code: \"01160\"}] |
| account_opening_date | YYYY-MM-DD | Date when account was opened |
| ultimate_debtor | string | Ultimate debtor |
| trx_direction | string ("incoming"/"outgoing") | Select between 'incoming' and 'outgoing' transaction |
| trx_counterparty_full_name | string | Full legal name of the company including LLC etc. or a person |
| trx_amount | number | Amount (decimal number, like 253.50) |
| trx_currency | string | 3-letter ISO 4217 currency code (like "EUR") |
| trx_date | YYYY-MM-DD | Transaction date |
| trx_description | string | Optional, description of transaction |
| trx_ref_number | string | Reference number of the transaction |
| modules | list of modules | list 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.
- Get conversation ID in the response
{
"result": "case_created",
"case_id": "...",
"conversation_id": "..."
}2. iFrame launch
- Create a conversation Link
https://int.dev.intrepidfox.app/partner/[GET_A_PARTNER_CODE_FROM_US]?id=[add conversation_id here]- Add html to your webpage
- 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
});- Wait for the events at console.log(event.data.name)
chat-loaded - iframe loaded confirmation
chat-is-finished - the chat completed
- 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:
| Parameter | Value format | Description |
|---|---|---|
| event | string "chat_finished" | always |
| case_id | UUID string | ID of the case (the same which was returned by the POST /api/v1/cases request) |
| conversation_id | UUID string | unique if of the conversation (the same which was returned by the POST /api/v1/cases request) |
| communication_id | string | optional, 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_link | string | URL for the report to download, secret-protected |
| web_report_link | string | URL to a web-report, password-protected |
| client_documents | list of the links to the files uploaded by the client |
Updated 3 months ago
