How to use the web dev module to send a POST to LINE API?

You are right. I didn't need web dev module to accomplish this... just a lot of reading.

Final working code:

headers = {'Authorization': 'Bearer Iyo5Kd_this_is_some_long_string_1cDny'}
data = {"to": "U48_user_id_found_in_webhook_4a4", "messages":[{"type":"text","text":"Hello, world1"}]}
uri = 'https://api.line.me/v2/bot/message/push'
response = system.net.httpClient().post(url = uri, headers=headers, data=data)
print response

Steps to get here:

  1. Create LINE Developers account.

  2. Create an official channel.

  1. For testing create a RequestBin that will accept a webhook.
  1. Enable webook URL created at pipedream in LINE developers account.

image

  1. When a user adds the official LINE account a webhook will be sent to Pipedream where you can identify the userId.

  2. Put the UserId from pipedream into the working code above in an Ignition script console and that user will receive the message.

Now my next problem is how do I collect various UserId as people on the floor add the official LINE account but I may just throw that problem back to the official IT department.

3 Likes