0

Find User

by
Published Aug 26, 2024

Find a staff user by email

Script ghostcms Verified

The script

Submitted by hugo697 Bun
Verified 652 days ago
1
import GhostAdminAPI from '@tryghost/admin-api'
2

3
type Ghostcms = {
4
	apiKey: string
5
	apiUrl: string
6
}
7

8
export async function main(resource: Ghostcms, email: string) {
9
	const apiClient = new GhostAdminAPI({
10
		url: resource.apiUrl,
11
		version: 'v5.87',
12
		key: resource.apiKey
13
	})
14

15
	const response = await apiClient.users.browse()
16

17
	const filteredResponse = response.find((user) => user.email === email)
18

19
	return filteredResponse
20
}
21