Twitter Emoji Targeting not working for PUT call

targeting
api

#1

To the channel we have to send the value : \ud83d\udc4d for the emoji "thumbs up”

When we make the channel call

twurl -H ads-api.twitter.com -A “Content-Type: application/json;charset=UTF-8” “/1/accounts/18ce53uo3nm/targeting_criteria” -X POST -d “line_item_id=5qk6h&targeting_type=PHRASE_KEYWORD&targeting_value=\ud83d\udc4d” | python -mjson.tool

It wrongly interprets the value as : \ud83d\udc4d
reponse:

{
“data”: [
{
“account_id”: “18ce53uo3nm”,
“created_at”: “2016-07-20T09:32:17Z”,
“deleted”: false,
“id”: “9dikc4”,
“line_item_id”: “5qk6h”,
“location_type”: “COUNTRY”,
“name”: “United States”,
“targeting_type”: “LOCATION”,
“targeting_value”: “96683cc9126741d1”,
“updated_at”: “2016-07-20T09:32:17Z”
},
{
“account_id”: “18ce53uo3nm”,
“created_at”: “2016-09-23T07:08:39Z”,
“deleted”: false,
“id”: “a2rhp8”,
“line_item_id”: “5qk6h”,
“name”: “\ud83d\udc4d”,
“targeting_type”: “PHRASE_KEYWORD”,
“targeting_value”: “\ud83d\udc4d”,
“updated_at”: “2016-09-23T07:08:39Z”
}
],
“data_type”: “targeting_criterion”,
“next_cursor”: null,
“request”: {
“params”: {
“account_id”: “18ce53uo3nm”,
“line_item_id”: “5qk6h”
}
},
“total_count”: 2
}
I have tried variations : /\ud83d/\udc4d
and \ud83d\udc4d
but it always interprets it wrongly as \ud83d\udc4d.

I googled and found a batch call solution :
twurl -H ads-api.twitter.com -X PUT -A “Content-Type: application/json;charset=UTF-8” “/1/accounts/18ce53uo3nm/targeting_criteria?line_item_id=5qk6h” -d ‘[{“operation_type”: “Update”, “params”: {“line_item_id”: “5qk6h”, “targeting_type”: “BROAD_KEYWORD”, “targeting_value”: “\ud83d\udc4d”}}]’ | python -mjson.tool

But I want the non batched call to work. Is this a bug on the Twitter side or in my call. Please let me know.


#2

Hey @npurwar

Thank you for brining this to our attention. We can confirm that we’ve been able to reproduce the issue and are currently investigating the root cause. We will update you once we know more.

Thanks!


#3

Hey,

Please update me on any resolution for this issue and for the expected fix time.
Our clients are majorly facing this issue. When they use “Expand your Reach” suggestions they face this problem.

For example for the key word “cricket”, a similar emoji is “bat and ball” and the corresponding emoji is http://www.fileformat.info/info/unicode/char/1F3CF/index.htm.
One of the suggestions is bat and ball three times, \uD83C\uDFCF\uD83C\uDFCF\uD83C\uDFCF
The call made to Twitter is “\\uD83C\\uDFCF\\uD83C\\uDFCF\\uD83C\\uDFCF” which returns an error with the message : ILLEGAL_CHARACTERS.

Do let me the expected date for the fix.

Thanks


#5

Hey @npurwar,

There have not been any updates on this yet, and we’re still continuing to investigate the issue. We apologize for the inconvenience and we appreciate your patience while we work to get this resolved.

Thanks!


#6

Hey @npurwar

Sorry about the delays, however here’s an example of the correct means to use this endpoint:

twurl_ads -A "Content-Type: application/json;charset=UTF-8" -X POST "/1/accounts/18ce54bgxky/targeting_criteria?line_item_id=6b4v3&targeting_type=PHRASE_KEYWORD&targeting_value=$(ruby -e 'print "\xF0\x9F\x91\x8D"')" | jq .

With the response:

{
  "data_type": "targeting_criterion",
  "data": {
    "line_item_id": "6b4v3",
    "name": "",
    "id": "a2z7la",
    "account_id": "18ce54bgxky",
    "created_at": "2016-09-23T17:55:03Z",
    "targeting_value": "",
    "updated_at": "2016-09-23T17:55:03Z",
    "deleted": false,
    "targeting_type": "PHRASE_KEYWORD"
  },
  "request": {
    "params": {
      "line_item_id": "6b4v3",
      "targeting_type": "PHRASE_KEYWORD",
      "targeting_value": "",
      "account_id": "18ce54bgxky"
    }
  }
}

The issue was the additional encoding that curl does on the params itself. Hope that helps!

Cheers!


#7

@npurwar: Another option is to set the Content-Type to UTF-8:

$ twurl -X POST -A "Content-Type: application/json;charset=UTF-8" -H ads-api.twitter.com "/1/accounts/18ce54d4x5t/targeting_criteria?line_item_id=619jl&targeting_type=BROAD_KEYWORD&targeting_value=😄"
{
  "data": {
    "line_item_id": "619jl",
    "name": "😄",
    "id": "ehshoq",
    "account_id": "18ce54d4x5t",
    "created_at": "2017-07-05T17:34:17Z",
    "targeting_value": "😄",
    "updated_at": "2017-07-05T17:34:17Z",
    "deleted": false,
    "targeting_type": "BROAD_KEYWORD"
  },
  "request": {
    "params": {
      "line_item_id": "619jl",
      "targeting_type": "BROAD_KEYWORD",
      "targeting_value": "😄",
      "account_id": "18ce54d4x5t"
    }
  }
}