I have found thru all the online examples and testing with examples given that wix-crm will only send email to a member that is logged in. This is NOT what I want to do. I want to send email to other admins of the site whose email I already know. According to documented API I need to use wix-users-backend. Reference the code shown in the API example:
import wixUsers from ‘wix-users-backend’;
export function myBackendFunction() {
let userId = // get user ID <<<<<<<<<HOW DO YOU GET THE USERID ???
let value1 = // value for variable1
wixUsers.emailUser(“emailID”, userId, {
“variables”: {
“variable1”: value1,
“variable2”: “value for variable2”
}
} )
.then( () => {
// email has been sent
} )
.catch( (err) => {
// there was an error sending the email
} );
}
the API example for getUser shows the following that would retrieve values, but this is of NO USE TO ME since it assumes I want to get a site member who’s id matches a given id!
import wixUsers from ‘wix-users-backend’;
export function getUser(id) {
return wixUsers.getUser(id);
}
/* Returns a promise that resolves to:
*
- {
- “id”: “dn8sf9c2-4e9f-a02d-a58d-f244d999729a”,
- “memberName”: “John Doe”,
- “firstName”: “John”,
- “lastName”: “Doe”,
- “nickname”: “johnd”,
- “slug”: “johnd123”,
- “language”: “en”,
- “status”: “ACTIVE”,
- “loginEmail”: “john.doe@somedomain.com”,
WHAT STUMPS ME IS HOW DO YOU GET THE USER ID WHEN YOU DO NOT KNOW IT? I want to send email to other site admins whose EMAIL I do know…