Emoji in Merge Fields Truncated - mailchimp

I've been working on a MailChimp integration and have run into an issue where their server truncates data sent via merge_fields when including emoji characters. The simplest example that reproduces the behaviour is a PUT request to /lists/xx/members/ with the following body:
{
"email_address": "my.test#email.address",
"status": "subscribed",
"merge_fields": {
"FNAME": "Ian",
"LNAME": "Cool🐯Cat"
}
}
Using the playground on their developer website, the response comes back with the "LNAME" set correctly to "Cool🐯Cat". The issue is that when I view the data later, either via a cURL lookup or generating a campaign email, The "LNAME" field has been truncated to "Cool", stripping the emoji and everything after it.
If anyone has a fix for this behaviour, that would be appreciated. I suspect it's just an issue with MailChimp's database (I know there have been some issues with storing emoji to certain versions of MySQL, for example).
Edit: In the meantime, I'm using this solution to simply strip out the offending non-BMP Unicode characters, but I'd really like an answer that doesn't kill my data.

Related

File.list only returning Id and name

I am doing a file.list in the google drive api
GET https://www.googleapis.com/drive/v3/files?access_token=XXXX
This is working fine but its only returning four fields for each of the files in the list
"kind": "drive#file",
"id": "1x8-vD-XiXEEA5Spf3qp8x2wltablGF22Lpwup8VtxNY",
"name": "Experts Activity Dump go/ExpertsActivities",
"mimeType": "application/vnd.google-apps.spreadsheet"
The documentation states that it should be returning a full file resource for each file but its not.
The only thing i have been able to do is to do a file.get on each of the files to get additional information.
This was an old issue that appears to have been fixed now.
GET https://www.googleapis.com/drive/v3/files?fields=*&access_token=XXXX
by sending fields=* you can now see a full file.resorce response for each of the files in the list. It is no longer necessary to do a file.get for each file.
That being said its probably a good idea to limit the fields to those you actually need
This is the intended behaviour of the API. For reference, you may see here the explanation next to the "fields" parameter:
The paths of the fields you want included in the response. If not specified, the response includes a default set of fields specific to this method. For development you can use the special value * to return all fields, but you'll achieve greater performance by only selecting the fields you need. For more information see the partial responses documentation.
For this api, the default fields are indeed kind, id, name and mimeType.
It is recommended that you limit the fields (using the aforementioned parameter) to the ones you need, as it will yield a considerable performance difference.

Get stringified object instead of string with text in when Clicked on Quick reply in FB Messenger Channel (BotFramework v3, Nodejs)

Today, my bot stopped responding to me when clicking on quick replies in FB Messenger. Instead of getting the payload as a string, it now returns a stringified object with extra fields.
I'm using a bot with a custom dynamic dialog and creating SuggestedAction like this:
choices.push(builder.CardAction.postBack(session, "title=Name&params=Some", "Quick Reply Name"));
I used to receive the payload as a string "title=Name&params=Some" in Session object like the following:
session.message.text
But now, in session.message.text, I receive the following string:
"{\r\n \"type\": \"postBack\",\r\n \"value\": \"title=Name&params=Some\"\r\n}"
Has anybody else faced this same issue?
Is this coming from changes in Azure Bot Service? And if so, where can we follow the change log or release notes?
Since card action behavior is channel-specific it's much more likely that this relates to a change in the Facebook Messenger platform. You can view their changelog here: https://developers.facebook.com/docs/messenger-platform/changelog/
I can see there was a change on January 8th. It doesn't mention anything about postBack behavior, but it's still possible that there could be some unintended or undocumented changes that are responsible for the results you're seeing.
It looks like it should be a simple matter to deserialize the JSON and extract the value.
var payload = JSON.parse(session.message.text).value;

Disable HTML encoding of substitution_data

After we switched from Mandrill to SparkPost we encountered issues when sending emails using transmission. In Mandrill merge_vars were not HTML encoded and we sometimes put HTML in them, however in SparkPost substitution_data does appear to be HTML encoded and it's messing some of our emails. Is there a global setting that allows to turn this off or at least disable it for a transmission?
Edit: I forgot to mention that we use csharp-sparkpost library, which means it might be a problem directly related to the library rather than SparkPost API and I need to investigate it further.
Edit2: I tested sending an email directly using JSON and the result was the same, so I can conclude that the HTML encoding is done by SparkPost and not by the c# library.
You can render HTML in substitution variables without escaping by using 3 braces around your variables. e.g. With this in your transmission:
{
"substitution_data": {
"firstName": "<em>Jimbo</em>"
},
"content": {
"html": "<p>Hi {{{firstName}}}</p>"
}
}
...you get this in your HTML message body:
<p>Hi <em>Jimbo</em></p>
There are more details in the SparkPost reference docs: https://developers.sparkpost.com/api/#/introduction/substitutions-reference/escaping-html-values

