Is there a way to trigger the following flow via the API
- create a new member for a newsletter via API
- send out the verification email via API
From what I can see there is only a way to create a new member via API and it seems to bypass any email verification step that normally occurs when users sign up via the embed. Any information would be great, thanks!
the endpoint you want is send-magic-link :)
1 Like
Indeed, /members/api/send-magic-link/ looks like the only option to send a membership invitation, but you need to be aware of rate-limits on that endpoint. If you always call it form a single IP (your server), then you’ll likely hit the default rate limits. You may need to change them.
1 Like
I’m doing something like
const res = await fetch(${ghostUrl}/ghost/members/api/send-magic-link/,{
method: ‘POST’,
headers: {
‘Content-Type’: ‘application/json’,
‘Origin’: ghostUrl,
},
body: JSON.stringify({ email, emailType: ‘signup’ }),
});
getting back a 200 but no sign up email is being received
Best trick here is to do the sign up action in the browser with the dev tools network tab open. When you do that, you’ll see that there’s an integrity token required.
thank you, was able to get it working
1 Like