# Post User Registration Hook

**URL:** <https://community.auth0.com/t/post-user-registration-hook/52208>\
**Category:** Get Help\
**Tags:** hook, hooks, post-user-registrati\
**Created:** [October 26, 2020, 6:14pm UTC](https://community.auth0.com/t/post-user-registration-hook/52208 "2020-10-26T18:14:03Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![diceccostefano87](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/diceccostefano87/32/25210_2.png) [@diceccostefano87](https://community.auth0.com/u/diceccostefano87)\
**Post date:** [October 26, 2020, 6:14pm UTC](https://community.auth0.com/t/post-user-registration-hook/52208/1 "2020-10-26T18:14:03Z")

</div>

Hi all,  
I tried to edit a Post User Registration hook to send an email from my SMTP custom provider (SendinBlue).

The code below:  
const SibApiV3Sdk = require(“sib-api-v3-sdk”);

```
const defaultClient = SibApiV3Sdk.ApiClient.instance;
const apiKey = defaultClient.authentications["api-key"];
apiKey.apiKey =
  "blablabla";
const api = new SibApiV3Sdk.TransactionalEmailsApi();

module.exports = function (user, context, cb) {
  let sendSmtpEmail = new SibApiV3Sdk.SendSmtpEmail();

  sendSmtpEmail = {
    to: [
      {
        email: user.email,
        name: user.name,
      },
    ],
    templateId: 1,
    params: {
      name: user.name,
      surname: user.username,
    },
  };

  api.sendTransacEmail(sendSmtpEmail).then(
    function (data) {
      console.log({ message: "API called successfully.", data });
    },
    function (error) {
      console.log({ message: error });
    }
  );

  cb();
};

```

If I run this code with the simulator it works but if I register a new user it doesn’t work.

Anybody can help me?

Thanks!!!

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [October 26, 2020, 8:52pm UTC](https://community.auth0.com/t/post-user-registration-hook/52208/3 "2020-10-26T20:52:30Z")

</div>

Hi @diceccostefano87,

Welcome to the Community!

Please elaborate on “it doesn’t work”. Is it throwing errors? Is it not running? Have you tried the debug console?

Are you using a social user by chance?

---

<div class="post-metadata">

**Author:** ![diceccostefano87](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/diceccostefano87/32/25210_2.png) [@diceccostefano87](https://community.auth0.com/u/diceccostefano87)\
**Post date:** [October 27, 2020, 8:38am UTC](https://community.auth0.com/t/post-user-registration-hook/52208/4 "2020-10-27T08:38:45Z")

</div>

Hi @dan.woda ,  
thank you! It doesn’t work it means the hook is never triggered after registration of a new user, but in the debug console I don’t have any error and it works correctly, the response is “API called successfully” and the status code 200.

Thank you for your time!

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [October 27, 2020, 4:13pm UTC](https://community.auth0.com/t/post-user-registration-hook/52208/5 "2020-10-27T16:13:30Z")

</div>

@diceccostefano87,

Are you using a database user? Social user perhaps?

---

<div class="post-metadata">

**Author:** ![diceccostefano87](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/diceccostefano87/32/25210_2.png) [@diceccostefano87](https://community.auth0.com/u/diceccostefano87)\
**Post date:** [October 27, 2020, 4:52pm UTC](https://community.auth0.com/t/post-user-registration-hook/52208/6 "2020-10-27T16:52:28Z")

</div>

@dan.woda what do you mean with database user? anyway I don’t connect any database with auth0

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [October 27, 2020, 7:22pm UTC](https://community.auth0.com/t/post-user-registration-hook/52208/7 "2020-10-27T19:22:52Z")

</div>

What connection are you using?

---

<div class="post-metadata">

**Author:** ![diceccostefano87](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/diceccostefano87/32/25210_2.png) [@diceccostefano87](https://community.auth0.com/u/diceccostefano87)\
**Post date:** [October 29, 2020, 8:58am UTC](https://community.auth0.com/t/post-user-registration-hook/52208/8 "2020-10-29T08:58:33Z")

</div>

@dan.woda connection? I don’t understand, I’m using auth0 in a React application (SPA)

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [October 29, 2020, 2:34pm UTC](https://community.auth0.com/t/post-user-registration-hook/52208/9 "2020-10-29T14:34:10Z")

</div>

What is the source of your user data?

> **[Identity Providers](https://auth0.com/docs/authenticate/identity-providers)**
>
> Learn about types of identity providers supported by Auth0.

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [November 16, 2020, 11:29pm UTC](https://community.auth0.com/t/post-user-registration-hook/52208/10 "2020-11-16T23:29:17Z")

</div>

Marking this resolved after two weeks of inactivity.

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [November 16, 2020, 11:29pm UTC](https://community.auth0.com/t/post-user-registration-hook/52208/11 "2020-11-16T23:29:21Z")

</div>


