Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Introduction to LINE Messaging API

anop72
October 20, 2018

Introduction to LINE Messaging API

anop72

October 20, 2018
Tweet

More Decks by anop72

Other Decks in Programming

Transcript

  1. Webhook event objects { "events": [ { "type": "message", "replyToken":

    "cad4343bc1af4f4a8a9f6647a29ebcd4", "source": { "userId": "U874a7249827501733bbeb8e5a6bd0b72", "type": "user" }, "timestamp": 1539767444763, "message": { "type": "text", "id": "8729978318099", "text": "สวัสดี Barcamp Songkhla" } } ] }
  2. Webhook event objects { "events": [ { "type": "message", "replyToken":

    "cad4343bc1af4f4a8a9f6647a29ebcd4", "source": { "userId": "U874a7249827501733bbeb8e5a6bd0b72", "type": "user" }, "timestamp": 1539767444763, "message": { "type": "text", "id": "8729978318099", "text": "สวัสดี Barcamp Songkhla" } } ] }
  3. Webhook event objects { "events": [ { "type": "message", "replyToken":

    "cad4343bc1af4f4a8a9f6647a29ebcd4", "source": { "userId": "U874a7249827501733bbeb8e5a6bd0b72", "type": "user" }, "timestamp": 1539767444763, "message": { "type": "text", "id": "8729978318099", "text": "สวัสดี Barcamp Songkhla" } } ] }
  4. Webhook event objects { "events": [ { "type": "message", "replyToken":

    "cad4343bc1af4f4a8a9f6647a29ebcd4", "source": { "userId": "U874a7249827501733bbeb8e5a6bd0b72", "type": "user" }, "timestamp": 1539767444763, "message": { "type": "text", "id": "8729978318099", "text": "สวัสดี Barcamp Songkhla" } } ] }
  5. Webhook event objects { "events": [ { "type": "message", "replyToken":

    "cad4343bc1af4f4a8a9f6647a29ebcd4", "source": { "userId": "U874a7249827501733bbeb8e5a6bd0b72", "type": "user" }, "timestamp": 1539767444763, "message": { "type": "text", "id": "8729978318099", "text": "สวัสดี Barcamp Songkhla" } } ] }
  6. Message event - Buttons Template { "type": "template", "altText": "this

    is a buttons template", "template": { "type": "buttons", "actions": [ { "type": "message", "label": "Hello", "text": "hello" }, { "type": "message", "label": "World", "text": "World" } ], "thumbnailImageUrl": "HTTPS", "title": "Barcamp Songkhla", "text": "#barcampsk" } }
  7. Message event - Buttons Template { "type": "template", "altText": "this

    is a buttons template", "template": { "type": "buttons", "actions": [ { "type": "message", "label": "Hello", "text": "hello" }, { "type": "message", "label": "World", "text": "World" } ], "thumbnailImageUrl": "HTTPS", "title": "Barcamp Songkhla", "text": "#barcampsk" } }
  8. Message event - Buttons Template { "type": "template", "altText": "this

    is a buttons template", "template": { "type": "buttons", "actions": [ { "type": "message", "label": "Hello", "text": "hello" }, { "type": "message", "label": "World", "text": "World" } ], "thumbnailImageUrl": "HTTPS", "title": "Barcamp Songkhla", "text": "#barcampsk" } }
  9. Message event - Buttons Template { "type": "template", "altText": "this

    is a buttons template", "template": { "type": "buttons", "actions": [ { "type": "postback", "label": "Hello", "text": "Hello", "data": “hello-data" }, { "type": "message", "label": "World", "text": "World" } ], "thumbnailImageUrl": "HTTPS", "title": "Barcamp Songkhla", "text": "#barcampsk" } }
  10. ngrok by @inconshreveable Session Status online Account anop72 (Plan: Free)

    Version 2.2.8 Region United States (us) Web Interface http://127.0.0.1:4040 Forwarding http://cbb3ff8b.ngrok.io -> localhost:3000 Forwarding https://cbb3ff8b.ngrok.io -> localhost:3000 ngrok http 3000
  11. ngrok by @inconshreveable Session Status online Account anop72 (Plan: Free)

    Version 2.2.8 Region United States (us) Web Interface http://127.0.0.1:4040 Forwarding http://cbb3ff8b.ngrok.io -> localhost:3000 Forwarding https://cbb3ff8b.ngrok.io -> localhost:3000 ngrok http 3000
  12. curl -X POST \ https://api.line.me/v2/bot/message/push \ -H 'Content-type: application/json' \

    -H 'Authorization: Bearer ACCESS_TOKEN' \ -d '{ "to" : "U874a7249827501733bbeb8e5a6bd0b72", "messages": [ { "type": "text", "text": "Hello from curl" } ] }'
  13. curl -X POST \ https://api.line.me/v2/bot/message/push \ -H 'Content-type: application/json' \

    -H 'Authorization: Bearer ACCESS_TOKEN' \ -d '{ "to" : "U874a7249827501733bbeb8e5a6bd0b72", "messages": [ { "type": "text", "text": "Hello from curl" } ] }'