Skip to content

Instantly share code, notes, and snippets.

@jirawatee
Created May 27, 2022 05:49
Show Gist options
  • Save jirawatee/a287603272b55d134b5f932978a887e5 to your computer and use it in GitHub Desktop.
Save jirawatee/a287603272b55d134b5f932978a887e5 to your computer and use it in GitHub Desktop.
Get followers by API
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