Use Orders API for Submitting Orders
You’ve configured your flow to obtain opportunity information from Salesforce and product information from the database. This information is needed for placing orders within NTO’s order management system. Luckily, the IT team at NTO has created an Orders API to make interacting with Orders simple. Before this information is used to place an order, it needs to be formatted in a way that the API is expecting. Once the data is in the correct format, a POST request can be made to the API, which returns the OrderID, tracking, and ETA for the order that was placed.
Use the Transform component to format the payload and make the API call using the request module.
- Click the to the right of the Choice router block and add a Transform component.
- Add another card on the right side of the Transform card. Select the HTTP Request module and add these details:
- Method: POST
- URL (this is the URL for NTO’s Order API):
- Close the Request card and open the Transform card to its left.
- Set the data types for the values on the left side.
- Click next to payload in the input column
- Select Set
- Select the Product Information data type
- Repeat step 4 for OppDetails under vars and set the data type to Salesforce Opportunity.
- Repeat step 4 for payload on the right-hand side and set the data type to Order Information. The Transform card should look like this:
- Drag elements from the left side to the right side based on these mappings:
8. If you see an Output media type differs from expected one error, click the Fix It button to resolve. The final Transform card should look like this:
Now you’re ready to place orders! The payload shown in the preview will be posted onto the NTO Orders API. In return, the API will respond with order tracking information. We discussed earlier how customers often call the NTO offices to ask for the status for their orders. To streamline this process for NTO, you’re going to automate sending of order details to customers via SMS. In the next step, you will use the Twilio connector to send SMS notifications to customer upon placing orders.
We won’t check any of your setup. Click Verify Step to go to the next step in the project.