Welcome to GMAIL + Zapier + LINE’s Notifications documentation!¶
This is a guide to get LINE notifcations sent when you receive certain emails in your Gmail account. It appears that LINE in the past had a service with Zapier which has since been discontinued.
Line + Zapier in the past.¶
It appears that LINE used to provide a service with Zapier, but his ended some time in the past.
Previous guides I have found are here and here for Japanese guide.
Setting up Gmail.¶
Setup a filter and label.¶
Create a filter using the required search conditions and apply a label that you can use with Zapier. This has been documented in many places, so I will not go into details.
For this tutorial I will assume you have a filter that adds the label: ZapierLine
Setting up LINE.¶
Outline.¶
Will will be doing the following steps:
- Log into LINE Notify Bot
- Create a group or user Token (Ensure that you copy this as you will see it only once)
The Steps:¶
Step 4:¶
Provide a name for the token. In this case I have provided ‘ZapierDemo’

Step 5: Choose if you want to send notifications only to yourself using ‘1-on-1 chat with LINE Notify’ or choose an existing chat group you have created within the LINE App on your device. In this case I have chosen ‘1-on-1’

Click on ‘Generate token’
Setting Up Zapier.¶
Outline¶
This will take you through creating a Zap for sending notifications to your selected chat user or group. I will not provide instructions on creating a Zapier account. I believe this is fairly simple and straight forward. Linking your google account to Zapier.
The Steps:¶
Step 2:¶
Give your Zap a name. I have used ‘ZapierDemo’ If you don’t see Gmail in the app list, enter it in the search as I have done. Click on ‘Gmail’

Step 4:¶
Click ‘Continue’
Step 5:¶
Select your connected Gmail account. This will tell Zapier which gmail account to monitor.

Click ‘Continue’
Step 7:¶
Next we need to ‘Test your Trigger’. So click this button.
This will now look for any messages that contain the label we have provided. ‘ZapierLine’

If you are happy with the result. Click ‘Continue’
Step 10:¶
At this point we will start selecting what information we want to extract from the email. This is of course optional. If you wish you could simply have a notification sent to your line account letting you know to check your email. However in this case we will collect some data to add to the notification.
I will extract the following details. from, subject and body. These names are provided by me. I will then select from the drop down the actual items I am looking for.


Next we need to enter our code in the code window.
Sample 1: This code simply takes the plain text body of the email and sends it in the notification.
1 2 3 4 5 6 7 8 9 10 11 | import requests
API_URI = "https://notify-api.line.me/api/notify"
text_message = input.get('body')
TOKEN = "YOUR_GENERATED_TOKEN_GOES_HERE"
HEADER = {"Authorization": "Bearer " + TOKEN}
PARAMS = {"message": text_message}
response = requests.post(API_URI, headers=HEADER, params=PARAMS)
response.raise_for_status()
return {'rawHtml': response.text}
|
Sample 2: This code sends a different text message depending on the from address of the sender.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | import requests
API_URI = "https://notify-api.line.me/api/notify"
if input.get('from') == 'AddressA':
text_message = "This is the message from sender A"
if input.get('from') == 'AddressB':
text_message = "This is the message from sender B with email body included:\n\n{}".format(input.get('body'))
TOKEN = "YOUR_TOKEN_GOES_HERE"
HEADER = {"Authorization": "Bearer " + TOKEN}
PARAMS = {"message": text_message}
response = requests.post(API_URI, headers=HEADER, params=PARAMS)
response.raise_for_status()
return {'rawHtml': response.text}
|


NOTE: If you get an error message that execution took more than 1 second. This can be ignored. Simply Click the ‘Skip Test’ in the upper right corner.
Known Issues¶
Zapier Basic¶
If you are using the free basic version of Zapier. There is a one second run-time limit. If the code exceeds this limit you will receive a warning notice. In my experience this has not caused any issues with the actual execution of the code.
It appears that Zapier has also extended the time between runs. It used to be 5 minutes. It is now 15 minutes for the free account.