Google Global Address List for Domain limited to 250 results [rehash]

Reposting due to lack of answers
I'm trying to query Google Global Address List for a specific domain, being led by this answer here (Specifically the answer by Jay Lee).
It's all well and good and works perfectly in Google's OAuth Playground, however it seems to be limited to 250 users. Given that this feature seems completely undocumented, and that I can't tell by looking at their github repo (specifically this file), does anyone know how to query for the next 250 users or how to set the number of results?
Thank you!
My last answer was converted into a comment, but I now have a complete answer to this question.
EDIT: I repeatedly mention JSON but you don't need to parse this in JSON to get the syncToken. Google will provide you the syncToken regardless.
The Google GAL API seems to operate in a similar manner to the Google Calendar or YouTube API's "nextPageToken" parameter, which allows you to query the next page of results as long as you have a token.
The Google GAL uses the "syncToken" parameter as a replacement. Much like the other Google API's, if you append this syncToken to the end of your URL, you will get the next page of results. Note that I was unable to get the startIndex parameter to work (which allows you to begin at a specific item in the JSON), so if you are trying to get a specific result through the query you will most likely have to parse the entire JSON file. Inside the parsed JSON, there should be a key called "gal$syncToken." You can find it in the json right before the "entry" key/array which is where all of the global domain contacts are listed.
Here is an example of what it would look like:
"gal$syncToken": {
"$t": "0_1001_17011_AAN3FFNH2AEJ3SFBKZDRS36AHRXHND47YACXLGFJF5QBXCSQLUK57EX3LC765CU5IWG6ZXWHPS5WKHSDFJ26LRI5FRIVIQ3Z532PWKG3ZG45JW3RVCDZMWK5LLLHZSCBTJH5U6Q4LZRG4PKWQE42AOIPC4VJCZQIP5MBJHNUBZZJNLKISKETTQ6DNTRAPTI"
},
Your syncToken will look different. To get the next page of results, Google actually provides a link that already has the syncToken pre-appended:
{
"rel": "next",
"type": "application/atom+xml",
"href": "https://www.google.com/m8/feeds/gal/example.com/full?sync-token=0_1001_17011_AAN3FFNH2AEJ3SFBKZDRS36AYRXHND47YACXLGFJF5QBXCSQLUK57EX3LC765CU5IWG6ZXWHPS5WKHSDFJ26LRI5FRIVIQ3Z562PWKG3ZG45JW3RVCDZMWK5LLLH6SCBTJH5U6Q4LZRG4PKWQE42AOIPC4VJCZQIP5MBJHNUBZZJNLKBSKETTQ6DNTRAPTI"
},
However, this will only give you the next 250 results. If you want more on each page, you can append the max-results parameter to this and have Google spit it back out in JSON format.
https://www.google.com/m8/feeds/gal/example.com/full?sync-token=INSERT_SYNCTOKEN_HERE&alt=json&max-results=10000
Hope this helped anyone seeing this. The Google GAL seems to be largely undocumented for the most part and I was unable to find an answer to this question anywhere else on the internet. If anyone from Google can confirm that this is the best method for accomplishing this that would be great!

CouchDB Query View with Multiple Keys Formatting

I'm having a problem getting a couchdb view to return the proper documents when using multiple keys.
This works fine, returning the documents that match:
GET http://example.com:5984/myDb/_design/myFilters/_view/getItemByForeignKeyId?key=abc123
This returns returns all documents in the view, matching or not:
GET http://example.com:5984/myDb/_design/myFilters/_view/getItemByForeignKeyId?keys=%5B%22abc123%22%5D
I'm usually very good at hunting down my answers. But, CouchDB documentation is very clear on the format for using multiple keys. I've seen some use the ?keys=[123,123] and i've also seen ?keys="abc","abc".
If anyone can offer any clarification on the 'proper' format and encoding of multiple key queries for CouchDB using a GET method, I would be extremely appreciative.
To get multiple keys from a view, you need to do a post request and submit the keys in the request body. Your HTTP request will look like this:
POST /myDb/_design/myFilters/_view/getItemByForeignKeyId
Content-Type: application/json
{
"keys" : [
"abc",
"123"
]
}
function(doc){
{
if([doc.key1, doc.key2])
emit([doc.key1, doc.thingYouWantToKnow]);
}
}
and in the query string, at the end
?key=["key1Value", "key2Value"]
Notice that it is key=[], not keys=[] !!!!!!!!!
Not saying it's correct, but you can actually do it via query string as well. The array enclosing brackets should not be encoded. E.g. this works for me:
http://localhost:5984/test/_design/artists_albums/_view/albums_by_artist?keys=[%22Super%20bad%20artist%22,%20%22Fake%20artist%201%22]

Resources