Back

Help Needed: Triggering Cloud Functions on User Verification Events in Appwrite

  • 1
  • Functions
  • Auth
  • Cloud
Abid G
31 May, 2024, 02:26

Hello everyone,

I am currently working on a project with Appwrite where I need to trigger a cloud function based on user verification events. However, I am facing an issue where my Python cloud function only executes successfully on the users.*.update event and not on the following events:

users.*.update.status users.*.verification.* users.*.verification.*.create users.*.verification.*.update

I need the function to run when a user's verification status changes. Below are the relevant context.req.headers from my setup when the users.*.update event runs:

TypeScript
{
  "$id": "XXXX",
  "$createdAt": "2024-05-31T01:46:53.726+00:00",
  "$updatedAt": "2024-05-31T02:06:46.022+00:00",
  "name": "XXXX",
  "password": "XXXX",
  "hash": "XXXX",
  "hashOptions": {
    "type": "argon2",
    "memoryCost": 2048,
    "timeCost": 4,
    "threads": 3
  },
  "registration": "2024-05-31T01:46:53.716+00:00",
  "status": true,
  "labels": [],
  "passwordUpdate": "2024-05-31T01:46:53.716+00:00",
  "email": "XXXX",
  "phone": "XXXX",
  "emailVerification": true,
  "phoneVerification": false,
  "mfa": false,
  "prefs": [],
  "targets": [
    {
      "$id": "XXXX",
      "$createdAt": "2024-05-31T01:46:53.822+00:00",
      "$updatedAt": "2024-05-31T01:46:53.822+00:00",
      "name": "",
      "userId": "XXXX",
      "providerId": null,
      "providerType": "email",
      "identifier": "XXXX"
    },
    {
      "$id": "XXXX",
      "$createdAt": "2024-05-31T01:46:53.869+00:00",
      "$updatedAt": "2024-05-31T01:46:53.869+00:00",
      "name": "",
      "userId": "XXXX",
      "providerId": null,
      "providerType": "sms",
      "identifier": "XXXX"
    }
  ],
  "accessedAt": ""
}

Has anyone encountered a similar issue or does anyone have any suggestions on how to ensure the cloud function triggers for these verification-related events as well?

TL;DR
Developers experiencing issues triggering a cloud function based on user verification events in an Appwrite project. The Python cloud function is currently only executing successfully on the `users.*.update` event, not on `users.*.update.status` and other verification events. The user's data structure is provided for context. A suggestion to resolve this issue is to add a specific listener for the desired verification events such as `users.*.verification.*` ensuring the function is triggered accordingly.
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