Skip to content
This repository was archived by the owner on Oct 21, 2024. It is now read-only.

Commit e0cf25c

Browse files
authored
Merge pull request #1 from artificialsolutions/develop
v1.0.1 Update
2 parents b2af182 + b5ceb59 commit e0cf25c

File tree

5 files changed

+61
-54
lines changed

5 files changed

+61
-54
lines changed

.env.sample

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
TENEO_ENGINE_URL=<your_engine_url>
2+
CHANNEL_SECRET=<the value obtained in LINE DevConsole -> YourLineProviderName -> BasicSettings -> ChannelSecret >
3+
CHANNEL_ACCESS_TOKEN=<the other value issued in LINE DevConsole -> YourLineProviderName -> MessagingAPI -> ChannelAccessTopic >

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# v.1.0.1
2+
## 29/10/2020
3+
1. [](#improved)
4+
* Updated dependencies and README.md

README.md

Lines changed: 32 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,14 @@ Your bot needs to be published and you need to know the engine URL.
1414

1515

1616
## Setup instructions
17-
### Create and configure a Line Provider
17+
### Create a Line Provider
1818
1. Log in with your LINE account here: [https://developers.line.biz/en/](https://developers.line.biz/en/). Use a QR Code or an email address. You may need to complete your developer profile after you've logged in.
1919
2. Click on Create New Provider, and give it a name.
2020
3. Now, create a Messaging API Channel, and fill in the necessary fields: description, icon, category, etc.
2121
4. Open the newly created channel, find and copy the CHANNEL_SECRET value for later use.
22-
5. Scroll down on the page and issue a CHANNEL_ACCESS_TOKEN (set expiration time to 0 hours for now, so the token doesn't expire), and copy that value too.
23-
6. Go to the 'Use Webhooks' section, and set it to 'Enabled'. You will be setting the 'Webhook_URL' after the next steps.
24-
7. Next, scroll down to the 'Using LINE features' section and disable 'Auto-reply messages' by clicking the 'Set message' link.
25-
2622

2723
### Running the connector locally
24+
#### Setup the connector
2825
1. Download or clone the connector source code:
2926
```
3027
git clone https://github.com/artificialsolutions/tie-api-example-line.git
@@ -33,34 +30,54 @@ Your bot needs to be published and you need to know the engine URL.
3330
```
3431
npm install
3532
```
36-
3. Create a `.env` file in the folder where you stored the source, and add values for TENEO_ENGINE_URL, CHANNEL_SECRET, and CHANNEL_ACCESS_TOKEN:
33+
3. A file .env.sample file is included in the project. Use it as a reference to create a `.env` file in the folder where you stored the source, and add values for CHANNEL_SECRET and TENEO_ENGINE_URL. CHANNEL_ACCESS_TOKEN will be set later on.
3734
```
3835
TENEO_ENGINE_URL=<your_engine_url>
3936
CHANNEL_SECRET=<that value obtained in the previous section>
40-
CHANNEL_ACCESS_TOKEN=<that other value issued in the previous section>
37+
CHANNEL_ACCESS_TOKEN=<value issued in the upcoming section>
4138
```
4239
4. Start the connector in Console:
4340
```
4441
node server.js
4542
```
4643
47-
Next, we need to make the connector available via https. We'll use [ngrok](https://ngrok.com) for this.
44+
#### Make the connector available via HTTPS
45+
1. Next, we need to make the connector available via https. We'll use [ngrok](https://ngrok.com) for this.
4846
49-
1. Start ngrok. The connector runs on port 3000 by default, so we need to start ngrok like this:
47+
2. Start ngrok - The connector runs on port 3000 by default, so we need to start ngrok like this:
5048
```
5149
ngrok http 3000
5250
```
53-
2. Running the command above will display a public https URL. Copy it, you will need it in the next section.
51+
3. Running the command above will display a public https URL. Copy it, you will need it in the next section.
5452
5553
56-
### Update Webhook URL in the line provider
57-
1. Once the connector is available via https, copy the public https URL from the previous step andp paste in into the Webhook URL of your Line Channel provider. Also, add a /callback suffix to the URL field. The final Webhook URL should look roughly like this:
54+
#### Update Webhook URL in the Line Provider
55+
1. Next, in the 'LINE Official Account Features' section > 'Auto-reply messages', click on 'Edit'.
56+
2. Set 'Response mode' to Bot. Disable 'Auto-Response' and 'Greeting Message'.
57+
Set 'Webhooks' to Enabled.
58+
3. Go back to 'Messaging API' > 'Webhook Settings' and set 'Webhook URL' by using the public https URL obtained from ngrok in the previous step, and attaching the suffix '/callback'. The URL will look roughly like this:
59+
```
60+
https://12345abcde.ngrok.io/callback
5861
```
59-
https://7a6e4de6.ngrok.io/callback
62+
63+
4. Click 'Verify' and also Enable 'Use Webhook'.
64+
65+
5. Browse to 'Message API' > Channel Access Token. Click issue, and copy the 'Channel Access Token' value for later use.
66+
It is very important to note that this token must be re-issued everytime the Webhook URL is changed, to prevent authentication errors.
67+
68+
#### Update and restart the Connector
69+
1. Finally, update the CHANNEL_ACCESS_TOKEN variable in .env file of your project source with the 'Channel Access Token' value obtained in the previous step:
70+
71+
TENEO_ENGINE_URL=< your_engine_url >
72+
CHANNEL_SECRET=< The value obtained in previous steps>
73+
CHANNEL_ACCESS_TOKEN=< 'Channel Access Token', from the previous step >
74+
75+
2. Restart the connector in Console:
76+
```
77+
node server.js
6078
```
61-
2. Click the blue 'Update' button to save the url.
6279
6380
### Start chatting with the bot.
64-
Go back to the Channel settings of your Provider, and scroll down to the QR code shown in the bots section. Use it to add your bot as a new contact to your LINE app.
81+
Go back to the Basic Settings section of your Provider, and locate the QR code shown in the bots section. Use it to add your bot as a new contact to your LINE app.
6582
6683
That's it! Your bot should now be available in LINE and responding to messages that are sent to it.

package-lock.json

Lines changed: 20 additions & 37 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "line-teneo-connector",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"description": "A basic example using Teneo and Line",
55
"main": "server.js",
66
"scripts": {
@@ -20,7 +20,7 @@
2020
"url": "https://github.com/artificialsolutions/tie-api-example-line"
2121
},
2222
"dependencies": {
23-
"@artificialsolutions/tie-api-client": "^1.3.1",
23+
"@artificialsolutions/tie-api-client": "^1.3.7",
2424
"@line/bot-sdk": "^6.8.0",
2525
"express": "^4.16.3",
2626
"http": "0.0.0"

0 commit comments

Comments
 (0)