Back

[SOLVED] Webhook API URL is not triggered by Appwrite

  • 0
  • Webhooks
  • Web
Vishal Lohar
2 Aug, 2023, 03:30

I have created a webhook which should get triggered when a new user is created. But the webhook api url is not getting triggered when a new user gets created. I am using Next.js and Docker Desktop to test this.

So the API URL is http://localhost:3000/api/new-profile

TL;DR
The issue was resolved when the user realized they were using oAuth, which caused the webhook to not work. The webhook was only triggered for the `account.create` method and any Users create functions, not for creating users with OAuth2. Additionally, the user discovered that if they set the event as users*, it worked, but if they set it as users.*.create, it didn't work. They also learned that using `localhost` as the target for the webhook can be problematic and that they should pass the computer's local IP instead.
Binyamin
2 Aug, 2023, 03:34

The use of localhost as target for the webhook can be problematic as the localhost would be some internal ip within the worker container.

What I mean is that the webhook is being trigger but it cal is own localhost and the one you have outside.

If you want to set the webhook in local environment you can pass the computer local IP

Binyamin
2 Aug, 2023, 03:35

You can find the machine internal IP bu running ifconfig in unix systems or ipconfig in windows

Vishal Lohar
2 Aug, 2023, 09:17

Got it. Now its working

Vishal Lohar
2 Aug, 2023, 09:17

The problem is its working if the event is users* . And if I set it to users.*.create then it doesn't work

Vishal Lohar
2 Aug, 2023, 09:18

Am i doing something wrong? I want to trigger the api only when a new user is created

Binho.dev πŸ’™
2 Aug, 2023, 13:04

Hay πŸ‘‹ I use users.*.create to receive webhook notifications and send messages via WhatsApp, it works normally.

Binho.dev πŸ’™
2 Aug, 2023, 13:06

Is needed check you webhook endpoint.

Binyamin
2 Aug, 2023, 13:41

Like so?

Binyamin
2 Aug, 2023, 13:42

This event is only for the account.create method https://appwrite.io/docs/client/account?sdk=web-default#accountCreate Or any of the Users create functions https://appwrite.io/docs/server/users?sdk=nodejs-default#usersCreate

It's not for when you're creating uses with OAuth2 for example

Vishal Lohar
3 Aug, 2023, 02:29

Got it. I was using oAuth and that's why it didn't work

Drake
6 Aug, 2023, 16:41

Can we mark this as solved now?

Vishal Lohar
6 Aug, 2023, 16:48

Yes

Drake
6 Aug, 2023, 16:56

[SOLVED] Webhook API URL is not triggered by Appwrite

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more