The HTTP Request component allows you to invoke external APIs from a 2Chat WhatsApp flow. This will help you easily integrate external services and send or receive information from external sources using GET or POST raw requests.
You can combine this component with the Message and Wait for Reply to store custom variables to make customized requests.
When you add the component you can configure when execution is successful or when is failed.
The configuration of this component is as follows.
1. Request Type
You can select the request type depending on the API to invoke
Method | Description | Data Location |
GET | Retrieve data | Query parameters |
POST | Create/Update data | Request body |
PUT | Replace data | Request body |
PATCH | Partially modify data | Request body |
2. Request URL
You must provide the full URL of the API or web service endpoint.
3. Parameters
Parameters are usually required when the request uses the GET method, as these parameters are sent as a query string in the URL.
You click on to add parameters, enter the Parameter name, and enter any value. Alternatively, click on the { }
button to select dynamic variables.
4. Headers
Headers are usually required to add authentication keys and configure the response type
You click on to add headers, enter the Header name, and enter any value.
5. Body
The Body is usually required for request using the POST method and the text sent is usually in JSON format according to the API specification.
You can click on the { }
button to select dynamic variables.
6. Response
In this section, you configure how to handle the API request, you can add a sample from the response and use JSON path to extract the value and assign it to a Custom Field.
You can use JSON path to validate the value and click on the buttonand assign a Custom Filed Name.