Skip to content

Commit af48a83

Browse files
committed
fix: improve descriptions and refactor follower ID retrieval logic
1 parent e84e762 commit af48a83

File tree

1 file changed

+11
-20
lines changed

1 file changed

+11
-20
lines changed

src/index.ts

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ const flexMessageSchema = z.object({
9696
.passthrough()
9797
.describe(
9898
"Flexible container structure following LINE Flex Message format. For 'bubble' type, can include header, " +
99-
"hero, body, footer, and styles sections. For 'carousel' type, includes an array of bubble containers in " +
100-
"the 'contents' property.",
99+
"hero, body, footer, and styles sections. For 'carousel' type, includes an array of bubble containers in " +
100+
"the 'contents' property.",
101101
),
102102
});
103103

@@ -128,7 +128,7 @@ server.tool(
128128
server.tool(
129129
"push_flex_message",
130130
"Push a highly customizable flex message to a user via LINE. Supports both bubble (single container) and carousel " +
131-
"(multiple swipeable bubbles) layouts.",
131+
"(multiple swipeable bubbles) layouts.",
132132
{
133133
userId: userIdSchema,
134134
message: flexMessageSchema,
@@ -155,7 +155,7 @@ server.tool(
155155
server.tool(
156156
"broadcast_text_message",
157157
"Broadcast a simple text message via LINE to all users who have followed your LINE Official Account. Use this for sending " +
158-
"plain text messages without formatting. Please be aware that this message will be sent to all users.",
158+
"plain text messages without formatting. Please be aware that this message will be sent to all users.",
159159
{
160160
message: textMessageSchema,
161161
},
@@ -176,8 +176,8 @@ server.tool(
176176
server.tool(
177177
"broadcast_flex_message",
178178
"Broadcast a highly customizable flex message via LINE to all users who have added your LINE Official Account. " +
179-
"Supports both bubble (single container) and carousel (multiple swipeable bubbles) layouts. Please be aware that " +
180-
"this message will be sent to all users.",
179+
"Supports both bubble (single container) and carousel (multiple swipeable bubbles) layouts. Please be aware that " +
180+
"this message will be sent to all users.",
181181
{
182182
message: flexMessageSchema,
183183
},
@@ -239,30 +239,21 @@ server.tool(
239239
.string()
240240
.optional()
241241
.describe(
242-
"Continuation token for pagination. If omitted, fetches from the beginning.",
242+
"Value of the continuation token found in the next property of the JSON object returned in the response. Include this parameter to get the next array of user IDs. If omitted, fetches from the beginning.",
243243
),
244244
limit: z
245-
.number()
246245
.int()
247246
.min(1)
248247
.max(1000)
249-
.optional()
248+
.default(300)
250249
.describe(
251-
"Maximum number of user IDs to retrieve (1-1000). Default is 1000.",
250+
"Maximum number of user IDs to retrieve (1-1000). Default is 300.",
252251
),
253252
},
254253
async ({ start, limit }: { start?: string; limit?: number }) => {
255254
try {
256-
const params = new URLSearchParams();
257-
if (limit) params.append("limit", limit.toString());
258-
if (start) params.append("start", start);
259-
const res = await axios.get("https://api.line.me/v2/bot/followers/ids", {
260-
params,
261-
headers: {
262-
Authorization: `Bearer ${channelAccessToken}`,
263-
},
264-
});
265-
return createSuccessResponse(res.data);
255+
const response = messagingApiClient.getFollowers(start, limit);
256+
return createSuccessResponse(response);
266257
} catch (error) {
267258
return createErrorResponse(
268259
`Failed to get follower ids: ${error.message}`,

0 commit comments

Comments
 (0)