national-gold
national-gold17mo ago

Filter By Formula

Hello! I'm using an API block to retrieve some information, so I'm adding a few parameters to retrieve the right info from Airtable, and as I saw on tutorials, I use the filterByFormula formula. But the strange thing I noticed is that the request doesn't work. But then I wrote "fiter" instead of "filter" (it was a mistake) and it works! Is this normal as the formula name is fiLter and not fiter?
6 Replies
Tico | Voiceflow Assistant
The correct parameter to use when you want to filter data from Airtable is "filterByFormula". If you're finding that "fiterByFormula" is working instead, it could be due to a bug or an issue with the specific API you're using. However, it's important to note that using incorrect parameters may lead to unexpected results or issues down the line. I would recommend double-checking your API documentation or reaching out to the API provider for further clarification. In Voiceflow, when you're setting up your API block, you can add parameters under the Params section. For example, if you're using a GET request to retrieve data from Airtable, you would add "filterByFormula" in the Key column and your specific formula in the Value column. Remember to test your API call using the "Send Request" button in the API block. This will help you ensure that your API call is set up correctly and is returning the expected data. If you're still encountering issues, you might want to review your formula or the data you're trying to retrieve. In the case of Airtable, formulas are case-sensitive and must be written in the exact same way as the field names in your Airtable base. Also, ensure that the formula doesn't have any syntax errors and is correctly formatted. For more detailed information on how to use the API block in Voiceflow, you can refer to this document. For information on using formulas in Airtable, you can refer to this guide.
national-gold
national-goldOP17mo ago
@Tico | Voiceflow Assistant I use the "filterByFormula" formula to set the conditions, and then use the "response.records.1.fields.[...]" formula to retrieve the Airtable information, would you know why the variables wouldn't get the right infromation to the variables? In facts, it always sets these variables to the same input, even when it doesn't fit the conditions set in the API block
passive-yellow
passive-yellow17mo ago
If you open a chatGPT session and copy in the VoiceFlow API page, and also the API documention page for your base in airtable, chatGPT will give you the exact endpoint URL that contains the filterbyformula code within it, along with any variables you need to insert based on what you tell it you want to do. I don’t code and am only just learning about how to use API’s so this has been really helpful for me to leverage.
wise-white
wise-white14mo ago
Hey @Tico | Voiceflow Assistant , I have an issue in the same area. When using Airtable get API call , I can save the response into a veriable. but once using the filterByFormula parameter, I do get the correct record, but now saving the response to a variable is not working and even worse, it is distructable! Even when removing the filterbyformula and using the same addres as before the variable can't be saved properly. This required a restore action, I repeated this a few times with the same bug.
Tico | Voiceflow Assistant
To integrate Airtable with your Voiceflow assistant, you need to use the API block and correctly map the response to a variable. Here are the steps: 1. Capture Response: - In the API block, use the Capture Response section to map the response to a variable. For example, if you are capturing a task, it should look like:
[response.records[0].fields.Task]

[response.records[0].fields.Task]

2. Check JSON Path: - Verify the JSON path used in the Capture Response section. It should match the structure of the response you receive. Troubleshooting 1. Validate JSON Format: - Use an online JSON validator to ensure the response format is correct. 2. Check for Hidden Characters: - Sometimes, hidden characters can cause issues. Use an online tool to reveal and remove any hidden characters. 3. Re-Test API Call: - Use tools like Postman or Insomnia to test the API call and ensure it returns the expected response. 4. Debugging Tips: - Double-check the API documentation for accepted content types and compare your configuration to example requests. - Ensure that the variable names in Voiceflow match exactly with the keys in the JSON response. Example API Block Configuration - Headers:
Authorization: Bearer YOUR_API_KEY

Authorization: Bearer YOUR_API_KEY

- Capture Response:
[response.records[0].fields.Task]

[response.records[0].fields.Task]

If you encounter any issues, it might indicate a problem with the API configuration or the variable mapping in Voiceflow. Double-check all configurations and ensure there are no discrepancies. For more detailed guidance, refer to the Airtable Integration – Voiceflow documentation.
wise-white
wise-white14mo ago
Thanks for the response, I found a work around using airtable views. this way I create the filter in the airtable and use the regular get to fetch the response

Did you find this page helpful?