Line Notify API Integration

Hi,

I started learning python last week and created my first custom component. I only completed basic python learning course and still learning. I will delete the post if the post is not appropriate.

My telegram notification component sometimes misses photo attachments from home assistant, probably due to slow internet speed at home, and I decided to try line notify API.

First you will need to download line app for Androidor iOS and create account using mobile phone number and email account.

After creating an account, go to Notify line API to create a service

Once you create a service, You will find client ID and client secret from the service.



Next, include your client id and callback URL from the service to the below address and copy it the address bar of your browser. Callback URL must on one of the addresses included in your service. I used https://google.com as callback URL for convenience.

https://notify-bot.line.me/oauth/authorize?response_type=code&client_id=[YOUR CLIENT ID]&redirect_uri=[CALL BACK URL]&scope=notify&state=NO_STATE

It will direct you to agree and connect to the service you created.

Once you agree, you will be redirected to call back URL address and you will see the code on your address bar.

Next is to install Postman from the link.

Include the code from the address bar, callback id, client id and client_secret and send via http post and you will be given an access token.

image

image

configuration example

notify:
  - name: line_notification
    platform: notify_line
    access_token: 'your access code from postman'

example: Automation

Automation:
  - data:
      data:
        file: /config/tmp/test.jpg
        url: https://www.google.com.au/logos/doodles/2018/world-cup-2018-day-4-6231253740158976-5721036024709120-ssw.png
        stkpkgid: 1      
        stkid: 2      
      message: Front gate snapshot 3
    service: notify.line_notification

if you provide both file and url, file takes precedence and url will be ignored.

My understanding is that Line notify API only supports message, image and sticker at the moment.

Both stkpkgid and stkid should be present from sticker list in order to use the stickers.

Sorry if this is confusing, I will delete the post if the post does not follow the home assistant guidelines.

Thank you.

1 Like

As a Line Message user, I found this custom component interesting. It works like a charm.
Would you like to raise a PR to merge this component into Home Assistant official component?

Hi,

Is this something you can do on my behalf?

I only have very basic knowledge on Python and do not know about the PR process.

This custom component is being used by very few users at this stage. I am not sure if it worth spending time to raise PR…

There are so many people using line in Asia. I believed you help them including me with your results. Thanks a lot.

hello dear.
thanks for doing this for us.
where I can find the authorization code?
I have no error but I did not get the access token is issued any help appreciated.
thanks

I can’t get it working. Any idea?!

image

  1. add version control in this file
    /config/custom_components/notify_line/manifest.json

“version”: “1.0.0”

  1. comment notify context in config file like /config/configuration.yaml
  2. restart Server management
  3. uncomment step2
  4. restart Server management

The project is very good, please update me of your progress.