Help

Receive Emoji through API

Solved
Jump to Solution
566 6
cancel
Showing results for 
Search instead for 
Did you mean: 
Stephen_Curtis
6 - Interface Innovator
6 - Interface Innovator

I’m working on a fun, friends and family base for recording daily quiz results (Wordle etc.).
The idea is that people can use an iOS shortcut to parse their score and past it to an Airtable base using the API.
The eventual goal is to build a friends and family league for these types of games and maybe use interfaces to display the league.

I’ve got the shortcut working for the most part in so much as I have game name, the game #, date and number of attempts to successfully get the answer working.
However I thought it would be nice to bring through the visual representation of the attempts - this is the bit normally displayed using emoji.
For example…
:brown_square: :brown_square: :orange_square: :orange_square: :yellow_square: :yellow_square: :green_square: :star2:
:arrow_up_small: :arrow_up_small: :arrow_up_small: :arrow_up_small: :arrow_up_small: :arrow_up_small: :hammer: :star2:
I was simply going to add these lines as a multi line text field in the base but I am stuck on how to pass it via the json / API.

Can anyone tell me if it is possible to include emoji in a json to be passed to the Airtable API?
If so, is there a proper way to format or encode them?

1 Solution

Accepted Solutions
Stephen_Curtis
6 - Interface Innovator
6 - Interface Innovator

Thanks for this @ScottWorld . I’ve just got to the bottom of this and found my mistake.

As the visual aspect of the score can span multiple lines, I had intended on presenting this in my Airtable base as a multi-line text field and as a result had been submitting the json as follows; with the multi lines split in the json…

{
	"records": [{
		"fields": {
		"Date": "2022-07-26",
          	"Game": "Emovi",
          	"Game #": 9,
          	"Attempts": 1,
          	"Attempts Allowed": 3,
          	"Visual": "👽🤰🩸😱
🟩⬜⬜"
		}
	}]
}

I now realise this is not valid json :man_facepalming: and this is why the api could not parse the request…

{"error":{"type":"INVALID_REQUEST_BODY","message":"Could not parse request body"}}

I changed my iOS Shortcut to join the different lines of emoji using ‘//‘ instead of new lines and it successfully passed the emojis into my base.

{
	"records": [{
		"fields": {
		"Date": "2022-07-26",
          	"Game": "Emovi",
          	"Game #": 9,
          	"Attempts": 1,
          	"Attempts Allowed": 3,
          	"Visual": "👽🤰🩸😱//🟩⬜⬜"
		}
	}]
}

image

My only remaining question on this is if there is a way of still presenting these as separate lines in the base - I.e. convert ‘//‘ back into line breaks in my multi-line field.

See Solution in Thread

6 Replies 6

Hmm, there must be some way to do it because it is possible when I use Make.com. (See screenshot below.)

But I bet that Make.com uses the scripting API behind the scenes, so they are probably using JavaScript to do some sort of an encode/decode process behind-the-scenes.

So my guess is that you would need to introduce JavaScripting somewhere along the way here to make things work. This is just a guess on my part. The JavaScript experts would need to chime in on this one.

In the meantime, as a fallback method, I bet you could use the iOS shortcuts app to send your JSON data — with emojis — to a Make.com webhook, and then have Make send the data onto Airtable from there. This is also a guess, as I haven’t yet tried sending emojis to a webhook.

image

I just tested my idea from above, and I can confirm that you can send JSON data that includes emojis to a Make.com webhook, and it will process the emojis properly and forward the emojis onto Airtable.

This is the very simple test scenario that I just setup, and it works perfectly:

Screen Shot 2022-07-25 at 2.48.11 PM

Stephen_Curtis
6 - Interface Innovator
6 - Interface Innovator

Thanks for this @ScottWorld . I’ve just got to the bottom of this and found my mistake.

As the visual aspect of the score can span multiple lines, I had intended on presenting this in my Airtable base as a multi-line text field and as a result had been submitting the json as follows; with the multi lines split in the json…

{
	"records": [{
		"fields": {
		"Date": "2022-07-26",
          	"Game": "Emovi",
          	"Game #": 9,
          	"Attempts": 1,
          	"Attempts Allowed": 3,
          	"Visual": "👽🤰🩸😱
🟩⬜⬜"
		}
	}]
}

I now realise this is not valid json :man_facepalming: and this is why the api could not parse the request…

{"error":{"type":"INVALID_REQUEST_BODY","message":"Could not parse request body"}}

I changed my iOS Shortcut to join the different lines of emoji using ‘//‘ instead of new lines and it successfully passed the emojis into my base.

{
	"records": [{
		"fields": {
		"Date": "2022-07-26",
          	"Game": "Emovi",
          	"Game #": 9,
          	"Attempts": 1,
          	"Attempts Allowed": 3,
          	"Visual": "👽🤰🩸😱//🟩⬜⬜"
		}
	}]
}

image

My only remaining question on this is if there is a way of still presenting these as separate lines in the base - I.e. convert ‘//‘ back into line breaks in my multi-line field.

That didn’t take long to find :joy:
I changed my join from ‘//‘ to ‘\r ‘ and it succeeded in adding the line breaks in the base :tada: .

I’ll continue work on this and share the base idea in the community soon.

{
	"records": [{
		"fields": {
		"Date": "2022-07-26",
          	"Game": "Emovi",
          	"Game #": 9,
          	"Attempts": 1,
          	"Attempts Allowed": 3,
          	"Visual": "👽🤰🩸😱\r 🟩⬜⬜"
		}
	}]
}

image

That’s great! I was actually using an iOS app called HTTPBot to test sending the emojis via the API and it didn’t work. But it seems like it was the app that was the problem and not the Airtable API itself, because when I tried it with Postman, it worked fine. So there doesn’t seem to be anything unusual about sending emojis to Airtable via the API… it’s just like sending any other normal text. Emojis and text both work identically.

Yep. I tried with HTTPBot as well and that had confused me further as it wasn’t working. At least I got to the bottom if it and this will help me if I want to do something similar in the future.