Skip to content

Instantly share code, notes, and snippets.

@Asoul
Created July 16, 2016 09:39
Show Gist options
  • Save Asoul/88aa2c9aa43b833f7f8d19e407ecc295 to your computer and use it in GitHub Desktop.
Save Asoul/88aa2c9aa43b833f7f8d19e407ecc295 to your computer and use it in GitHub Desktop.
An simple example to send line with BOT api
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