After investing 10 hours, I've finally pinpointed the reason my Airtable API POST call was failing. It seems the built-in tools within callin.io for posting to Airtable are not functioning as expected.
I require further assistance as I'm still unable to get it to work. I've narrowed down the issue to an array that I might not be mapping correctly.
1: I am splitting text, specifically a social media post that begins with the title, "THis is Post Title || This is Post Content". I'm using the Set Variable module for this split:
- Next, here is the array output:
- Subsequently, I attempt to map the Array output (I'm uncertain of its precise name) to the "Post Title" and "Post" fields in the API Call. When I initially configured it, the closing bracket (again, unsure of the exact term) appeared solid purple. However, after running the scenario, even though the correct Post Title and Post Content text is present within the "Request Content", the API Call fails with the following error:
*****Error: 422 Unprocessable Entity
* {"error":{"type":"INVALID_REQUEST_BODY","message":"Could not parse request body"}}*****
AND, THE PURPLE CLOSING BRACKETS for the ARRAY (pieces) are now outlined, not filled in purple.
Here is the complete body of the API Call:
```json
{
"records": [
{
"fields": {
"Post Topic": "Luxury Custom Homes and Interiors",
"Post Subtopic": "Exclusive Design Consultation",
"Post Title": "Designing Your Dream: The Power of Personalized Design Consultation in Southeast Michigan",
"Post": "In the ever-evolving world of luxury custom homes, staying ahead of industry trends is paramount. Southeast Michigan is seeing a surge in personalized home design, blending cutting-edge technology with timeless aesthetics. This is where our exclusive design consultation steps in, offering bespoke solutions for those dreaming of a luxury haven tailored perfectly to their lifestyle and taste.nnAt Haus Custom Homes, our consultation process begins with understanding your unique preferences and needs. From selecting the ideal site to choosing materials that reflect your identity, every aspect of your luxury home planning is curated with precision. As trends lean towards sustainability and smart home technologies, our design experts ensure these elements are seamlessly integrated, enhancing both comfort and functionality.nnWhether you’re looking to incorporate minimalist elegance or opulent warmth, our personalized consultation will transform your vision into a luxurious reality, making your home not just a residence, but a reflection of your highest aspirations.",
"Location": "Southeast Michigan",
"Post Link URL": " https://www.hauscustomhomes.com ",
"Image Prompt": "Realistic Photograph, Cinematic composition, Close up, Architectural consultation session, modern luxurious office, couple attentively listening to architect, detailed blueprints and 3D models, sleek minimalist decor, large windows, view of Southeast Michigan’s green landscape --ar 16:9 --v 6",
"Image": [
{
"url": ""
}
]}
}]
}
```- If I remove the mapped array elements from the API Call body, the Request functions correctly. I suspect the unfilled white bracket at the end is an indicator of the problem?
UPDATES
UPDATE 1:
I retained the first part of the mapped array but removed the second part to try and isolate the issue. The API Call now functions correctly. The part I removed was LONG TEXT that goes into a LONG TEXT field in Airtable. This leads me to believe I might need to configure the API Call differently for LONG TEXT?
UPDATE 2:
I manually inserted LONG FORM TEXT into the API Call within the "Post:" field (or variable?), which might further support the need to handle LONG TEXT going into a LONG TEXT field in Airtable within the API Call.
UPDATE 3:
I have now copied and pasted the NON-WORKING Request Content Body code (or whatever it's called) into the HTTP "Request a Call" Module, replaced the text with the mapped variables from the scenario, and it now works. This is quite perplexing.
("NO LONGER") RESOLVED-ISH:
This is not a definitive solution. However, I copied the API Call "Code" that WASN'T working previously (you can see the error message above), pasted it into the HTTP "Request a Call" Module, then simply replaced the text with the mapped variables from the scenario, and it began to work.
If this hadn't worked, my next step would have been to ELIMINATE THE TEXT SPLIT entirely, generate the Post Title and Post Content separately, and then map them to the API without using an Array.
It would likely take an expert three weeks to fully understand why this isn't functioning correctly, and that's not feasible.
BUT, here is the complete body of the working API CALL:
`
json
Topic Randomizer
{
"records": [
{
"fields": {
"Post Topic": "{{89.}}Custom Homes Design and Build",
Split Post Title
"Post Subtopic": "{{113.Subtopic}}",
"Post Title": "{{115.[1]}}",
Split Post Title
"Post": "{{115.[2]}}",
Location Randomizer
"Location": "{{145.}}",
Link URL ``}}",
"Post Link URL": "{{113.
"Image Prompt": "{{139.result}}",
"Image": [
{
"url": "{{130.href}}"
}
]} }
]
}
```
Hi there!
Please utilize a Create JSON module to construct a well-formed JSON structure. Within this module, you can map the necessary field values.
Afterward, map the JSON produced by this module into the HTTP module to address your requirement.
Best regards,
Msquare Automation - Gold Partner of callin.io
Discover valuable insights and updates on our YouTube Channel!
You'll need to escape special characters within those strings if you intend to map them in this manner.
Characters such as double quotes and newlines require replacement.
For instance: "
should be substituted with "
One method to achieve this is by processing each variable through the "Transform to JSON" module initially.
An alternative approach involves manually replacing the special characters within the string using the built-in replace
function.
samliew – request private consultation
Join the callin.io Fans Discord server to chat with other makers!
I attempted to use “Transform to JSON” and received the following output, which did not function as expected:
json
{
"records": [
{
"fields": {
"Post Topic": "Outdoor Living Enhancements",
"Post Subtopic": "Outdoor Lighting Solutions",
"Post Title": "Brightening Ann Arbor: The Art of Outdoor Lighting",
"Post": "Discover the magic of outdoor lighting techniques! At Greenhaus Landscaping, we harness the power of light to transform Ann Arbor’s outdoor spaces into enchanting nighttime sanctuaries. Whether you’re looking to enhance your garden’s evening allure, ensure safety on walkways, or create a cozy atmosphere for outdoor gatherings, we know that every light placement matters.nnLighting isn’t just functional; it’s about setting a mood. Imagine subtle pathway lights that guide your steps, wash lighting that gently illuminates your home’s facade, or strategic spotlighting that makes your garden’s best features pop. Our expertise in various outdoor lighting techniques not only enhances the beauty of your landscape but also extends your living space into the evening hours, offering more time to enjoy at home with family and friends. At Greenhaus Landscaping, it’s not just about lighting your yard; it’s about redefining your nighttime environment. Ready to light up your landscape? Let’s make your outdoor dreams a glowing reality.",
"Location": "Ann Arbor, MI",
"Post Link URL": "<a href="https://michigan.greenhauslandscaping.com/service-area/macomb-county/macomb-township-landscaping-services/%5C" rel="noopener nofollow ugc"> https://michigan.greenhauslandscaping.com/service-area/macomb-county/macomb-township-landscaping-services/</a> ;",
"Image Prompt": "Realistic photo of a beautifully landscaped garden pathway at twilight, featuring soft, low-level pathway lights that guide the way. The setting is just after sunset with a vibrant twilight sky. The scene is serene and inviting, with a wide-angle shot capturing the full pathway and garden elements in natural colors with warm light hues, upscale and modern landscaping, Michigan plants, high-end design, no people --ar 16:9 --v 5 --q 2",
"Image": [
{
"url": "<a href="https://cdn.renderform.io/AyP47SXDoOHIsP9Oomxi/results/req-8cdd8855-add9-4486-a702-0fecac71a67d.jpg%5C" rel="noopener nofollow ugc"> </a>"
}
]
}
}
]
}
It appears to have worked, and your newlines have now been converted to n
and double quotes "
have been escaped to "
.
Now, please place that variable into your third screenshot. Repeat this process for the remaining variables.
If you require further assistance, kindly provide the following:
2. Scenario Blueprint
Please export the scenario blueprint file so that others can review the mappings and settings. You can find the Export Blueprint option by clicking the three dots at the bottom of the scenario editor.
(Note: Exporting your scenario will not expose private information or connection keys)
Uploading it here will appear as follows:
blueprint.json (12.3 KB)
3. And most importantly, Input/Output Bundles
Please provide the input and output bundles for the trigger/iterator/aggregator modules. You can do this by running the scenario (or retrieving them from the Scenario History tab). Then, click the white speech bubble in the top-right corner of each module and select “Download input/output bundles”.
A.
Save the contents of each bundle in your text editor as a bundle.txt
file and upload it to this discussion thread.
Uploading them here will look like this:
module-1-output-bundle.txt (12.3 KB)
B.
If you are unable to upload files on this forum, you can alternatively paste the formatted bundles using this method:
-
Either enclose the content with three backticks
```
before and after, like this:```
input/output bundle content goes here
``` -
Or utilize the format code button within the editor:
Providing the input/output bundles will enable others to replicate the scenario's behavior, even if they do not use the external service.
I did take the Transform to JSON output and use it as the body for the HTTP "Make a Request" action, but it didn't work.
My whole scenario is a bit complex, but ALL I'M TRYING TO DO IS SEND AN API REQUEST TO Airtable. This should be one of the most basic things you could do in a callin.io course, and I've wasted about 30 hours just trying to create a record and update it in Airtable.
Hi, I was wondering if I could ask a few questions regarding the issue mentioned above?
I mean, code is code, so why would my code function correctly at times and not others when triggering an API request to Airtable via HTTP "Make a Request"? Also, why wouldn't anyone else notice my JSON was malformed, nor CHATGPT, nor the Airtable API Documentation? Nowhere does it state that you have to format everything with numerous backslashes??? It's quite perplexing.
I'm at my wit's end because now, literally everything feels like a guessing game of random attempts. Nothing works, there's no explanation as to why it fails, most people don't understand why it works, and these are supposedly the most basic operations.
Please provide the rewritten markdown content *it should be in the markdown format.
_SOLUTION IS BELOW: PROBLEM IS THAT CALLIN.IO IS BROKEN_
…Which is what I suspected the entire time. The way callin.io sends the API request doesn't work. They literally mess it up so it doesn't work.
Due to the limitations of not being able to CREATE A RECORD using the AIRTABLE MODULE utilizing a dynamic base id and table id mapped from previous modules, here was the solution I created.
I simply brought in the Airtable Base ID via the WEBHOOK TRIGGER. Then rather than use a single HTTP “Make a Request” using the Airtable API to create the records, I am just utilizing one Airtable Create Record Module for each client, this way I can use the right base and table in the create record and still have it be dynamic. I set up a router and then filters between the router and the Airtable Create Record Modules that filter based on Base ID. Seems like a completely ghetto solution but it will work for me.
Please provide the rewritten markdown content *it should be in the markdown format.
Hi,
First, add a Create JSON module.
Under Data Structure, click Add
Give your Data Structure a name that makes sense.
Click Generate
Paste this into the Sample Data box:
{
"fields": {
"Name": "Record Name",
"Post": "Discover the magic... ",
"Image": [
{
"url": "https://www.example.com"
}
],
"Location": "Someplace, USA",
"Post Title": "Brightening Ann Arbor...",
"Post Topic": "Outdoor Living Enhancements",
"Image Prompt": "Realistic photo of...",
"Post Link URL": "https://www.example.com",
"Post Subtopic": "Outdoor Lighting Solutions"
}
}
Map your data into all of the fields:
In your Airtable Make an API Call module, set it up as follows:
For URL, specify everything after https://api.airtable.com/
which should be v0/<tableid>/Post
For Body, wrap your Create JSON output as shown.
Airtable needs a single records
array of collections (10 max), each structured as specified in the Create JSON module.
If you need to create multiple new records (up to 10 at a time) use Aggregate to JSON instead, specify the same Data Structure, but alter your Airtable Body slightly to remove the square brackets around the JSON Aggregator’s output:
Hope that makes sense and hope it helps you out.
I had to approach it differently for the time being, but thank you immensely for dedicating the time to share this! This will be incredibly useful down the line.