I have an Ignition client that wants to send messages to LINE, a freeware app for instant communications on electronic devices. LINE offers an API that I should be able to interface with from the Ignition web dev module. This is a screenshot from the developers page.
It seems like I need to setup a bot to deal with incoming messages but I also need to package the data above into the following function:
I found this link here.
but I don't see how to put the request body together in the example.
import system
import urllib2
# Generate URL for API call to read products
url = 'https://api.line.me/v2/bot/message/push'
# Create header with information required by API
urlHeader = {“Content-Type”: “application/json”, “Authorization”: “XXXXX”, “X-Line-Retry-Key”: “XXXXX”}
request = urllib2.Request(url, headers=urlHeader)
contents = urllib2.urlopen(request).read()
data = system.util.jsonDecode(contents)
For testing create a RequestBin that will accept a webhook.
Enable webook URL created at pipedream in LINE developers account.
When a user adds the official LINE account a webhook will be sent to Pipedream where you can identify the userId.
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.