Getting URLs for documents
In certain scenarios, you may need to obtain URLs that point to uploaded documents to be used by other integrations. This requires adding a custom action to your process that requests the URLs from the Documents Plugin.
Sending the request
To retrieve document URLs and use them, for example, in the Notification Plugin to attach them to emails, follow the next steps:
- Create a process and include the following nodes:
- a Kafka Send Event Node,
- a Kafka Receive Event Node
- a User Task Node
- Start / End <ilestone Nodes to create a modal
- Configure the User Task Node and add an Upload Action to it.
- Configure the parameters for the Upload Action:
For more details on uploading a document and configuring an upload action, refer to the following sections:
- Configure the Kafka Send Event Node by adding a Kafka Send Action and specifying the Kafka topic to send the request to:
- Fill in the body of the request message for the action:
types
- a list of document types
- Configure the Kafka Receive Event Node by adding the kafka topic on which the response will be sent.
Kafka topic names can be set by using environment variables:
KAFKA_TOPIC_DOCUMENT_GET_URLS_IN
-ai.flowx.in.qa.document.urls.v1
- the topic that listens for the request from the engineKAFKA_TOPIC_DOCUMENT_GET_URLS_OUT
-ai.flowx.updates.qa.document.urls.v1
- the topic on which the engine will expect the reply
The example topic names above are from an internal testing environment. When setting topics for other environments, follow this pattern: ai.flowx.updates.{{environment}}.document.urls.v1
.
The Engine listens for messages on topics with specific naming patterns. Ensure that your outgoing topic name matches the pattern configured in the Engine.
Receiving the reply
The response body is expected to contain the following values:
[
{
"success": true,
"fullName": "1234_771853/4752_771853.pdf",
"fileName": "1234_771853",
"fileExtension": "pdf",
"url": "<http://SOME_URL/1234_771853/4752_771853.pdf?X-Amz-Algorithm=SOME_ALGORITHM&X-Amz-Credential=SOME_CREDENTIAL&X-Amz-Date=20210223T113621Z&X-Amz-Expires=604800&X-Amz-SignedHeaders=host&X-Amz-Signature=>"
}
]
- success: A boolean indicating whether the document exists and the URL was generated successfully.
- fullName: The full name of the document file, including the directory path.
- fileName: The name of the document file without the extension.
- fileExtension: The extension of the document file.
- url: The full download URL for the document.