Home>

Hello. I currently want to use the Line API to send images to my Line.

You can send only a message, but the image does not come.
It seems to be sent as json type to the document of line, but I can not.
Below is the code in use.
Professor, please.

#imageUrl is for example
It looks like #.
def lineNotify_Img(imageUrl):
    line_notify_token = os.environ.get('LINE_NOTIFY_TOKEN')
    line_notify_api ='https://notify-api.line.me/api/notify'
    payload = {'type':'image',
                'originalContentUrl': imageUrl,
                'previewImageUrl': imageUrl,
                'message':'test'
                }
    headers = {'Authorization':'Bearer' + line_notify_token}
    requests.post(line_notify_api, data=payload, headers=headers,)


When used
test
Only. .. ..

  • Answer # 1

    The presentation code isLine APIIt seems to be for me.LINE Notify APIThen the key name is different.
    In addition, there are restrictions on the image format and size. See LINE Notify API Document for details.

    payload = {'imageFullsize':'https://symfo.web.fc2.com/sample_src/lena.jpg',
                'message':'test'
               }