Commit aba83e3e8a6cf2a1f916db4b4c06e1a7eebf3f64

Authored by Matti Virkkunen
1 parent 6e543a56

Documented sending/receiving sticker messages

Showing 1 changed file with 71 additions and 0 deletions
line-protocol.md
... ... @@ -293,6 +293,77 @@ As an example of a publicly available image message, have a Pikachu:
293 293  
294 294 http://dl-obs.official.line.naver.jp/r/talk/o/u3ae3691f73c7a396fb6e5243a8718915-1379585871
295 295  
  296 +### STICKER (7)
  297 +
  298 +Sticker messages are simply a reference to a separately hosted image file. The information required
  299 +to reference a sticker is contained in the contentMetadata map.
  300 +
  301 +A sticker reference consists of three numbers, the STKVER (sticker version), STKPKGID (sticker
  302 +package ID) and STKID (sticker ID within package). To send a sticker, a message with contentType=7
  303 +and these three values specified are enough. When receiving a sticker some stickers also return a
  304 +meaningful textual name for the sticker in the STKTXT metadata field - this is added automatically
  305 +and does not need to be specified when sending.
  306 +
  307 +Sticker image files are hosted on yet another CDN server at dl.stickershop.line.naver.jp. The CDN
  308 +server does not require authentication and can be viewed with a plain browser for testing. The base
  309 +URL for a sticker package is formed from the STKVER and STKPKGID values. First, the version is split
  310 +into three numbers as follows:
  311 +
  312 + VER = floor(STKVER / 1000000) + "/" + floor(STKVER / 1000) + "/" + (STKVER % 1000)
  313 +
  314 +Using this the package base URL can be determined:
  315 +
  316 +http://dl.stickershop.line.naver.jp/products/{VER}/{STKPKGID}/{PLATFORM}/
  317 +
  318 +PLATFORM is a platform identifier which is presumably used to deliver different image sizes etc to
  319 +different platforms. The "WindowsPhone" platform seems to have most interesting files. Other known
  320 +platforms are "PC". Not all platforms contain all file types.
  321 +
  322 +Sticker package version 100, package 1 ("Moon & James") is used as an example in the following URLs.
  323 +Substitute another package base URL to see other packages.
  324 +
  325 +The sticker package contains a metadata file for a listing its contents:
  326 +
  327 +http://dl.stickershop.line.naver.jp/products/0/0/100/1/WindowsPhone/productInfo.meta
  328 +
  329 +This is a JSON file with metadata about the stickers in this package including names in multiple
  330 +languages, the price in multiple currencies and a list of stickers.
  331 +
  332 +Each package also has an icon:
  333 +
  334 +http://dl.stickershop.line.naver.jp/products/0/0/100/1/WindowsPhone/tab_on.png - active
  335 +
  336 +http://dl.stickershop.line.naver.jp/products/0/0/100/1/WindowsPhone/tab_off.png - dimmed
  337 +
  338 +Each referenced sticker image is available in the subdirectory "stickers" as a PNG image. The
  339 +filename is {STKID}.png for the full image and {STKID}_key.png for a thumbnail.
  340 +
  341 +http://dl.stickershop.line.naver.jp/products/0/0/100/1/WindowsPhone/stickers/13.png - full size
  342 +
  343 +http://dl.stickershop.line.naver.jp/products/0/0/100/1/WindowsPhone/stickers/13_key.png - thumbnail
  344 +
  345 +All sticker images as well as the icons can be downloaded as a single package from:
  346 +
  347 +http://dl.stickershop.line.naver.jp/products/0/0/100/1/WindowsPhone/stickers.zip
  348 +
  349 +The ShopService is used with the path /SHOP4 to get a list of sticker packages the current user has.
  350 +TODO: specify more
  351 +
  352 +Interestingly the official client sends some emoji as a sticker message instead of a plain text
  353 +message if the message content consists only of the single emoji. Emoji as stickers are in package
  354 +number 5: (TODO: figure out how they're mapped)
  355 +
  356 +http://dl.stickershop.line.naver.jp/products/0/0/100/5/WindowsPhone/productInfo.meta
  357 +
  358 +The official clients also contain references to "old" stickers that have no STKVER or STKPKGID and
  359 +use a URL of the format:
  360 +
  361 +http://line.naver.jp/stickers/android/{STKID}.png
  362 +
  363 +http://line.naver.jp/stickers/android/13.png
  364 +
  365 +These seem to just be redirects to new URLs now.
  366 +
296 367 Return channel
297 368 --------------
298 369  
... ...