Created
July 16, 2016 09:39
-
-
Save Asoul/88aa2c9aa43b833f7f8d19e407ecc295 to your computer and use it in GitHub Desktop.
An simple example to send line with BOT api
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def send_line(message): | |
data = { | |
"to": ["YOUR-LINE-USER-ID"], | |
"toChannel": 1383378250, | |
"eventType": "138311608800106203", | |
"content": { | |
"contentType": 1, | |
"toType": 1, | |
"text": message | |
} | |
} | |
POST_URL = "https://trialbot-api.line.me/v1/events" | |
headers = { | |
"Content-Type": "application/json; charser=UTF-8", | |
"X-Line-ChannelID": "YOUR-CHANNEL-ID", | |
"X-Line-ChannelSecret": "LINE-CHANNEL-SECRET", | |
"X-Line-Trusted-User-With-ACL": "LINE-TRUST-ACL" | |
} | |
return requests.post(POST_URL, headers=headers, json=data) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment