Trigger emails to not the current user

I would like to send a triggered email when certain actions are completed by one user that affect another user. Example: Ed is logged in and completes a form submission that Karen is waiting for. I would like to trigger an email to Karen when Ed submits the form. Any help would be greatly appreciated. As far as I can tell, the wixCRM API only allows emails to the currently logged in user. I.e. wixCRM.emailContact(“Offer_accepted”, contactId) requires that contactId is the Id of the current user.

2 Likes

Hi, Eric.
You can send an email to any contact/member of your site, it’s not limited to the current user.

Hi Simonas,

It doesn’t work. I have tested the following code in the onReady function of one of my pages. In theory, it should send an email to user 09ba053a-0a68-401b-a1de-e4270ae10c34 every time someone visits the page.

import wixCRM from ‘wix-crm’; //for sending emails to contacts

$w.onReady( function ()
{
let contactId = “09ba053a-0a68-401b-a1de-e4270ae10c34”;
wixCRM.emailContact(“Offer_accepted”, contactId);
});

In reality, if anyone but the user 09ba053a-0a68-401b-a1de-e4270ae10c34 goes to this page, they get the following error in the console: Uncaught (in promise) contactId does not match current session contact (401)

-Eric

I have run into the same problem. Have you discovered a solution, yet?

I also have the same problem. I can only imagine this is a kind of bug in WIX’s own code which makes this otherwise very useful function ( wixCRM.emailContact ) practically unusable

Guys, this issue has come up before. You do know that there is another way of sending emails from Wix Code, don´t you? https://girizano.wixsite.com/codecorner/home/send-email-thru-gmail-and-others-in-wix-code

2 Likes

Thanks a lot, Giri!
EmailJS’s service works in fact perfectly and reliably and it is quite easy to implement. Your interfacing code template was also very useful and absolutely flawless !
Kind regards
Peter

@peter-boehm Glad you like it. If you feel like doing so, could you flag my answer as a Top Comment? It helps.

Hi Giri, I would gladly flag your comment; I’m very new to this forum, please tell me how to do it. On the right hand pulldown menu I don’t see such possibility

You are right, I don´t see the “Mark as Top Comment” either, anywhere. I thought first it had something to do with the fact that I did not ask the question, but I can´t see it anywhere in any question or answer. This thing has changed a lot lately, maybe it´s a bug, maybe a feature, it really beats me. Anyway, thanks for trying.

I would like to stick with Wix CRM for the moment (rather than use a third party like sendGrid).
Has anyone found a solution/workaround so that a logged in site member can send an email to someone else?

Its weird. If I’m not signed in (as a Site member) I can happily send an email to anyone except site members. What’s the rationale for that?

I decided to switch to Sendgrid. It works perfectly and I can send emails to anyone.

@eric-curtiss Thanks. I was hoping that Wix triggered emails would be integrated in ‘Wix Ascend’ so that they showed up in the contact’s Inbox. Probably too high an expectation.

1 Like

This subject has come up many times. Sendgrid is a solution. There is also the solution thru email.js which I covered a while back. Still works perfectly. https://girizano.wixsite.com/codecorner/home/send-email-thru-gmail-and-others-in-wix-code

Thanks Girl. i wonder why Wix wastes our time with their CRM API that doesn’t work?

2 Likes

That should really be HIGHLIGHT in the doc. I wasted another on that due to poor information!

Brilliant Giri… thanks a lot!

PERFECT alternative to SendGrid that hopefully is reliable!
THANK YOU VERY MUCH!

Hold on, why is Wix not fixing this? I don’t want to rely on a 3rd party solution.

David, I gave up on waiting for Wix. At least EmailJS is a reliable solution and 1/2 the cost of Wix Ascend.