web-tech-tw / arona

A simple bridge for every messenger. (formerly matrix-line-bridge)
https://web-tech-tw.github.io/arona/
MIT License
24 stars 5 forks source link

Instructions for setup and Line API #2

Closed daktak closed 4 months ago

daktak commented 3 years ago

Are you able to post a README on how to set up a personal LINE API key and this bridge?

daktak commented 3 years ago

virtualenv . -p /usr/bin/python3 source ./bin/activate pip -r requirements.txt python main.py

After setting up a provider and a channel, I used below to create a short-lived access token (can you do a long lived one?) https://developers.line.biz/en/reference/messaging-api/#issue-shortlived-channel-access-token

But i'm unsure what value ROOM = should be, and I get the below error

linebot.exceptions.LineBotApiError: LineBotApiError: status_code=403, request_id=7e6fef71-bc31-4ba7-8fbc-a5a59dbec1d7, error_response={"details": [], "message": "Forbidden"}, headers={'Server': 'openresty', 'Content-Type': 'application/json', 'x-line-request-id': '7e6fef71-bc31-4ba7-8fbc-a5a59dbec1d7', 'x-content-type-options': 'nosniff', 'x-xss-protection': '1; mode=block', 'x-frame-options': 'DENY', 'Expires': 'Sun, 11 Apr 2021 03:32:06 GMT', 'Cache-Control': 'max-age=0, no-cache, no-store', 'Pragma': 'no-cache', 'Date': 'Sun, 11 Apr 2021 03:32:06 GMT', 'Connection': 'close'}

daktak commented 3 years ago

Ok, creating a messaging api I get the following errror

linebot.exceptions.LineBotApiError: LineBotApiError: status_code=400, request_id=a6a4517b-8f6d-47b4-ae62-4553e472b39c, error_response={"details": [], "message": "The property, 'to', in the request body is invalid (line: -, column: -)"}, headers={'Server': 'openresty', 'Content-Type': 'application/json', 'x-line-request-id': 'a6a4517b-8f6d-47b4-ae62-4553e472b39c', 'x-content-type-options': 'nosniff', 'x-xss-protection': '1; mode=block', 'x-frame-options': 'DENY', 'Content-Length': '85', 'Expires': 'Sun, 11 Apr 2021 03:59:26 GMT', 'Cache-Control': 'max-age=0, no-cache, no-store', 'Pragma': 'no-cache', 'Date': 'Sun, 11 Apr 2021 03:59:26 GMT', 'Connection': 'close'}

supersonictw commented 3 years ago

OK, I will put the documents as soon as possible.

daktak commented 3 years ago

Ok, ROOM value should be populated with the reply string when adding the bot to group that has not been entered in the config.ini yet.

daktak commented 3 years ago

Ok, now if I send a message from Matrix, it spams with a history of all messages from Matrix

daktak commented 3 years ago

Also i think matrix room must not be encrypted? is below needed in matrix/poll.py under message_callback if room.room_id != config_instance["Matrix"]["ROOM"]: return

daktak commented 3 years ago

Fyi bridge server and port must be exposed to the web for webhook. Also url appears to need /callback appended in line API settings

supersonictw commented 3 years ago

OK, I will put the documents as soon as possible.

README has been updated.

supersonictw commented 3 years ago

Ok, now if I send a message from Matrix, it spams with a history of all messages from Matrix

This is the bug I was finding, but I need someone who knows Matrix API to resolve the problem.

daktak commented 3 years ago

Under the wiki, please mention the user/pass for Matrix should not be the user you will use to chat. +The ID for you to login the network of Matrix. Set up a new user to act as your bridge puppet, as the bridge will not relay messages sent by this user. Add this user to the groups that are bridged to a line room.

daktak commented 3 years ago

Also worth mentioning the Line chat bot must be added to the line room. Matrix group should be unencrypted

supersonictw commented 3 years ago

OK, I will update them asap.

daktak commented 2 years ago

Are you able to update install/running instructions for javascript ? how to convert config.ini to js config .env? How to generate the matrix token?

just found .env.sample

supersonictw commented 2 years ago

How to generate the matrix token?

The method exists in dev branch only currently. (Merged) But https://t2bot.io/docs/access_tokens/ can help you to generate one from Element.

daktak commented 2 years ago
curl  -XPOST   -d '{"type":"m.login.password", "user":"yourmatrixuser", "password":"yourpass!"}'   "https://yourmatrixhost/_matrix/client/r0/login"

Above is a nice simple way to get the token, perhaps add to the documentation?

supersonictw commented 2 years ago

Above is a nice simple way to get the token, perhaps add to the documentation?

That's cool! But there is a new feature can help you get the AccessToken more friendly since 8fff486c8cf03e21ad410ce81b9b45c624bf75ca.

npm run get-matrix-access

daktak commented 2 years ago

starting to update the wiki https://github.com/daktak/matrix-line-bridge/wiki/1_Create_Line_Bot

supersonictw commented 4 months ago

The documentation is working in processing. https://github.com/web-tech-tw/arona/pull/20

supersonictw commented 4 months ago

Completed. https://github.com/web-tech-tw/arona/pull/20