Digibee Tools

Know the Capsules available in this Collection.

Micaella Mazoni avatar
Written by Micaella Mazoni
Updated over a week ago

IMPORTANT: This documentation has been discontinued. Read the updated Digibee Tools documentation on our new documentation portal.

The Collection of Digibee Tools Capsules makes available, in a standardized way, resources that are commonly used in pipelines. That way, also through the use of the best practices, the construction of pipelines becomes more productive.

CPF CNPJ Validator

With this Capsule it’s possible to validate the value of numbers of Brazilian documents that identify a person in an unique way: CPF (Cadastro de Pessoas Físicas) and CNPJ (Cadastro Nacional da Pessoa Jurídica).

For that, the CPF CNPJ Validator Capsule uses mathematical calculation and guarantees that the verifying digit is correct. It’s important to highlight that the Capsule doesn’t validate the register situation of the mentioned documents in the Brazilian Internal Revenue Service.

See an example of validation result:

{
"libOutPut": {
"isCpfValid": true,
"isCnpjValid": false,
"noMask": "12345678909",
"withMask": "123.456.789-09"
}
}

If there’s an error in the javascript algorithm, an execution error will be thrown:

{
"timestamp": 1620665936661,
"error": "Capsule capsule-v1-digibee-collection-name-test-capsule-name-test-1.0 failed execution. Error: com.digibee.pipelineengine.exception.PipelineEngineRuntimeException: Error during validation of Cpf/Cnpj.",
"code": 500
}

Digibee Publish Error

Use this Capsule to standardize the way your pipeline publishes error messages. The Digibee Publish Error Capsule doesn’t directly send messages to your monitoring dashboards or apps (Slack, email, etc). The Capsule behavior consists in standardizing key information for the integration monitoring. Besides, technical details regarding the execution are made available. The next step is to create a pipeline responsible for receiving such messages and choosing options such as to send a grouped email with the errors.

The Capsule also guarantees that all error notifications are standardized, allowing flexibility in the dispatch of additional information through the field “payload”.

The fields “Subject” or “Error Code” can be used in the error grouping criteria. For example:

  • In a request integration, the errors generated in a determined time gap must be grouped and a single ticket must be generated for the team in charge of evaluating the incident.

  • In the products integration flow, it’s necessary to separate the errors with ERP from the errors with the e-commerce platform. In this case, each group has a different grouping value and the notifications can be handled in a decentralized way.

IMPORTANT: the Digibee Publish Error Capsule standardizes the information that must be filled by the developer in the errors handling and such information is published by the Pipeline Executor component. Therefore, the ‘error-handling-group-and-notify‘ pipeline must be built and published in the same environment. To obtain an example of it, get in touch with the Digibee support team.

See an Capsule use illustration:

Parallel Execution List to Objects

This Capsule transforms an array into an object map, using the existing “executionId” field in the array root. The use of Parallel Execution List to Objects can be applied to the output standard of the Parallel Execution component when recovering objects from the parallel processing.

See an example of use, in which a parallel execution flow is applicable:

The flow above results in the following array:

[
{
"executionId": "Examaple-execution-3",
"result": {
"message": {
"year": "2021"
}
}
},
{
"executionId": "Address-execution-2",
"result": {
"body": {
"address": "Disney"
}
}
},
{
"executionId": "Customer-execution-1",
"result": {
"customer": {
"name": "Mickey Mouse"
}
}
}
]

Using the combination of the Block Execution component with the parallel flow (according to the example above) and the Capsule, the result is an object map for each execution Id. Check it out:

{
"Examaple-execution-3": {
"message": {
"year": "2021"
}
},
"Address-execution-2": {
"body": {
"address": "Disney"
}
},
"Customer-execution-1": {
"customer": {
"name": "Mickey Mouse"
}
}
}

Send Email Alert

The goal of this Capsule is to ease the errors dispatch by email based on the information filled in the configuration form. Send Email Alert enables the dispatch of complementary information in a predetermined email template for the error root cause to be understood.

To use this Capsule, it’s necessary to configure an “SMTP Auth And Properties” account type. Click here to access our full article about the use of accounts.

Click here to see an example of configuration using your Google account.

IMPORTANT: check the limit of messages allowed by your email account. For a better reliability in the amount of sent emails, we recommend the approach presented in the Digibee Publish Error Capsule.

Sort Array by field

The goal of this Capsule is to organize your JSON array in a crescent (A-Z) or in a decrescent way (Z-A).

IMPORTANT: the organization doesn’t take into consideration the chronological time of dates, but only the alphabetical order. For a correct organization, the date must be in this format: ‘yyyy-mm-dd’.

Validate API Keys

When a pipeline must be executed with a maximum number of API Keys that differs from the Runtime standard, use the Validate API Keys Capsule so that the executions aren’t run with the wrong deployment configuration.

For example, if the pipeline allows the execution of up to 2 concurrent requests, but Runtime is configured with 10 concurrent requests and the Capsule with 2, then an error is thrown in the executions for the configurations to be corrected. However, if the Capsule configuration determines 2 concurrent requests, the deployment must be configured with no more than 1 or 2 API Keys.

Click here to learn more about Runtime.

Did this answer your question?