Created
May 27, 2022 05:49
-
-
Save jirawatee/a287603272b55d134b5f932978a887e5 to your computer and use it in GitHub Desktop.
Get followers by API
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const axios = require('axios') | |
const LINE_MESSAGING_API = "https://api.line.me/v2/bot" | |
const LINE_HEADER = { | |
"Content-Type": "application/json", | |
Authorization: `Bearer ${config.CHANNEL_ACCESS_TOKEN}` | |
} | |
const getFollowerIds = async(next) => { | |
try { | |
const json = await axios({ | |
method: 'get', | |
url: `${LINE_MESSAGING_API}/followers/ids?limit=1000` + (next ? `&start=${next}` : ``), | |
headers: LINE_HEADER | |
}) | |
return json.data | |
} catch (e) { | |
return null | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment