How appwrite functions actually work how to trigger those functions from client side
- 0
- React Native
- Web
- Functions
- Cloud
**here is the client side code ** const handleSubmit = async () => { console.log("Form submitted:", { landlordId, tenantDetails, selectedProperty, selectedUnit, }); debugger; try { const inviteCode = Math.floor(100000 + Math.random() * 900000).toString();
await database.createDocument(
config.databaseId,
config.inviteCollectionId,
ID.unique(),
{
code: inviteCode,
landlord_id: landlordId,
tenant_phone: tenantDetails.phone,
property_id: selectedProperty.property_id,
status: "pending",
created_at: new Date().toISOString(),
expires_at: new Date(Date.now() + 24 * 60 * 60 * 1000).toISOString(), // Expires in 24 hours
}
);
console.log("invite added into database");
// Execute Appwrite Function to send SMS
await functions.createExecution( "6727a2e1001f2c7ade1c", // Replace with your function ID JSON.stringify({ phone: tenantDetails.phone, code: inviteCode, }), false, "sms", ExecutionMethod.POST ); // console.log("Function executed successfully", res); alert("Invitation sent successfully!"); router.push("/"); } catch (error) { console.error("Error sending invite:", error); alert("Failed to send invitation. Please try again."); } };
i have already created a function in console and pass that function id into the createExecution method
but i want to know how this excution is trigger and how can i test it
Recommended threads
- Android SDK: Kotlin null Value Not Updat...
Hi team, I think you should check the Android SDK implementation once, as it seems to have an issue handling Kotlin **null** values. For example: When I send:...
- Can't connect GitHub — 500 error at the ...
Appwrite Cloud, Pro plan, SFO region. All my Git connections vanished today — Sites and all 15 Functions now show no repository connected. When I try to add a ...
- GB Hours IS NOT resetting
Hi, I was checking my usage and noticed that all of my usage quotas were reset on August 20, 2026, when my billing cycle renewed. Everything else appears to ha...