This is an example of how to generate invoices with Flowize and getting back the synchronous response to your CRM or ERP with the invoice generated. We need to do the following steps to accomplish our goal with this example:
Interface​
We are going to create the interface that we need to use it in a Sync URL. This interface is the connector between our CRM/ERP and Flowize API Servers.
The interface configuration should be:
- Request Format: JSON
- Request Structure: Custom Structure
- Example data. Check the payload below that is provided.
You can use the following JSON payload example:
Invoice Content​
To generate the invoices, we need to prepare in advance an example invoice HTML template content. The important things here is that this content will be ready for using it in the function “HTMLTOPDF” that we will use in the workflow later on. Besides, this template will iterate dynamically over each invoice items, and it will be prompt in the invoice output.
To iterate over the items we are using the “attr-dynamic” that allows us to select from our interface the field that contains the invoice items. You can see the template in the picture below:
Workflow​
Now it is the moment to create the workflow that generates the invoices. The workflow that we showed at the very beginning of the article contains the following Apps:
- Slack App. In this example, the Slack App will log the invoices that we are creating so we can monitor our process.
- Html2Pdf. This App is in charge of converting the template that we previously defined to a PDF format.
- Sync URL App. This App will tell to the Flowize API Server the response that your system or software needed.
- Decision object. We are going to use this object to check if the PDF file was generated correctly.
Run a test using the Sync URL​
Now, we are going to create a Sync URL. This Sync URL will have the following configuration:
- Interface. We need to select the Interface with the name created before.
- Flow. In this option, we need to select the previous workflow created.
Finally, we need to copy the CURL example that the Sync URL generates in the URL Configuration tab and use it in your terminal or software like Postman.
Now you can test and play the different responses that you defined in the Sync URL App.