You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/getting-started/basic-usage.md
+18-11Lines changed: 18 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -18,16 +18,17 @@ import * as line from '@line/bot-sdk';
18
18
## Configuration
19
19
20
20
For the usage of webhook and client, LINE channel access token and secret are
21
-
needed. About issuing the token and secret, please refer to [Getting started with the Messaging API](https://developers.line.biz/en/docs/messaging-api/getting-started/).
21
+
needed. About issuing the token and secret, please refer
22
+
to [Getting started with the Messaging API](https://developers.line.biz/en/docs/messaging-api/getting-started/).
@@ -52,9 +55,12 @@ if (event.type === 'message') {
52
55
} elseif (event.source.type==='group') {
53
56
client.leaveGroup(event.source.groupId);
54
57
} else {
55
-
client.replyMessage(event.replyToken, {
56
-
type:'text',
57
-
text:'I cannot leave a 1-on-1 chat!',
58
+
client.replyMessage({
59
+
replyToken:event.replyToken,
60
+
messages: [{
61
+
type:'text',
62
+
text:'I cannot leave a 1-on-1 chat!',
63
+
}]
58
64
});
59
65
}
60
66
}
@@ -74,13 +80,17 @@ There are 4 types of errors caused by client usage.
74
80
-`HTTPError`: Server returns a non-2xx response.
75
81
-`JSONParseError`: JSON parsing fails for response body.
76
82
77
-
For methods returning `Promise`, you can handle the errors with [`catch()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/catch)
83
+
For methods returning `Promise`, you can handle the errors
84
+
with [`catch()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/catch)
78
85
method. For others returning `ReadableStream`, you can observe the `'error'`
0 commit comments