Merge branch 'main' into replace-prefix
@@ -28,7 +28,7 @@
|
||||
"@appwrite.io/console": "^0.4.2",
|
||||
"@appwrite.io/pink": "0.1.0-next.9",
|
||||
"@appwrite.io/pink-icons": "0.1.0-next.9",
|
||||
"@appwrite.io/repo": "github:appwrite/appwrite#feat-rc-sdks",
|
||||
"@appwrite.io/repo": "github:appwrite/appwrite#main",
|
||||
"@melt-ui/pp": "^0.3.0",
|
||||
"@melt-ui/svelte": "^0.74.3",
|
||||
"@playwright/test": "^1.42.0",
|
||||
|
||||
8
pnpm-lock.yaml
generated
@@ -23,8 +23,8 @@ devDependencies:
|
||||
specifier: 0.1.0-next.9
|
||||
version: 0.1.0-next.9
|
||||
'@appwrite.io/repo':
|
||||
specifier: github:appwrite/appwrite#feat-rc-sdks
|
||||
version: github.com/appwrite/appwrite/0e28a3016c8f503df2b962e35f4a125335640386
|
||||
specifier: github:appwrite/appwrite#main
|
||||
version: github.com/appwrite/appwrite/e868ae60c6db9d0dcbc5ce27a0ca609a7ceada7f
|
||||
'@melt-ui/pp':
|
||||
specifier: ^0.3.0
|
||||
version: 0.3.0(@melt-ui/svelte@0.74.3)(svelte@4.2.12)
|
||||
@@ -6707,8 +6707,8 @@ packages:
|
||||
engines: {node: '>=12.20'}
|
||||
dev: true
|
||||
|
||||
github.com/appwrite/appwrite/0e28a3016c8f503df2b962e35f4a125335640386:
|
||||
resolution: {tarball: https://codeload.github.com/appwrite/appwrite/tar.gz/0e28a3016c8f503df2b962e35f4a125335640386}
|
||||
github.com/appwrite/appwrite/e868ae60c6db9d0dcbc5ce27a0ca609a7ceada7f:
|
||||
resolution: {tarball: https://codeload.github.com/appwrite/appwrite/tar.gz/e868ae60c6db9d0dcbc5ce27a0ca609a7ceada7f}
|
||||
name: '@appwrite.io/repo'
|
||||
version: 0.0.0
|
||||
dev: true
|
||||
|
||||
@@ -30,9 +30,7 @@
|
||||
{#if back}
|
||||
<a
|
||||
href={back}
|
||||
class="
|
||||
web-button is-text web-is-only-mobile
|
||||
web-u-padding-block-0 web-u-padding-inline-start-0 web-u-padding-inline-end-12"
|
||||
class="web-icon-button web-is-only-mobile"
|
||||
aria-label="previous page"
|
||||
>
|
||||
<span class="icon-cheveron-left" aria-hidden="true" />
|
||||
|
||||
@@ -21,9 +21,7 @@
|
||||
<header class="web-article-header">
|
||||
<div class="web-article-header-start u-flex-vertical web-u-cross-start">
|
||||
<button
|
||||
class="
|
||||
web-button is-text web-is-only-mobile
|
||||
web-u-padding-block-0 web-u-padding-inline-start-0 web-u-padding-inline-end-12"
|
||||
class="web-icon-button web-is-only-mobile"
|
||||
aria-label="previous page"
|
||||
>
|
||||
<span class="icon-cheveron-left" aria-hidden="true" />
|
||||
|
||||
@@ -4,7 +4,7 @@ import { Platform, type Service } from './references';
|
||||
export type SDKMethod = {
|
||||
'rate-limit': number;
|
||||
'rate-time': number;
|
||||
'rate-key': string;
|
||||
'rate-key': string | string[];
|
||||
id: string;
|
||||
title: string;
|
||||
description: string;
|
||||
|
||||
@@ -152,7 +152,7 @@ For day 3 of Init, we had [Danny Thompson](https://twitter.com/DThompsonDev) joi
|
||||
|
||||
## The end and the beginning
|
||||
|
||||
The last day of Init was a proper celebration. We started off with our last announcement: [New and updated runtimes.](https://appwrite.io/blog/post/announcing-more-and-updated-runtimes) But the highlight of the day was the closing party we held on Discord with our friend from open-sauced, [Nick Taylor](https://twitter.com/nickytonline).
|
||||
The last day of Init was a proper celebration. We started off with our last announcement: [New and updated runtimes.](/blog/post/announcing-more-and-updated-runtimes) But the highlight of the day was the closing party we held on Discord with our friend from open-sauced, [Nick Taylor](https://twitter.com/nickytonline).
|
||||
|
||||

|
||||
|
||||
|
||||
387
src/routes/blog/post/building-init-giveaway-app/+page.markdoc
Normal file
@@ -0,0 +1,387 @@
|
||||
---
|
||||
layout: post
|
||||
title: Building the giveaway app for Init Discord sessions
|
||||
description: How we used Appwrite and SvelteKit to develop a custom roulette-style giveaway web application.
|
||||
date: 2024-03-06
|
||||
cover: /images/blog/building-init-giveaway-app/cover.png
|
||||
timeToRead: 7
|
||||
author: aditya-oberai
|
||||
category: open-source
|
||||
---
|
||||
|
||||
Last week, we saw the culmination of a whole new initiative, the celebration of everything new with Appwrite and the community, called [Init](https://appwrite.io/init). From February 26th to March 1st, we celebrated a new product and/or feature every day and shared educational content around the same. Alongside, we hosted online events each day in the Appwrite Discord server with creators and friends of Appwrite to learn about the new releases, ask questions, and, most of all, geek out together.
|
||||
|
||||
One popular aspect of these events was a random giveaway that we ran every single day, giving out Init swag to a number of our community members. When planning out these giveaways, however, we wanted to create a high-quality experience for our community members, to make it as special and exciting as every other aspect of Init.
|
||||
|
||||
Therefore, using Discord OAuth and Databases in Appwrite, we built our very own “Spin The Wheel” giveaway roulette application!
|
||||
|
||||
## What the app does
|
||||
|
||||
The giveaway app has two major features:
|
||||
|
||||
- **Giveaway registration**
|
||||
|
||||
The giveaway registration requires users to log in to the app with their Discord account. As soon as a user logs in with Discord, the app adds their Discord username and email address to an Appwrite collection.
|
||||
|
||||

|
||||
|
||||
- **Winner selection**
|
||||
|
||||
The data added to the Appwrite collection is loaded in a wheel that is also updated in real time in case new registrations are added. The wheel can then be spun like a roulette wheel to find a randomly selected winner.
|
||||
|
||||

|
||||
|
||||
# How we built it
|
||||
|
||||
To discuss how the app was built, we’ll discuss the part of setting up Appwrite and implementing the code as two separate parts.
|
||||
|
||||
## Setting up Appwrite
|
||||
|
||||
To build this application, we used the Discord OAuth adapter in Appwrite Auth and Appwrite Databases. The only prerequisite here was creating an [Appwrite Cloud account](https://cloud.appwrite.io), followed by creating a new project and adding your hostname as a web app to the project.
|
||||
|
||||
### Discord OAuth
|
||||
|
||||
Implementing Discord OAuth required us to first set up an application on the [Discord Developer Portal](https://discord.com/developers/applications). After creating an application, we visited the OAuth2 tab within the application to get the **client ID** and **secret** to set up the Discord **OAuth adapter** in our Appwrite project. We also copied to **redirect URI** to add it to our Discord Developer App.
|
||||
|
||||

|
||||
|
||||
### Appwrite Database
|
||||
|
||||
We created a **database** and a **collection** for each day of the giveaway in our Appwrite project. Each collection had the same steps to set up.
|
||||
|
||||
Each collection contained two **attributes**:
|
||||
|
||||
| Key | Type | Size | Required |
|
||||
| --- | --- | --- | --- |
|
||||
| discordName | String | 255 | Yes |
|
||||
| email | Email | - | Yes |
|
||||
|
||||
To ensure that one user could only be added once for a day’s giveaway, we created an **index** of the `unique` type.
|
||||
|
||||
| Key | Type | Attribute | Order |
|
||||
| --- | --- | --- | --- |
|
||||
| names | unique | discordName | ASC |
|
||||
|
||||
Lastly, we added **collection-level permissions** to allow anyone to read data (since the giveaway page was meant to be publicly accessible) and only authenticated users to add data (their Discord username and email address) to the collection.
|
||||
|
||||
| Role | Create | Read | Update | Delete |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| Any | | Yes | | |
|
||||
| Users | Yes | | | |
|
||||
|
||||
## Setting up the app
|
||||
|
||||
Looking at the two primary features, there were three primary challenges we needed to solve to develop this app. To build this app, we used SvelteKit, a framework to build web applications using JavaScript. There are some prerequisites, however, that must be completed before building out the features themselves.
|
||||
|
||||
> Note: The code snippets will focus only on the application logic. All CSS and styling-related information will be accessible in the final project repository at the end of the blog.
|
||||
>
|
||||
|
||||
### Prerequisites
|
||||
|
||||
We first set up a skeleton SvelteKit project.
|
||||
|
||||
```bash
|
||||
npm create svelte@latest init-giveaway-roulette
|
||||
```
|
||||
|
||||
We then entered the application directory, installed the Appwrite Web SDK and Pink Design using `npm install appwrite "@appwrite.io/pink"`, and set up our constants.
|
||||
|
||||
```js
|
||||
// ./src/lib/constants.js
|
||||
|
||||
export const APPWRITE_ENDPOINT = 'https://cloud.appwrite.io/v1';
|
||||
|
||||
export const APPWRITE_PROJECT = '<PROJECT_ID>';
|
||||
|
||||
export const DATABASE_NAME = '<DATABASE_ID>';
|
||||
|
||||
export const COLLECTION_NAME = '<COLLECTION_ID>';
|
||||
```
|
||||
|
||||
After the constants were added, we could now set up the Appwrite SDK.
|
||||
|
||||
```js
|
||||
// ./src/lib/appwrite.js
|
||||
|
||||
import { Account, Client, Databases } from 'appwrite';
|
||||
import { APPWRITE_ENDPOINT, APPWRITE_PROJECT } from './constants';
|
||||
|
||||
export const client = new Client();
|
||||
|
||||
client.setEndpoint(APPWRITE_ENDPOINT).setProject(APPWRITE_PROJECT);
|
||||
|
||||
export const account = new Account(client);
|
||||
|
||||
export const database = new Databases(client);
|
||||
```
|
||||
|
||||
Once this is done, we could move forward to create the main application.
|
||||
|
||||
### Login using Discord
|
||||
|
||||
First, we used the Appwrite Web SDK to set up our Auth library in the application. We used `account.createOAuth2Session` in the `add` function to leverage our Discord OAuth adapter. The `get` function returns the current logged-in user’s details.
|
||||
|
||||
```js
|
||||
// ./src/lib/user.js
|
||||
|
||||
import { account } from './appwrite';
|
||||
|
||||
export const user = {
|
||||
login: async () => {
|
||||
account.createOAuth2Session(
|
||||
'discord',
|
||||
`https://${window.location.hostname}/success`,
|
||||
`https://${window.location.hostname}/failure`
|
||||
);
|
||||
},
|
||||
|
||||
get: async () => {
|
||||
return await account.get();
|
||||
}
|
||||
};
|
||||
```
|
||||
|
||||
The `login` function was called through a button click on the index page of our application to start the authentication process.
|
||||
|
||||
```js
|
||||
// .src/routes/+page.svelte
|
||||
|
||||
<script>
|
||||
import { user } from '$lib/user';
|
||||
import InitHeading from '../components/InitHeading.svelte';
|
||||
import NavBar from '../components/NavBar.svelte';
|
||||
|
||||
function login() {
|
||||
user.login();
|
||||
}
|
||||
</script>
|
||||
|
||||
<NavBar />
|
||||
<section class="u-flex-vertical">
|
||||
<div class="container u-flex-vertical">
|
||||
<InitHeading heading="Giveaway" />
|
||||
|
||||
<img src="/giveaway.png" alt="Plain black T-shirt with the text Init and a keyboard branded with the Appwrite logo on the Escape key" />
|
||||
|
||||
<p class="heading-level-6 u-margin-32">
|
||||
Login with Discord and get a chance to win some amazing gifts!
|
||||
</p>
|
||||
|
||||
<button class="button is-big u-margin-32" on:click={login}>
|
||||
<span class="icon-discord"></span>
|
||||
Sign in with Discord
|
||||
</button>
|
||||
</div>
|
||||
</section>
|
||||
```
|
||||
|
||||
### Adding data to Appwrite Database
|
||||
|
||||
To add or get information from the database, we created a database library in the project. The `add` function adds the Discord username and email to our collection. The `list` function gets the list of all documents in our collection and returns it after reformatting for our roulette wheel for the giveaway.
|
||||
|
||||
```js
|
||||
// ./src/lib/database.js
|
||||
|
||||
import { Query, ID } from 'appwrite';
|
||||
import { database } from './appwrite';
|
||||
import { COLLECTION_NAME, DATABASE_NAME } from './constants';
|
||||
|
||||
export const db = {
|
||||
list: async () => {
|
||||
var entries = await database.listDocuments(DATABASE_NAME, COLLECTION_NAME, [
|
||||
Query.limit(500),
|
||||
Query.select(['discordName'])
|
||||
]);
|
||||
|
||||
var options = [];
|
||||
|
||||
entries.documents.forEach((entry) => {
|
||||
options.push({ label: entry.discordName });
|
||||
});
|
||||
|
||||
return { options: options, total: entries.total };
|
||||
},
|
||||
|
||||
add: async (discordName, email) => {
|
||||
try {
|
||||
await database.createDocument(DATABASE_NAME, COLLECTION_NAME, ID.unique(), {
|
||||
discordName: discordName,
|
||||
email: email
|
||||
});
|
||||
console.log('Added to the raffle');
|
||||
} catch (error) {
|
||||
console.log(error.message);
|
||||
}
|
||||
}
|
||||
};
|
||||
```
|
||||
|
||||
We integrated the `add` function directly into the `success` endpoint for our OAuth process so that the user’s information could be added to the database as soon as we had a successful login. We use Svelte’s `onMount` function to achieve this as soon as our page is rendered in the DOM.
|
||||
|
||||
```js
|
||||
// .src/routes/success/+page.svelte
|
||||
|
||||
<script>
|
||||
import { user } from '$lib/user';
|
||||
import { db } from '$lib/database';
|
||||
import { onMount } from 'svelte';
|
||||
import NavBar from '../../components/NavBar.svelte';
|
||||
|
||||
let userId = '';
|
||||
|
||||
async function getUserId() {
|
||||
var currentUser = await user.get();
|
||||
await db.add(currentUser.name, currentUser.email);
|
||||
userId = currentUser.name;
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
getUserId();
|
||||
});
|
||||
</script>
|
||||
|
||||
<NavBar />
|
||||
|
||||
<div class="container u-flex-vertical">
|
||||
<h1 class="heading-level-1 u-margin-32 u-normal">Success!</h1>
|
||||
<p class="body-text-1 u-margin-32 u-normal">Thanks for participating in the giveaway, {userId}</p>
|
||||
</div>
|
||||
```
|
||||
|
||||
### Creating our giveaway roulette
|
||||
|
||||
To create our giveaway roulette, we used an NPM package [`spin-wheel`](https://www.npmjs.com/package/spin-wheel). To set this up, we first used a `load` function to get the list of Discord usernames that were already available in the collection before the giveaway page was rendered.
|
||||
|
||||
```js
|
||||
// .src/routes/giveaway/+page.js
|
||||
|
||||
import { db } from '$lib/database';
|
||||
|
||||
export async function load() {
|
||||
var dbResponse = await db.list();
|
||||
|
||||
return {
|
||||
entries: dbResponse.options,
|
||||
total: dbResponse.total
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
Using the load function would ensure that this list would be available on our page as soon as it gets rendered. We used this list with the `spin-wheel` package to generate a roulette wheel. As a bonus, we also integrated Appwrite Realtime to add new Discord usernames to our list and regenerate the wheel with the updated data. We let the winner selection remain mathematically random and used the `spin-wheel` package to spin the roulette wheel and show us the winner. The wheel spinning function also required us to install an additional NPM package `easing-utils` to select the easing function defining the rate of change in the rotation speed of the wheel.
|
||||
|
||||
```js
|
||||
// .src/routes/giveaway/+page.svelte
|
||||
|
||||
<script>
|
||||
// @ts-nocheck
|
||||
|
||||
import { Wheel } from 'spin-wheel';
|
||||
import { onMount } from 'svelte';
|
||||
import InitHeading from '../../components/InitHeading.svelte';
|
||||
import * as easing from 'easing-utils';
|
||||
import { client } from '$lib/appwrite';
|
||||
import { DATABASE_NAME, COLLECTION_NAME } from '$lib/constants';
|
||||
|
||||
export let data;
|
||||
|
||||
let wheel = null;
|
||||
|
||||
var wheelContainer = null;
|
||||
|
||||
var props = {
|
||||
items: data.entries,
|
||||
itemLabelRadiusMax: 0.5
|
||||
};
|
||||
|
||||
let heading = `${props.items.length} people are registered!`;
|
||||
|
||||
var unsubscribe = null;
|
||||
|
||||
// Spins the wheel
|
||||
async function spin() {
|
||||
unsubscribe();
|
||||
var winningIndex = Math.floor(Math.random() * props.items.length);
|
||||
var duration = 5000;
|
||||
var spinToCenter = false;
|
||||
var numberOfRevolutions = 5;
|
||||
var direction = 1;
|
||||
var easingFunction = easing.easeOutCubic;
|
||||
|
||||
wheel.spinToItem(
|
||||
winningIndex,
|
||||
duration,
|
||||
spinToCenter,
|
||||
numberOfRevolutions,
|
||||
direction,
|
||||
easingFunction
|
||||
);
|
||||
|
||||
wheel.onRest = (e) => {
|
||||
var winner = props.items[wheel.getCurrentIndex()].label;
|
||||
heading = `Congratulations to the winner: ${winner}!`;
|
||||
};
|
||||
}
|
||||
|
||||
// Removes the wheel before recreating
|
||||
function removeWheel() {
|
||||
while (wheelContainer.hasChildNodes()) {
|
||||
wheelContainer.removeChild(wheelContainer.firstChild);
|
||||
}
|
||||
}
|
||||
|
||||
// Creates the wheel
|
||||
function createWheel() {
|
||||
wheel = new Wheel(wheelContainer, props);
|
||||
wheel.radius = 0.95;
|
||||
wheel.isInteractive = false;
|
||||
wheel.overlayImage = '/picker.png';
|
||||
wheel.itemBackgroundColors = ['#27272A'];
|
||||
wheel.itemLabelColors = ['#FFFFFF'];
|
||||
wheel.itemLabelFont = 'sans-serif';
|
||||
wheel.itemLabelFontSize = 20;
|
||||
wheel.borderColor = '#3d3d3f';
|
||||
wheel.lineColor = '#3d3d3f';
|
||||
}
|
||||
|
||||
// Uses Appwrite Realtime to get newly created documents and regenerate the wheel
|
||||
function subscribe() {
|
||||
return client.subscribe(
|
||||
`databases.${DATABASE_NAME}.collections.${COLLECTION_NAME}.documents`,
|
||||
(response) => {
|
||||
console.log(response);
|
||||
props.items.push({ label: response.payload.discordName });
|
||||
heading = `${props.items.length} people are registered!`;
|
||||
removeWheel();
|
||||
createWheel();
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
if(unsubscribe === null) {
|
||||
unsubscribe = subscribe();
|
||||
}
|
||||
wheelContainer = document.querySelector('.wheel-container');
|
||||
createWheel();
|
||||
});
|
||||
</script>
|
||||
|
||||
<section class="u-flex-vertical u-gap-16">
|
||||
<InitHeading {heading} />
|
||||
<div class="wheel u-flex-vertical">
|
||||
<div class="wheel-container u-flex-vertical"></div>
|
||||
</div>
|
||||
<button class="button is-big" on:click={spin}>Spin The Wheel</button>
|
||||
</section>
|
||||
```
|
||||
|
||||
# Outcome
|
||||
|
||||
The giveaway roulette app was used over 450 times by 230+ different users across the different Init events we hosted. The application is still live and can be tried through the following links:
|
||||
|
||||
- Participate in the giveaway roulette: [giveaway.appwrite.io](https://giveaway.appwrite.io)
|
||||
- Giveaway roulette: [giveaway.appwrite.io/giveaway](https://giveaway.appwrite.io/giveaway)
|
||||
|
||||
You can find the application’s complete source code at this [GitHub Repo](https://github.com/adityaoberai/InitGiveawayRoulette).
|
||||
|
||||
[Join us on Discord](http://appwrite.io/discord) to be the first to get updates and to be part of a vibrant community!
|
||||
@@ -2,7 +2,7 @@
|
||||
layout: post
|
||||
title: "Appwrite 1.5: celebrating the contributors"
|
||||
description: Appreciating the contributors from our community who help shape Appwrite as it is today.
|
||||
date: 2024-03-01
|
||||
date: 2024-03-06
|
||||
cover: /images/blog/celebrating-1.5-contributors.png
|
||||
timeToRead: 5
|
||||
author: aditya-oberai
|
||||
@@ -53,7 +53,7 @@ An essential part of the ticket is that we wanted to emphasize the importance of
|
||||
|
||||
As you can see on each side of the ticket, a grid resembles your unique GitHub contributions over the past year, just like on your GitHub profile. You can choose to add the grid with a toggle, but to do so, you need to connect your GitHub account.
|
||||
|
||||
Now, in case you would like to know how you can do this, we asked the engineer in charge, [Thomas G Lopez](https://github.com/TGlide), to explain the process.
|
||||
Now, in case you would like to know how you can do this, we asked the engineer in charge, [Thomas G Lopes](https://github.com/TGlide), to explain the process.
|
||||
|
||||
## Associating your GitHub account with your ticket
|
||||
|
||||
@@ -77,7 +77,6 @@ Our website is developed with SvelteKit, which is a full-stack framework. TL;DR,
|
||||
|
||||
We then can generate a matrix that representes the contribution chart. Each array of the matrix will represent a week, and each item of said array will contain the contribution level for that particular day.
|
||||
|
||||
|
||||
```ts
|
||||
const res = await fetch(`https://github.com/${gh_user}`);
|
||||
|
||||
@@ -202,6 +201,6 @@ Thomas explained the cool part of how we managed to make your ticket truly uniqu
|
||||
|
||||
You can find the entire source code for the tickets on [GitHub](https://github.com/appwrite/console/blob/cloud-1.1.x/src/routes/card/Card.svelte) to create your digital event tickets. In May, we created a [showcase site](https://appwrite-card-snippets.vercel.app/popup) for the Cloud cards on how to add a pop, rotation, and glare to the cards. We advise you to check it out to make your tickets all the more magical.
|
||||
|
||||
Although Init is over, you can still get yourself a ticket at https://appwrite.io/init/ticket
|
||||
Although Init is over, you can still get yourself a ticket at [appwrite.io/init/tickets](/init/tickets)
|
||||
|
||||
[Join us on Discord](http://appwrite.io/discord) to be the first to get updates and to be part of a vibrant community!
|
||||
|
||||
@@ -43,7 +43,7 @@ If you know Appwrite, you know [Steven Nguyen](https://github.com/stnguyen90). N
|
||||
|
||||
# Contributing in general
|
||||
|
||||
Now, we don’t only hire people from our own community. We, and other tech companies, appreciate contributing in general. [Thomas G Lopez](https://github.com/TGlide/), a front-end dev, is one of the people who has made notable contributions within the Svelte community. He even built [Melt UI](https://melt-ui.com/docs/introduction), an open-source collection of accessible and customizable component builders for creating user interfaces with Svelte. His contributions earned him the notable title of an official Svelte Ambassador.
|
||||
Now, we don’t only hire people from our own community. We, and other tech companies, appreciate contributing in general. [Thomas G Lopes](https://github.com/TGlide/), a front-end dev, is one of the people who has made notable contributions within the Svelte community. He even built [Melt UI](https://melt-ui.com/docs/introduction), an open-source collection of accessible and customizable component builders for creating user interfaces with Svelte. His contributions earned him the notable title of an official Svelte Ambassador.
|
||||
|
||||
If you have been around the Appwrite community, you must know [Aditya Oberai](https://github.com/adityaoberai) by now. He actively participates in the larger tech and hackathon community and stumbled across Appwrite by chance on X. Now, one thing you need to know about Aditya is his unfair advantage: he is a networker. So when he discovered Appwrite, he noticed that he already knew many other contributors, which drew him in further and helped him land a job at Appwrite.
|
||||
|
||||
|
||||
@@ -7,6 +7,6 @@ cover: /images/changelog/2024-03-01.png
|
||||
|
||||
Previously, we completely reimagined Functions to be more flexible and innovative yet familiar to developers. Now, Appwrite expands and updates the runtime ecosystem available on Appwrite Cloud with Bun 1.0.29, Node 21, Ruby 3.3, Deno 1.40, PHP 8.3, Python 3.12, Kotlin 1.9, Java 18, Swift 5.9 and Dart 3.3 support.
|
||||
|
||||
{% arrow_link href="blog/post/announcing-more-and-updated-runtimes" %}
|
||||
{% arrow_link href="/blog/post/announcing-more-and-updated-runtimes" %}
|
||||
Read the announcement to learn more
|
||||
{% /arrow_link %}
|
||||
12
src/routes/changelog/(entries)/2024-03-07.markdoc
Normal file
@@ -0,0 +1,12 @@
|
||||
---
|
||||
layout: changelog
|
||||
title: Appwrite API references now display the rate limits per endpoint.
|
||||
date: 2024-03-07
|
||||
cover: /images/changelog/2024-03-07.png
|
||||
---
|
||||
|
||||
Find them in [references documentation](/docs/references).
|
||||
|
||||
{% arrow_link href="/docs/advanced/platform/rate-limits" %}
|
||||
Learn about Rate limits
|
||||
{% /arrow_link %}
|
||||
20
src/routes/changelog/(entries)/2024-03-08.markdoc
Normal file
@@ -0,0 +1,20 @@
|
||||
---
|
||||
layout: changelog
|
||||
title: Appwrite 1.5 has been released to self hosted
|
||||
date: 2024-03-08
|
||||
cover: /images/changelog/2024-03-08.png
|
||||
---
|
||||
|
||||
Appwrite 1.5 has been released to self hosted.
|
||||
|
||||
You can now build with
|
||||
- Messaging
|
||||
- Improved SSR support
|
||||
- 2FA
|
||||
- Enum SDK support
|
||||
- OR and Contains queries
|
||||
- New and updated runtimes
|
||||
|
||||
{% arrow_link href="/blog/post/everything-new-with-appwrite-1.5" %}
|
||||
Read the recap article to learn more
|
||||
{% /arrow_link %}
|
||||
@@ -45,3 +45,20 @@ By default, an email alert will be sent at 75% of the budget cap. You can add up
|
||||
# Redeem credit {% #redeem-credit %}
|
||||
If you received a redeemable code for Appwrite Cloud credits, you can redeem them in the **Available credit** section.
|
||||
When you redeem credit, the credit balance will be automatically applied to the next billing cycle.
|
||||
|
||||
# Recurring payments for Indian developers {% #recurring-payments-for-indian-developers %}
|
||||
|
||||
The Reserve Bank of India (RBI) mandates additional security measures for recurring payments on **Indian cards**.
|
||||
Appwrite is obligated to ask for verification before billing your card.
|
||||
Appwrite asks for verification for up to $150 in case you use add-ons.
|
||||
Confirming the verification will not charge your card.
|
||||
When you are charged at the end of the billing period,
|
||||
you will not be charged more than your monthly plan plus add-ons used.
|
||||
|
||||
If you set a budget cap, the verification will remain at $150, but the budget cap will still be applied for your add-ons.
|
||||
Again, you will not be charged when confirming the verification.
|
||||
When you are charged at the end of the billing period,
|
||||
you will not be charged more than your monthly plan plus add-ons used.
|
||||
|
||||
If you need higher limits, [contact us](mailto:billing@appwrite.io).
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ docker run -it --rm \
|
||||
--volume /var/run/docker.sock:/var/run/docker.sock \
|
||||
--volume "$(pwd)"/appwrite:/usr/src/code/appwrite:rw \
|
||||
--entrypoint="install" \
|
||||
appwrite/appwrite:1.4.13
|
||||
appwrite/appwrite:1.5.1
|
||||
```
|
||||
{% /tabsitem %}
|
||||
|
||||
@@ -46,7 +46,7 @@ docker run -it --rm ^
|
||||
--volume //var/run/docker.sock:/var/run/docker.sock ^
|
||||
--volume "%cd%"/appwrite:/usr/src/code/appwrite:rw ^
|
||||
--entrypoint="install" ^
|
||||
appwrite/appwrite:1.4.13
|
||||
appwrite/appwrite:1.5.1
|
||||
```
|
||||
## Powershell
|
||||
```powershell
|
||||
@@ -54,7 +54,7 @@ docker run -it --rm `
|
||||
--volume /var/run/docker.sock:/var/run/docker.sock `
|
||||
--volume ${pwd}/appwrite:/usr/src/code/appwrite:rw `
|
||||
--entrypoint="install" `
|
||||
appwrite/appwrite:1.4.13
|
||||
appwrite/appwrite:1.5.1
|
||||
```
|
||||
{% /tabsitem %}
|
||||
{% /tabs %}
|
||||
|
||||
@@ -35,7 +35,7 @@ docker run -it --rm \
|
||||
--volume /var/run/docker.sock:/var/run/docker.sock \
|
||||
--volume "$(pwd)"/appwrite:/usr/src/code/appwrite:rw \
|
||||
--entrypoint="upgrade" \
|
||||
appwrite/appwrite:1.4.13
|
||||
appwrite/appwrite:1.5.1
|
||||
```
|
||||
|
||||
## CMD
|
||||
@@ -45,7 +45,7 @@ docker run -it --rm ^
|
||||
--volume //var/run/docker.sock:/var/run/docker.sock ^
|
||||
--volume "%cd%"/appwrite:/usr/src/code/appwrite:rw ^
|
||||
--entrypoint="upgrade" ^
|
||||
appwrite/appwrite:1.4.13
|
||||
appwrite/appwrite:1.5.1
|
||||
```
|
||||
|
||||
## PowerShell
|
||||
@@ -55,7 +55,7 @@ docker run -it --rm `
|
||||
--volume /var/run/docker.sock:/var/run/docker.sock `
|
||||
--volume ${pwd}/appwrite:/usr/src/code/appwrite:rw `
|
||||
--entrypoint="upgrade" `
|
||||
appwrite/appwrite:1.4.13
|
||||
appwrite/appwrite:1.5.1
|
||||
```
|
||||
|
||||
This will pull the `docker-compose.yml` file for the new version and perform the installation.
|
||||
|
||||
@@ -4,7 +4,12 @@ title: Tokens
|
||||
description: What are tokens and how to use them in Appwrite
|
||||
---
|
||||
|
||||
Tokens are short-lived secrets created by an that can be exchanged for session by a [Client SDK](/docs/sdks#client) to log in users.
|
||||
Tokens are short-lived secrets created by an [Appwrite Server SDK](/docs/sdks#server) that can be exchanged for session by a [Client SDK](/docs/sdks#client) to log in users.
|
||||
Some auth methods like [Magic URL login](/docs/products/auth/magic-url),
|
||||
[Email OTP login](/docs/products/auth/email-otp), or [Phone (SMS) login](/docs/products/auth/phone-sms) already generate tokens.
|
||||
|
||||
You can also create custom tokens using the [Create token](/docs/products/auth/custom-token)
|
||||
endpoint of the [Users API](/docs/products/auth/users). This can be used to implement **custom authentication flows**.
|
||||
|
||||
Tokens are created with the following properties:
|
||||
|
||||
@@ -18,20 +23,16 @@ Tokens are created with the following properties:
|
||||
|
||||
Many Appwrite authentication methods use a token-base flow to authenticate users. For token-based authentication methods, there are two high level steps to authenticate a user:
|
||||
|
||||
# Create a token {% #create-a-token %}
|
||||
# Token login {% #token-login %}
|
||||
You can find different usage of tokens in the Appwrite.
|
||||
|
||||
First, create a token for the user.
|
||||
|
||||
Methods that create tokens include [Magic URL login](/docs/products/auth/magic-url), [Email OTP login](/docs/products/auth/email-otp), [Phone (SMS) login](/docs/products/auth/phone-sms), and [Custom token](/docs/products/auth/custom-token/#create-custom-token).
|
||||
|
||||
These methods transfer the token `userId` and `secret` to the client, via a URL, email, SMS, or other method. The client then uses the token to create a session.
|
||||
|
||||
Custom tokens can be created using the [Create token](/docs/references/cloud/server-nodejs/users#createToken) endpoint of the [Users API](/docs/products/auth/users).
|
||||
|
||||
# Create a session using the token {% #create-session-using-token %}
|
||||
|
||||
After the token is created, the client uses the token to create a session. The session is then used to authenticate the user for subsequent requests.
|
||||
|
||||
To create a session, the client sends the token to the server using the [Create session](/docs/references/cloud/server-nodejs/account#createSession) endpoint of the [Account API](/docs/products/auth/users). The server then returns a session object.
|
||||
|
||||
When the session is successfully created, the session is stored in a persistent manner and you can now do requests as authorized user from the application.
|
||||
{% cards %}
|
||||
{% cards_item href="/docs/products/auth/custom-token" title="Custom token login" %}
|
||||
{% /cards_item %}
|
||||
{% cards_item href="/docs/products/auth/email-otp" title="Email OTP login" %}
|
||||
{% /cards_item %}
|
||||
{% cards_item href="/docs/products/auth/magic-url" title="Email magic URL" %}
|
||||
{% /cards_item %}
|
||||
{% cards_item href="/docs/products/auth/phone-sms" title="Phone (SMS) OTP" %}
|
||||
{% /cards_item %}
|
||||
{% /cards %}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
layout: article
|
||||
title: Manage users
|
||||
title: Users
|
||||
description: Manage user identities and profiles effectively with Appwrite. Dive into user management features, account settings, and user data customization
|
||||
---
|
||||
|
||||
|
||||
@@ -22,9 +22,10 @@ Below is a list of available Functions runtimes. The Appwrite team continually a
|
||||
`node-18.0`
|
||||
`node-19.0`
|
||||
`node-20.0`
|
||||
`node-21.0`
|
||||
* x86 / arm64 / armv7 / armv8
|
||||
---
|
||||
* {% icon icon="bun" size="l" /%}
|
||||
* {% icon icon="bun-sh" size="l" /%}
|
||||
* [Bun](https://hub.docker.com/r/openruntimes/bun/tags)
|
||||
* `bun-1.0`
|
||||
* x86 / arm64
|
||||
@@ -34,6 +35,7 @@ Below is a list of available Functions runtimes. The Appwrite team continually a
|
||||
* `deno-1.21`
|
||||
`deno-1.24`
|
||||
`deno-1.35`
|
||||
`deno-1.40`
|
||||
* x86
|
||||
---
|
||||
* {% icon icon="python" size="l" /%}
|
||||
@@ -53,6 +55,7 @@ Below is a list of available Functions runtimes. The Appwrite team continually a
|
||||
`dart-2.18`
|
||||
`dart-3.0`
|
||||
`dart-3.1`
|
||||
`dart-3.3`
|
||||
* x86 / arm64 / armv7 / armv8
|
||||
---
|
||||
* {% icon icon="php" size="l" /%}
|
||||
@@ -60,6 +63,7 @@ Below is a list of available Functions runtimes. The Appwrite team continually a
|
||||
* `php-8.0`
|
||||
`php-8.1`
|
||||
`php-8.2`
|
||||
`php-8.3`
|
||||
* x86 / arm64 / armv7 / armv8
|
||||
---
|
||||
* {% icon icon="ruby" size="l" /%}
|
||||
@@ -67,6 +71,7 @@ Below is a list of available Functions runtimes. The Appwrite team continually a
|
||||
* `ruby-3.0`
|
||||
`ruby-3.1`
|
||||
`ruby-3.2`
|
||||
`ruby-3.3`
|
||||
* x86 / arm64 / armv7 / armv8
|
||||
---
|
||||
* {% icon icon="dotnet" size="l" /%}
|
||||
@@ -82,18 +87,21 @@ Below is a list of available Functions runtimes. The Appwrite team continually a
|
||||
`java-11.0`
|
||||
`java-17.0`
|
||||
`java-18.0`
|
||||
`java-21.0`
|
||||
* x86 / arm64 / armv7 / armv8
|
||||
---
|
||||
* {% icon icon="swift" size="l" /%}
|
||||
* [Swift](https://hub.docker.com/r/openruntimes/swift/tags)
|
||||
* `swift-5.5`
|
||||
`swift-5.8`
|
||||
`swift-5.9`
|
||||
* x86 / arm64 / armv7 / armv8
|
||||
---
|
||||
* {% icon icon="kotlin" size="l" /%}
|
||||
* [Kotlin](https://hub.docker.com/r/openruntimes/kotlin/tags)
|
||||
* `kotlin-1.6`
|
||||
`kotlin-1.8`
|
||||
`kotlin-1.9`
|
||||
* x86 / arm64 / armv7 / armv8
|
||||
---
|
||||
* {% icon icon="cpp" size="l" /%}
|
||||
|
||||
@@ -88,7 +88,7 @@ Add push notification capability to your app by clicking your root-level app in
|
||||
Push notification requires special handling on the client side. Follow the [Send push notification](/docs/products/messaging/send-push-notifications) flow to test your provider.
|
||||
{% /section %}
|
||||
|
||||
{% section #manage-provider step=4 title="Manage provider" %}
|
||||
{% section #manage-provider step=5 title="Manage provider" %}
|
||||
{% tabs %}
|
||||
{% tabsitem #console title="Console" %}
|
||||
You can update or delete a provider in the Appwrite Console.
|
||||
@@ -116,7 +116,7 @@ client
|
||||
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
||||
;
|
||||
|
||||
const promise = messaging.updateAPNSProvider(
|
||||
const provider = await messaging.updateAPNSProvider(
|
||||
'[PROVIDER_ID]', // providerId
|
||||
'[NAME]', // name (optional)
|
||||
false, // enabled (optional)
|
||||
@@ -125,12 +125,6 @@ const promise = messaging.updateAPNSProvider(
|
||||
'[TEAM_ID]', // teamId (optional)
|
||||
'[BUNDLE_ID]' // bundleId (optional)
|
||||
);
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response);
|
||||
}, function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
```
|
||||
```deno
|
||||
import * as sdk from "https://deno.land/x/appwrite/mod.ts";
|
||||
@@ -146,7 +140,7 @@ client
|
||||
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
||||
;
|
||||
|
||||
const promise = messaging.updateAPNSProvider(
|
||||
const provider = await messaging.updateAPNSProvider(
|
||||
'[PROVIDER_ID]', // providerId
|
||||
'[NAME]', // name (optional)
|
||||
false, // enabled (optional)
|
||||
@@ -155,12 +149,6 @@ const promise = messaging.updateAPNSProvider(
|
||||
'[TEAM_ID]', // teamId (optional)
|
||||
'[BUNDLE_ID]' // bundleId (optional)
|
||||
);
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response);
|
||||
}, function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
```
|
||||
```php
|
||||
<?php
|
||||
@@ -259,6 +247,8 @@ Provider result = await messaging.UpdateAPNSProvider(
|
||||
```
|
||||
```dart
|
||||
import 'package:dart_appwrite/dart_appwrite.dart';
|
||||
import 'package:dart_appwrite/enums.dart';
|
||||
import 'package:dart_appwrite/models.dart';
|
||||
|
||||
void main() { // Init SDK
|
||||
Client client = Client();
|
||||
|
||||
@@ -85,7 +85,7 @@ Push notification requires special handling on the client side. Follow the [Send
|
||||
{% /section %}
|
||||
|
||||
|
||||
{% section #manage-provider step=4 title="Manage provider" %}
|
||||
{% section #manage-provider step=5 title="Manage provider" %}
|
||||
{% tabs %}
|
||||
{% tabsitem #console title="Console" %}
|
||||
You can update or delete a provider in the Appwrite Console.
|
||||
@@ -113,18 +113,12 @@ client
|
||||
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
||||
;
|
||||
|
||||
const promise = messaging.updateFCMProvider(
|
||||
const provider = await messaging.updateFCMProvider(
|
||||
'[PROVIDER_ID]', // providerId
|
||||
'[NAME]', // name (optional)
|
||||
false, // enabled (optional)
|
||||
{} // serviceAccountJSON (optional)
|
||||
);
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response);
|
||||
}, function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
```
|
||||
```deno
|
||||
import * as sdk from "https://deno.land/x/appwrite/mod.ts";
|
||||
@@ -140,18 +134,12 @@ client
|
||||
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
||||
;
|
||||
|
||||
const promise = messaging.updateFCMProvider(
|
||||
const provider = await messaging.updateFCMProvider(
|
||||
'[PROVIDER_ID]', // providerId
|
||||
'[NAME]', // name (optional)
|
||||
false, // enabled (optional)
|
||||
{} // serviceAccountJSON (optional)
|
||||
);
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response);
|
||||
}, function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
```
|
||||
```php
|
||||
<?php
|
||||
@@ -238,6 +226,8 @@ Provider result = await messaging.UpdateFCMProvider(
|
||||
```
|
||||
```dart
|
||||
import 'package:dart_appwrite/dart_appwrite.dart';
|
||||
import 'package:dart_appwrite/enums.dart';
|
||||
import 'package:dart_appwrite/models.dart';
|
||||
|
||||
void main() { // Init SDK
|
||||
Client client = Client();
|
||||
|
||||
@@ -100,13 +100,7 @@ client
|
||||
.setKey('<API_KEY>') // Your secret API key
|
||||
;
|
||||
|
||||
const promise = messaging.createEmail('<MESSAGE_ID>', '<SUBJECT>', '<CONTENT>');
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response);
|
||||
}, function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
const message = await messaging.createEmail('<MESSAGE_ID>', '<SUBJECT>', '<CONTENT>');
|
||||
```
|
||||
```deno
|
||||
import * as sdk from "https://deno.land/x/appwrite/mod.ts";
|
||||
@@ -122,13 +116,7 @@ client
|
||||
.setKey('<API_KEY>') // Your secret API key
|
||||
;
|
||||
|
||||
let promise = messaging.createEmail('<MESSAGE_ID>', '<SUBJECT>', '<CONTENT>');
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response);
|
||||
}, function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
const message - await messaging.createEmail('<MESSAGE_ID>', '<SUBJECT>', '<CONTENT>');
|
||||
```
|
||||
```php
|
||||
<?php
|
||||
@@ -201,6 +189,8 @@ Message result = await messaging.CreateEmail(
|
||||
```
|
||||
```dart
|
||||
import 'package:dart_appwrite/dart_appwrite.dart';
|
||||
import 'package:dart_appwrite/enums.dart';
|
||||
import 'package:dart_appwrite/models.dart';
|
||||
|
||||
void main() { // Init SDK
|
||||
Client client = Client();
|
||||
@@ -489,6 +479,8 @@ Provider result = await messaging.UpdateSendgridProvider(
|
||||
```
|
||||
```dart
|
||||
import 'package:dart_appwrite/dart_appwrite.dart';
|
||||
import 'package:dart_appwrite/enums.dart';
|
||||
import 'package:dart_appwrite/models.dart';
|
||||
|
||||
void main() { // Init SDK
|
||||
Client client = Client();
|
||||
|
||||
@@ -68,8 +68,7 @@ This helps you reach your user, even when their device do not have internet acce
|
||||
{% /table %}
|
||||
|
||||
# Messages lifecycle {% #messages-lifecycle %}
|
||||
All messages begin as `draft`.
|
||||
If the message is sent immediately, its status is set to `processing`.
|
||||
Messages can begin as a `draft`, or proceed directly to `processing` if it's sent immediately.
|
||||
If the message is scheduled to be sent later, its status is set to `scheduled`, then to `processing` at schedule time.
|
||||
After attempted delivery, it is marked as `sent` or `failed` depending on if the message was successfully delivered.
|
||||
{% only_dark %}
|
||||
@@ -154,13 +153,13 @@ Here are the different components that make up a message.
|
||||
* optional
|
||||
* Sets the number to display next to the app's icon, indicating the number of notifications or updates. Setting to 0 removes any existing badge. This is for Apple devices only.
|
||||
---
|
||||
* `status`
|
||||
* `draft`
|
||||
* optional
|
||||
* The status of the push notification, which can be `draft`, `scheduled`, or `processing` (default). `Processing` means the notification is sent immediately.
|
||||
* If the message is a draft, can be `true` or `false`.
|
||||
---
|
||||
* `scheduledAt`
|
||||
* optional
|
||||
* An ISO date time string specifying when the push notification should be sent. This parameter must be set if the status is `scheduled` and must represent a future time.
|
||||
* An ISO date time string specifying when the push notification should be sent.
|
||||
{% /table %}
|
||||
|
||||
{% /tabsitem %}
|
||||
@@ -191,13 +190,13 @@ Here are the different components that make up a message.
|
||||
* optional
|
||||
* A boolean indicating whether the `content` is in HTML format. This allows for rich text, links, and styling in the email content.
|
||||
---
|
||||
* `status`
|
||||
* `draft`
|
||||
* optional
|
||||
* The status of the email, which can be draft, scheduled, processing (default). Processing means the email is sent immediately.
|
||||
* If the message is a draft, can be `true` or `false`.
|
||||
---
|
||||
* `scheduledAt`
|
||||
* optional
|
||||
* An ISO date time string specifying when the email should be sent. This parameter must be set if the status is `scheduled` and must represent a future time.
|
||||
* An ISO date time string specifying when the email should be sent.
|
||||
{% /table %}
|
||||
|
||||
{% /tabsitem %}
|
||||
@@ -211,13 +210,13 @@ Here are the different components that make up a message.
|
||||
* required
|
||||
* The main content of the SMS. This should be concise and clear, as SMS messages have character limits.
|
||||
---
|
||||
* `status`
|
||||
* `draft`
|
||||
* optional
|
||||
* The status of the SMS message, which can be `draft`, `scheduled`, or `processing` (default). `Processing` means the SMS is sent immediately.
|
||||
* If the message is a draft, can be `true` or `false`.
|
||||
---
|
||||
* `scheduledAt`
|
||||
* optional
|
||||
* An ISO date time string specifying when the SMS should be sent. This parameter must be set if the status is `scheduled` and must represent a future time.
|
||||
* An ISO date time string specifying when the SMS should be sent.
|
||||
{% /table %}
|
||||
{% /tabsitem %}
|
||||
{% /tabs %}
|
||||
@@ -241,7 +240,7 @@ client
|
||||
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
||||
;
|
||||
|
||||
const promise = messaging.createPush(
|
||||
const message = await messaging.createPush(
|
||||
'[MESSAGE_ID]', // messageId
|
||||
'[TITLE]', // title
|
||||
'[BODY]', // body
|
||||
@@ -255,15 +254,9 @@ const promise = messaging.createPush(
|
||||
'[COLOR]', // color (optional)
|
||||
'[TAG]', // tag (optional)
|
||||
'[BADGE]', // badge (optional)
|
||||
'draft', // status (optional)
|
||||
true, // draft (optional)
|
||||
'' // scheduledAt (optional)
|
||||
);
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response);
|
||||
}, function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
```
|
||||
```deno
|
||||
import * as sdk from "https://deno.land/x/appwrite/mod.ts";
|
||||
@@ -279,7 +272,7 @@ client
|
||||
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
||||
;
|
||||
|
||||
const promise = messaging.createPush(
|
||||
const message = await messaging.createPush(
|
||||
'[MESSAGE_ID]', // messageId
|
||||
'[TITLE]', // title
|
||||
'[BODY]', // body
|
||||
@@ -293,15 +286,9 @@ const promise = messaging.createPush(
|
||||
'[COLOR]', // color (optional)
|
||||
'[TAG]', // tag (optional)
|
||||
'[BADGE]', // badge (optional)
|
||||
'draft', // status (optional)
|
||||
true, // draft (optional)
|
||||
'' // scheduledAt (optional)
|
||||
);
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response);
|
||||
}, function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
```
|
||||
```php
|
||||
<?php
|
||||
@@ -333,7 +320,7 @@ $result = $messaging->createPush(
|
||||
color: '[COLOR]', // optional
|
||||
tag: '[TAG]', // optional
|
||||
badge: '[BADGE]', // optional
|
||||
status: 'draft', // optional
|
||||
draft: true, // optional
|
||||
scheduledAt: '' // optional
|
||||
);
|
||||
```
|
||||
@@ -365,7 +352,7 @@ result = messaging.create_push(
|
||||
color = '[COLOR]', # optional
|
||||
tag = '[TAG]', # optional
|
||||
badge = '[BADGE]', # optional
|
||||
status = 'draft', # optional
|
||||
draft = True, # optional
|
||||
scheduled_at = '' # optional
|
||||
)
|
||||
```
|
||||
@@ -395,7 +382,7 @@ response = messaging.create_push(
|
||||
color: '[COLOR]', # optional
|
||||
tag: '[TAG]', # optional
|
||||
badge: '[BADGE]', # optional
|
||||
status: 'draft', # optional
|
||||
draft: true, # optional
|
||||
scheduled_at: '' # optional
|
||||
)
|
||||
|
||||
@@ -427,11 +414,13 @@ Message result = await messaging.CreatePush(
|
||||
color: "[COLOR]" // optional
|
||||
tag: "[TAG]" // optional
|
||||
badge: "[BADGE]" // optional
|
||||
status: "draft" // optional
|
||||
draft: true // optional
|
||||
scheduledAt: ""); // optional
|
||||
```
|
||||
```dart
|
||||
import 'package:dart_appwrite/dart_appwrite.dart';
|
||||
import 'package:dart_appwrite/enums.dart';
|
||||
import 'package:dart_appwrite/models.dart';
|
||||
|
||||
void main() { // Init SDK
|
||||
Client client = Client();
|
||||
@@ -457,7 +446,7 @@ void main() { // Init SDK
|
||||
color: '[COLOR]', // optional
|
||||
tag: '[TAG]', // optional
|
||||
badge: '[BADGE]', // optional
|
||||
status: 'draft', // optional
|
||||
draft: true, // optional
|
||||
scheduledAt: '', // optional
|
||||
);
|
||||
|
||||
@@ -495,7 +484,7 @@ messaging.createPush(
|
||||
"[COLOR]", // color (optional)
|
||||
"[TAG]", // tag (optional)
|
||||
"[BADGE]", // badge (optional)
|
||||
"draft", // status (optional)
|
||||
true, // draft (optional)
|
||||
"" // scheduledAt (optional)
|
||||
new CoroutineCallback<>((result, error) -> {
|
||||
if (error != null) {
|
||||
@@ -533,7 +522,7 @@ messaging.createPush(
|
||||
"[COLOR]", // color (optional)
|
||||
"[TAG]", // tag (optional)
|
||||
"[BADGE]", // badge (optional)
|
||||
"draft", // status (optional)
|
||||
true, // draft (optional)
|
||||
"" // scheduledAt (optional)
|
||||
new CoroutineCallback<>((result, error) -> {
|
||||
if (error != null) {
|
||||
@@ -569,7 +558,7 @@ let message = try await messaging.createPush(
|
||||
color: "[COLOR]", // optional
|
||||
tag: "[TAG]", // optional
|
||||
badge: "[BADGE]", // optional
|
||||
status: "draft", // optional
|
||||
draft: true, // optional
|
||||
scheduledAt: "" // optional
|
||||
)
|
||||
```
|
||||
@@ -596,7 +585,7 @@ client
|
||||
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
||||
;
|
||||
|
||||
const promise = messaging.createEmail(
|
||||
const message - await messaging.createEmail(
|
||||
'[MESSAGE_ID]', // messageId
|
||||
'[SUBJECT]', // subject
|
||||
'[CONTENT]', // content
|
||||
@@ -605,16 +594,10 @@ const promise = messaging.createEmail(
|
||||
[], // targets (optional)
|
||||
[], // cc (optional)
|
||||
[], // bcc (optional)
|
||||
'draft', // status (optional)
|
||||
true, // draft (optional)
|
||||
false, // html (optional)
|
||||
'' // scheduledAt (optional)
|
||||
);
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response);
|
||||
}, function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
```
|
||||
```deno
|
||||
import * as sdk from "https://deno.land/x/appwrite/mod.ts";
|
||||
@@ -630,7 +613,7 @@ client
|
||||
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
||||
;
|
||||
|
||||
const promise = messaging.createEmail(
|
||||
const message - await messaging.createEmail(
|
||||
'[MESSAGE_ID]', // messageId
|
||||
'[SUBJECT]', // subject
|
||||
'[CONTENT]', // content
|
||||
@@ -639,16 +622,10 @@ const promise = messaging.createEmail(
|
||||
[], // targets (optional)
|
||||
[], // cc (optional)
|
||||
[], // bcc (optional)
|
||||
'draft', // status (optional)
|
||||
true, // draft (optional)
|
||||
false, // html (optional)
|
||||
'' // scheduledAt (optional)
|
||||
);
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response);
|
||||
}, function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
```
|
||||
```php
|
||||
<?php
|
||||
@@ -675,7 +652,7 @@ $result = $messaging->createEmail(
|
||||
targets: [], // optional
|
||||
cc: [], // optional
|
||||
bcc: [], // optional
|
||||
status: 'draft', // optional
|
||||
draft: true, // optional
|
||||
html: false, // optional
|
||||
scheduledAt: '' // optional
|
||||
);
|
||||
@@ -703,7 +680,7 @@ result = messaging.create_email(
|
||||
targets = [], # optional
|
||||
cc = [], # optional
|
||||
bcc = [], # optional
|
||||
status = 'draft', # optional
|
||||
draft = True, # optional
|
||||
html = False, # optional
|
||||
scheduled_at = '' # optional
|
||||
)
|
||||
@@ -729,7 +706,7 @@ response = messaging.create_email(
|
||||
targets: [], # optional
|
||||
cc: [], # optional
|
||||
bcc: [], # optional
|
||||
status: 'draft', # optional
|
||||
draft: true, # optional
|
||||
html: false, # optional
|
||||
scheduled_at: '' # optional
|
||||
)
|
||||
@@ -757,12 +734,14 @@ Message result = await messaging.CreateEmail(
|
||||
targets: new List<string> {} // optional
|
||||
cc: new List<string> {} // optional
|
||||
bcc: new List<string> {} // optional
|
||||
status: "draft" // optional
|
||||
draft: true // optional
|
||||
html: false // optional
|
||||
scheduledAt: ""); // optional
|
||||
```
|
||||
```dart
|
||||
import 'package:dart_appwrite/dart_appwrite.dart';
|
||||
import 'package:dart_appwrite/enums.dart';
|
||||
import 'package:dart_appwrite/models.dart';
|
||||
|
||||
void main() { // Init SDK
|
||||
Client client = Client();
|
||||
@@ -783,7 +762,7 @@ void main() { // Init SDK
|
||||
targets: [], // optional
|
||||
cc: [], // optional
|
||||
bcc: [], // optional
|
||||
status: 'draft', // optional
|
||||
draft: true, // optional
|
||||
html: false, // optional
|
||||
scheduledAt: '', // optional
|
||||
);
|
||||
@@ -817,7 +796,7 @@ messaging.createEmail(
|
||||
listOf(), // targets (optional)
|
||||
listOf(), // cc (optional)
|
||||
listOf(), // bcc (optional)
|
||||
"draft", // status (optional)
|
||||
true, // draft (optional)
|
||||
false, // html (optional)
|
||||
"" // scheduledAt (optional)
|
||||
new CoroutineCallback<>((result, error) -> {
|
||||
@@ -851,7 +830,7 @@ messaging.createEmail(
|
||||
listOf(), // targets (optional)
|
||||
listOf(), // cc (optional)
|
||||
listOf(), // bcc (optional)
|
||||
"draft", // status (optional)
|
||||
true, // draft (optional)
|
||||
false, // html (optional)
|
||||
"" // scheduledAt (optional)
|
||||
new CoroutineCallback<>((result, error) -> {
|
||||
@@ -883,7 +862,7 @@ let message = try await messaging.createEmail(
|
||||
targets: [], // optional
|
||||
cc: [], // optional
|
||||
bcc: [], // optional
|
||||
status: "draft", // optional
|
||||
draft: true, // optional
|
||||
html: xfalse, // optional
|
||||
scheduledAt: "" // optional
|
||||
)
|
||||
@@ -911,21 +890,15 @@ client
|
||||
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
||||
;
|
||||
|
||||
const promise = messaging.createSMS(
|
||||
const message = await messaging.createSMS(
|
||||
'[MESSAGE_ID]', // messageId
|
||||
'[CONTENT]', // content
|
||||
[], // topics (optional)
|
||||
[], // users (optional)
|
||||
[], // targets (optional)
|
||||
'draft', // status (optional)
|
||||
true, // draft (optional)
|
||||
'' // scheduledAt (optional)
|
||||
);
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response);
|
||||
}, function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
```
|
||||
```deno
|
||||
import * as sdk from "https://deno.land/x/appwrite/mod.ts";
|
||||
@@ -941,21 +914,15 @@ client
|
||||
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
||||
;
|
||||
|
||||
const promise = messaging.createSMS(
|
||||
const message = await messaging.createSMS(
|
||||
'[MESSAGE_ID]', // messageId
|
||||
'[CONTENT]', // content
|
||||
[], // topics (optional)
|
||||
[], // users (optional)
|
||||
[], // targets (optional)
|
||||
'draft', // status (optional)
|
||||
true, // draft (optional)
|
||||
'' // scheduledAt (optional)
|
||||
);
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response);
|
||||
}, function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
```
|
||||
```php
|
||||
<?php
|
||||
@@ -979,7 +946,7 @@ $result = $messaging->createSMS(
|
||||
topics: [], // optional
|
||||
users: [], // optional
|
||||
targets: [], // optional
|
||||
status: 'draft', // optional
|
||||
draft: true, // optional
|
||||
scheduledAt: '' // optional
|
||||
);
|
||||
```
|
||||
@@ -1003,7 +970,7 @@ result = messaging.create_sms(
|
||||
topics = [], # optional
|
||||
users = [], # optional
|
||||
targets = [], # optional
|
||||
status = 'draft', # optional
|
||||
draft = True, # optional
|
||||
scheduled_at = '' # optional
|
||||
)
|
||||
```
|
||||
@@ -1025,7 +992,7 @@ response = messaging.create_sms(
|
||||
topics: [], # optional
|
||||
users: [], # optional
|
||||
targets: [], # optional
|
||||
status: 'draft', # optional
|
||||
draft: true, # optional
|
||||
scheduled_at: '' # optional
|
||||
)
|
||||
|
||||
@@ -1049,11 +1016,13 @@ Message result = await messaging.CreateSMS(
|
||||
topics: new List<string> {} // optional
|
||||
users: new List<string> {} // optional
|
||||
targets: new List<string> {} // optional
|
||||
status: "draft" // optional
|
||||
draft: true // optional
|
||||
scheduledAt: ""); // optional
|
||||
```
|
||||
```dart
|
||||
import 'package:dart_appwrite/dart_appwrite.dart';
|
||||
import 'package:dart_appwrite/enums.dart';
|
||||
import 'package:dart_appwrite/models.dart';
|
||||
|
||||
void main() { // Init SDK
|
||||
Client client = Client();
|
||||
@@ -1071,7 +1040,7 @@ void main() { // Init SDK
|
||||
topics: [], // optional
|
||||
users: [], // optional
|
||||
targets: [], // optional
|
||||
status: 'draft', // optional
|
||||
draft: true, // optional
|
||||
scheduledAt: '', // optional
|
||||
);
|
||||
|
||||
@@ -1101,7 +1070,7 @@ messaging.createSMS(
|
||||
listOf(), // topics (optional)
|
||||
listOf(), // users (optional)
|
||||
listOf(), // targets (optional)
|
||||
"draft", // status (optional)
|
||||
true, // draft (optional)
|
||||
"" // scheduledAt (optional)
|
||||
new CoroutineCallback<>((result, error) -> {
|
||||
if (error != null) {
|
||||
@@ -1131,7 +1100,7 @@ messaging.createSMS(
|
||||
listOf(), // topics (optional)
|
||||
listOf(), // users (optional)
|
||||
listOf(), // targets (optional)
|
||||
"draft", // status (optional)
|
||||
true, // draft (optional)
|
||||
"" // scheduledAt (optional)
|
||||
new CoroutineCallback<>((result, error) -> {
|
||||
if (error != null) {
|
||||
@@ -1159,7 +1128,7 @@ let message = try await messaging.createSMS(
|
||||
topics: [], // optional
|
||||
users: [], // optional
|
||||
targets: [], // optional
|
||||
status: "draft", // optional
|
||||
draft: true, // optional
|
||||
scheduledAt: "" // optional
|
||||
)
|
||||
```
|
||||
|
||||
@@ -81,21 +81,15 @@ client
|
||||
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
||||
;
|
||||
|
||||
const promise = messaging.createSMS(
|
||||
const message = await messaging.createSMS(
|
||||
'[MESSAGE_ID]', // messageId
|
||||
'[CONTENT]', // content
|
||||
[], // topics (optional)
|
||||
[], // users (optional)
|
||||
[], // targets (optional)
|
||||
'draft', // status (optional)
|
||||
true, // draft (optional)
|
||||
'' // scheduledAt (optional)
|
||||
);
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response);
|
||||
}, function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
```
|
||||
```deno
|
||||
import * as sdk from "https://deno.land/x/appwrite/mod.ts";
|
||||
@@ -111,21 +105,15 @@ client
|
||||
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
||||
;
|
||||
|
||||
const promise = messaging.createSMS(
|
||||
const message = await messaging.createSMS(
|
||||
'[MESSAGE_ID]', // messageId
|
||||
'[CONTENT]', // content
|
||||
[], // topics (optional)
|
||||
[], // users (optional)
|
||||
[], // targets (optional)
|
||||
'draft', // status (optional)
|
||||
true, // draft (optional)
|
||||
'' // scheduledAt (optional)
|
||||
);
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response);
|
||||
}, function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
```
|
||||
```php
|
||||
<?php
|
||||
@@ -149,7 +137,7 @@ $result = $messaging->createSMS(
|
||||
topics: [], // optional
|
||||
users: [], // optional
|
||||
targets: [], // optional
|
||||
status: 'draft', // optional
|
||||
draft: true, // optional
|
||||
scheduledAt: '' // optional
|
||||
);
|
||||
```
|
||||
@@ -173,7 +161,7 @@ result = messaging.create_sms(
|
||||
topics = [], # optional
|
||||
users = [], # optional
|
||||
targets = [], # optional
|
||||
status = 'draft', # optional
|
||||
draft = True, # optional
|
||||
scheduled_at = '' # optional
|
||||
)
|
||||
```
|
||||
@@ -195,7 +183,7 @@ response = messaging.create_sms(
|
||||
topics: [], # optional
|
||||
users: [], # optional
|
||||
targets: [], # optional
|
||||
status: 'draft', # optional
|
||||
draft: true, # optional
|
||||
scheduled_at: '' # optional
|
||||
)
|
||||
|
||||
@@ -219,11 +207,13 @@ Message result = await messaging.CreateSMS(
|
||||
topics: new List<string> {} // optional
|
||||
users: new List<string> {} // optional
|
||||
targets: new List<string> {} // optional
|
||||
status: "draft" // optional
|
||||
draft: true // optional
|
||||
scheduledAt: ""); // optional
|
||||
```
|
||||
```dart
|
||||
import 'package:dart_appwrite/dart_appwrite.dart';
|
||||
import 'package:dart_appwrite/enums.dart';
|
||||
import 'package:dart_appwrite/models.dart';
|
||||
|
||||
void main() { // Init SDK
|
||||
Client client = Client();
|
||||
@@ -241,7 +231,7 @@ void main() { // Init SDK
|
||||
topics: [], // optional
|
||||
users: [], // optional
|
||||
targets: [], // optional
|
||||
status: 'draft', // optional
|
||||
draft: true, // optional
|
||||
scheduledAt: '', // optional
|
||||
);
|
||||
|
||||
@@ -271,7 +261,7 @@ messaging.createSMS(
|
||||
listOf(), // topics (optional)
|
||||
listOf(), // users (optional)
|
||||
listOf(), // targets (optional)
|
||||
"draft", // status (optional)
|
||||
true, // draft (optional)
|
||||
"" // scheduledAt (optional)
|
||||
new CoroutineCallback<>((result, error) -> {
|
||||
if (error != null) {
|
||||
@@ -301,7 +291,7 @@ messaging.createSMS(
|
||||
listOf(), // topics (optional)
|
||||
listOf(), // users (optional)
|
||||
listOf(), // targets (optional)
|
||||
"draft", // status (optional)
|
||||
true, // draft (optional)
|
||||
"" // scheduledAt (optional)
|
||||
new CoroutineCallback<>((result, error) -> {
|
||||
if (error != null) {
|
||||
@@ -329,7 +319,7 @@ let message = try await messaging.createSMS(
|
||||
topics: [], // optional
|
||||
users: [], // optional
|
||||
targets: [], // optional
|
||||
status: "draft", // optional
|
||||
draft: true, // optional
|
||||
scheduledAt: "" // optional
|
||||
)
|
||||
```
|
||||
@@ -367,7 +357,7 @@ client
|
||||
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
||||
;
|
||||
|
||||
const promise = messaging.updateMsg91Provider(
|
||||
const message = await messaging.updateMsg91Provider(
|
||||
'[PROVIDER_ID]', // providerId
|
||||
'[NAME]', // name (optional)
|
||||
false, // enabled (optional)
|
||||
@@ -375,12 +365,6 @@ const promise = messaging.updateMsg91Provider(
|
||||
'[AUTH_KEY]', // authKey (optional)
|
||||
'[FROM]' // from (optional)
|
||||
);
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response);
|
||||
}, function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
```
|
||||
```deno
|
||||
import * as sdk from "https://deno.land/x/appwrite/mod.ts";
|
||||
@@ -396,7 +380,7 @@ client
|
||||
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
||||
;
|
||||
|
||||
const promise = messaging.updateMsg91Provider(
|
||||
const message = await messaging.updateMsg91Provider(
|
||||
'[PROVIDER_ID]', // providerId
|
||||
'[NAME]', // name (optional)
|
||||
false, // enabled (optional)
|
||||
@@ -404,12 +388,6 @@ const promise = messaging.updateMsg91Provider(
|
||||
'[AUTH_KEY]', // authKey (optional)
|
||||
'[FROM]' // from (optional)
|
||||
);
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response);
|
||||
}, function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
```
|
||||
```php
|
||||
<?php
|
||||
@@ -504,6 +482,8 @@ Provider result = await messaging.UpdateMsg91Provider(
|
||||
```
|
||||
```dart
|
||||
import 'package:dart_appwrite/dart_appwrite.dart';
|
||||
import 'package:dart_appwrite/enums.dart';
|
||||
import 'package:dart_appwrite/models.dart';
|
||||
|
||||
void main() { // Init SDK
|
||||
Client client = Client();
|
||||
|
||||
@@ -40,118 +40,333 @@ During development, you can add targets to existing accounts by navigating to **
|
||||

|
||||
{% /only_light %}
|
||||
|
||||
You can also implement forms in your app to collect contact information and add it as a target with the [createSubscriber](/docs/references/cloud/server-nodejs/messaging#createSubscriber) endpoint.
|
||||
You can also implement forms in your app to collect contact information and add it as a target with the [createTarget](/docs/references/cloud/server-nodejs/users#createTarget) endpoint.
|
||||
{% multicode %}
|
||||
```js
|
||||
const sdk = require('node-appwrite');
|
||||
|
||||
// Init SDK
|
||||
const client = new sdk.Client();
|
||||
|
||||
const messaging = new sdk.Messaging(client);
|
||||
|
||||
client
|
||||
const client = new sdk.Client()
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
.setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token
|
||||
;
|
||||
.setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key
|
||||
|
||||
const promise = messaging.createSubscriber(
|
||||
'[TOPIC_ID]', // topicId
|
||||
'[SUBSCRIBER_ID]', // subscriberId
|
||||
'[TARGET_ID]' // targetId
|
||||
);
|
||||
const users = new sdk.Users(client);
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response);
|
||||
}, function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
const target = await users.createTarget(
|
||||
'<USER_ID>', // userId
|
||||
'<TARGET_ID>', // targetId
|
||||
sdk.MessagingProviderType.Email, // providerType
|
||||
'<IDENTIFIER>', // identifier
|
||||
'<PROVIDER_ID>', // providerId (optional)
|
||||
'<NAME>' // name (optional)
|
||||
);
|
||||
```
|
||||
```deno
|
||||
import * as sdk from "https://deno.land/x/appwrite/mod.ts";
|
||||
|
||||
// Init SDK
|
||||
let client = new sdk.Client();
|
||||
|
||||
let messaging = new sdk.Messaging(client);
|
||||
|
||||
client
|
||||
const client = new sdk.Client()
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
.setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token
|
||||
;
|
||||
.setJWT('eyJhbVCJ9.eyJ...'); // Your secret JSON Web Token
|
||||
|
||||
const promise = messaging.createSubscriber(
|
||||
'[TOPIC_ID]', // topicId
|
||||
'[SUBSCRIBER_ID]', // subscriberId
|
||||
'[TARGET_ID]' // targetId
|
||||
);
|
||||
const users = new sdk.Users(client);
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response);
|
||||
}, function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
const target = await users.createTarget(
|
||||
'<USER_ID>', // userId
|
||||
'<TARGET_ID>', // targetId
|
||||
sdk.MessagingProviderType.Email, // providerType
|
||||
'<IDENTIFIER>', // identifier
|
||||
'<PROVIDER_ID>', // providerId (optional)
|
||||
'<NAME>' // name (optional)
|
||||
);
|
||||
```
|
||||
```php
|
||||
<?php
|
||||
|
||||
use Appwrite\Client;
|
||||
use Appwrite\Services\Messaging;
|
||||
use Appwrite\Services\Users;
|
||||
use Appwrite\Enums\MessagingProviderType;
|
||||
|
||||
$client = new Client();
|
||||
|
||||
$client
|
||||
$client = (new Client())
|
||||
->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
->setProject('5df5acd0d48c2') // Your project ID
|
||||
->setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token
|
||||
;
|
||||
->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key
|
||||
|
||||
$messaging = new Messaging($client);
|
||||
$users = new Users($client);
|
||||
|
||||
$result = $messaging->createSubscriber(
|
||||
topicId: '[TOPIC_ID]',
|
||||
subscriberId: '[SUBSCRIBER_ID]',
|
||||
targetId: '[TARGET_ID]'
|
||||
$target = $users->createTarget(
|
||||
userId: '<USER_ID>',
|
||||
targetId: '<TARGET_ID>',
|
||||
providerType: MessagingProviderType::EMAIL(),
|
||||
identifier: '<IDENTIFIER>',
|
||||
providerId: '<PROVIDER_ID>', // optional
|
||||
name: '<NAME>' // optional
|
||||
);
|
||||
```
|
||||
```python
|
||||
from appwrite.client import Client
|
||||
from appwrite.services.messaging import Messaging
|
||||
from appwrite.enums import MessagingProviderType
|
||||
|
||||
client = Client()
|
||||
client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
|
||||
client.set_project('5df5acd0d48c2') # Your project ID
|
||||
client.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
|
||||
|
||||
(client
|
||||
.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
|
||||
.set_project('5df5acd0d48c2') # Your project ID
|
||||
.set_jwt('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') # Your secret JSON Web Token
|
||||
)
|
||||
users = Users(client)
|
||||
|
||||
messaging = Messaging(client)
|
||||
|
||||
result = messaging.create_subscriber(
|
||||
topic_id = '[TOPIC_ID]',
|
||||
subscriber_id = '[SUBSCRIBER_ID]',
|
||||
target_id = '[TARGET_ID]'
|
||||
target = users.create_target(
|
||||
user_id = '<USER_ID>',
|
||||
target_id = '<TARGET_ID>',
|
||||
provider_type = MessagingProviderType.EMAIL,
|
||||
identifier = '<IDENTIFIER>',
|
||||
provider_id = '<PROVIDER_ID>', # optional
|
||||
name = '<NAME>' # optional
|
||||
)
|
||||
```
|
||||
```ruby
|
||||
require 'appwrite'
|
||||
|
||||
include Appwrite
|
||||
include Appwrite::Enums
|
||||
|
||||
client = Client.new
|
||||
.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
|
||||
.set_project('5df5acd0d48c2') # Your project ID
|
||||
.set_jwt('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') # Your secret JSON Web Token
|
||||
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
|
||||
|
||||
messaging = Messaging.new(client)
|
||||
users = Users.new(client)
|
||||
|
||||
response = messaging.create_subscriber(
|
||||
topic_id: '[TOPIC_ID]',
|
||||
subscriber_id: '[SUBSCRIBER_ID]',
|
||||
target_id: '[TARGET_ID]'
|
||||
target = users.create_target(
|
||||
user_id: '<USER_ID>',
|
||||
target_id: '<TARGET_ID>',
|
||||
provider_type: MessagingProviderType::EMAIL,
|
||||
identifier: '<IDENTIFIER>',
|
||||
provider_id: '<PROVIDER_ID>', # optional
|
||||
name: '<NAME>' # optional
|
||||
)
|
||||
|
||||
puts target.inspect
|
||||
```
|
||||
```csharp
|
||||
using Appwrite;
|
||||
using Appwrite.Services;
|
||||
using Appwrite.Models;
|
||||
using Appwrite.Enums;
|
||||
|
||||
Client client = new Client()
|
||||
.SetEndPoint("https://cloud.appwrite.io/v1") // Your API Endpoint
|
||||
.SetProject("5df5acd0d48c2") // Your project ID
|
||||
.SetKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
|
||||
|
||||
Users users = new Users(client);
|
||||
|
||||
Target target = await users.CreateTarget(
|
||||
userId: "<USER_ID>",
|
||||
targetId: "<TARGET_ID>",
|
||||
providerType: MessagingProviderType.Email,
|
||||
identifier: "<IDENTIFIER>",
|
||||
providerId: "<PROVIDER_ID>", // optional
|
||||
name: "<NAME>" // optional
|
||||
);
|
||||
```
|
||||
```dart
|
||||
import 'package:dart_appwrite/dart_appwrite.dart';
|
||||
import 'package:dart_appwrite/enums.dart';
|
||||
import 'package:dart_appwrite/models.dart';
|
||||
|
||||
Client client = Client()
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
.setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key
|
||||
|
||||
Users users = Users(client);
|
||||
|
||||
final target = await users.createTarget(
|
||||
userId: '<USER_ID>',
|
||||
targetId: '<TARGET_ID>',
|
||||
providerType: MessagingProviderType.email,
|
||||
identifier: '<IDENTIFIER>',
|
||||
providerId: '<PROVIDER_ID>', // (optional)
|
||||
name: '<NAME>', // (optional)
|
||||
);
|
||||
|
||||
```
|
||||
```kotlin
|
||||
import io.appwrite.Client
|
||||
import io.appwrite.coroutines.CoroutineCallback
|
||||
import io.appwrite.services.Users
|
||||
import io.appwrite.enums.MessagingProviderType
|
||||
|
||||
val client = Client()
|
||||
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
|
||||
|
||||
val users = Users(client)
|
||||
|
||||
val target = users.createTarget(
|
||||
userId = "<USER_ID>",
|
||||
targetId = "<TARGET_ID>",
|
||||
providerType = MessagingProviderType.EMAIL,
|
||||
identifier = "<IDENTIFIER>",
|
||||
providerId = "<PROVIDER_ID>", // optional
|
||||
name = "<NAME>" // optional
|
||||
)
|
||||
|
||||
```
|
||||
```java
|
||||
import io.appwrite.Client;
|
||||
import io.appwrite.coroutines.CoroutineCallback;
|
||||
import io.appwrite.services.Users;
|
||||
import io.appwrite.enums.MessagingProviderType;
|
||||
|
||||
Client client = new Client()
|
||||
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
.setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
|
||||
|
||||
Users users = new Users(client);
|
||||
|
||||
users.createTarget(
|
||||
"<USER_ID>", // userId
|
||||
"<TARGET_ID>", // targetId
|
||||
MessagingProviderType.EMAIL, // providerType
|
||||
"<IDENTIFIER>", // identifier
|
||||
"<PROVIDER_ID>", // providerId (optional)
|
||||
"<NAME>", // name (optional)
|
||||
new CoroutineCallback<>((target, error) -> {
|
||||
if (error != null) {
|
||||
error.printStackTrace();
|
||||
return;
|
||||
}
|
||||
|
||||
System.out.println(target);
|
||||
})
|
||||
);
|
||||
```
|
||||
```swift
|
||||
import Appwrite
|
||||
import AppwriteEnums
|
||||
|
||||
let client = Client()
|
||||
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
|
||||
|
||||
let users = Users(client)
|
||||
|
||||
let target = try await users.createTarget(
|
||||
userId: "<USER_ID>",
|
||||
targetId: "<TARGET_ID>",
|
||||
providerType: .email,
|
||||
identifier: "<IDENTIFIER>",
|
||||
providerId: "<PROVIDER_ID>", // optional
|
||||
name: "<NAME>" // optional
|
||||
)
|
||||
```
|
||||
{% /multicode %}
|
||||
{% multicode %}
|
||||
```js
|
||||
const sdk = require('node-appwrite');
|
||||
|
||||
const client = new sdk.Client()
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
.setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key
|
||||
|
||||
const users = new sdk.Users(client);
|
||||
|
||||
const response = await users.createTarget(
|
||||
'<USER_ID>', // userId
|
||||
'<TARGET_ID>', // targetId
|
||||
sdk.MessagingProviderType.Phone, // providerType
|
||||
'<IDENTIFIER>', // identifier
|
||||
'<PROVIDER_ID>', // providerId (optional)
|
||||
'<NAME>' // name (optional)
|
||||
);
|
||||
```
|
||||
```deno
|
||||
import * as sdk from "https://deno.land/x/appwrite/mod.ts";
|
||||
|
||||
const client = new sdk.Client()
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
.setJWT('eyJhbVCJ9.eyJ...'); // Your secret JSON Web Token
|
||||
|
||||
const users = new sdk.Users(client);
|
||||
|
||||
const response = await users.createTarget(
|
||||
'<USER_ID>', // userId
|
||||
'<TARGET_ID>', // targetId
|
||||
sdk.MessagingProviderType.Phone, // providerType
|
||||
'<IDENTIFIER>', // identifier
|
||||
'<PROVIDER_ID>', // providerId (optional)
|
||||
'<NAME>' // name (optional)
|
||||
);
|
||||
```
|
||||
```php
|
||||
<?php
|
||||
|
||||
use Appwrite\Client;
|
||||
use Appwrite\Services\Users;
|
||||
use Appwrite\Enums\MessagingProviderType;
|
||||
|
||||
$client = (new Client())
|
||||
->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
->setProject('5df5acd0d48c2') // Your project ID
|
||||
->setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key
|
||||
|
||||
$users = new Users($client);
|
||||
|
||||
$result = $users->createTarget(
|
||||
userId: '<USER_ID>',
|
||||
targetId: '<TARGET_ID>',
|
||||
providerType: MessagingProviderType::PHONE(),
|
||||
identifier: '<IDENTIFIER>',
|
||||
providerId: '<PROVIDER_ID>', // optional
|
||||
name: '<NAME>' // optional
|
||||
);
|
||||
```
|
||||
```python
|
||||
from appwrite.client import Client
|
||||
from appwrite.enums import MessagingProviderType
|
||||
|
||||
client = Client()
|
||||
client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
|
||||
client.set_project('5df5acd0d48c2') # Your project ID
|
||||
client.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
|
||||
|
||||
users = Users(client)
|
||||
|
||||
result = users.create_target(
|
||||
user_id = '<USER_ID>',
|
||||
target_id = '<TARGET_ID>',
|
||||
provider_type = MessagingProviderType.PHONE,
|
||||
identifier = '<IDENTIFIER>',
|
||||
provider_id = '<PROVIDER_ID>', # optional
|
||||
name = '<NAME>' # optional
|
||||
)
|
||||
```
|
||||
```ruby
|
||||
require 'appwrite'
|
||||
|
||||
include Appwrite
|
||||
include Appwrite::Enums
|
||||
|
||||
client = Client.new
|
||||
.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
|
||||
.set_project('5df5acd0d48c2') # Your project ID
|
||||
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
|
||||
|
||||
users = Users.new(client)
|
||||
|
||||
response = users.create_target(
|
||||
user_id: '<USER_ID>',
|
||||
target_id: '<TARGET_ID>',
|
||||
provider_type: MessagingProviderType::EMAIL,
|
||||
identifier: '<IDENTIFIER>',
|
||||
provider_id: '<PROVIDER_ID>', # optional
|
||||
name: '<NAME>' # optional
|
||||
)
|
||||
|
||||
puts response.inspect
|
||||
@@ -160,88 +375,89 @@ puts response.inspect
|
||||
using Appwrite;
|
||||
using Appwrite.Services;
|
||||
using Appwrite.Models;
|
||||
using Appwrite.Enums;
|
||||
|
||||
var client = new Client()
|
||||
Client client = new Client()
|
||||
.SetEndPoint("https://cloud.appwrite.io/v1") // Your API Endpoint
|
||||
.SetProject("5df5acd0d48c2") // Your project ID
|
||||
.SetJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ..."); // Your secret JSON Web Token
|
||||
.SetKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
|
||||
|
||||
var messaging = new Messaging(client);
|
||||
Users users = new Users(client);
|
||||
|
||||
Subscriber result = await messaging.CreateSubscriber(
|
||||
topicId: "[TOPIC_ID]",
|
||||
subscriberId: "[SUBSCRIBER_ID]",
|
||||
targetId: "[TARGET_ID]");
|
||||
Target result = await users.CreateTarget(
|
||||
userId: "<USER_ID>",
|
||||
targetId: "<TARGET_ID>",
|
||||
providerType: MessagingProviderType.PHONE,
|
||||
identifier: "<IDENTIFIER>",
|
||||
providerId: "<PROVIDER_ID>", // optional
|
||||
name: "<NAME>" // optional
|
||||
);
|
||||
```
|
||||
```dart
|
||||
import 'package:dart_appwrite/dart_appwrite.dart';
|
||||
import 'package:dart_appwrite/enums.dart';
|
||||
import 'package:dart_appwrite/models.dart';
|
||||
|
||||
void main() { // Init SDK
|
||||
Client client = Client();
|
||||
Messaging messaging = Messaging(client);
|
||||
|
||||
client
|
||||
Client client = Client()
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
.setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token
|
||||
;
|
||||
.setKey('919c2d18fb5d4...a2ae413da83346ad2'); // Your secret API key
|
||||
|
||||
Future result = messaging.createSubscriber(
|
||||
topicId: '[TOPIC_ID]',
|
||||
subscriberId: '[SUBSCRIBER_ID]',
|
||||
targetId: '[TARGET_ID]',
|
||||
);
|
||||
Users users = Users(client);
|
||||
|
||||
Target result = await users.createTarget(
|
||||
userId: '<USER_ID>',
|
||||
targetId: '<TARGET_ID>',
|
||||
providerType: MessagingProviderType.PHONE,
|
||||
identifier: '<IDENTIFIER>',
|
||||
providerId: '<PROVIDER_ID>', // (optional)
|
||||
name: '<NAME>', // (optional)
|
||||
);
|
||||
|
||||
result
|
||||
.then((response) {
|
||||
print(response);
|
||||
}).catchError((error) {
|
||||
print(error.response);
|
||||
});
|
||||
}
|
||||
```
|
||||
```kotlin
|
||||
import io.appwrite.Client;
|
||||
import io.appwrite.coroutines.CoroutineCallback;
|
||||
import io.appwrite.services.Messaging;
|
||||
import io.appwrite.Client
|
||||
import io.appwrite.coroutines.CoroutineCallback
|
||||
import io.appwrite.services.Users
|
||||
import io.appwrite.enums.MessagingProviderType
|
||||
|
||||
Client client = new Client()
|
||||
val client = Client()
|
||||
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
.setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ..."); // Your secret JSON Web Token
|
||||
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
|
||||
|
||||
Messaging messaging = new Messaging(client);
|
||||
val users = Users(client)
|
||||
|
||||
messaging.createSubscriber(
|
||||
"[TOPIC_ID]", // topicId
|
||||
"[SUBSCRIBER_ID]", // subscriberId
|
||||
"[TARGET_ID]" // targetId
|
||||
new CoroutineCallback<>((result, error) -> {
|
||||
if (error != null) {
|
||||
error.printStackTrace();
|
||||
return;
|
||||
}
|
||||
val response = users.createTarget(
|
||||
userId = "<USER_ID>",
|
||||
targetId = "<TARGET_ID>",
|
||||
providerType = MessagingProviderType.PHONE,
|
||||
identifier = "<IDENTIFIER>",
|
||||
providerId = "<PROVIDER_ID>", // optional
|
||||
name = "<NAME>" // optional
|
||||
)
|
||||
|
||||
System.out.println(result);
|
||||
})
|
||||
);
|
||||
```
|
||||
```java
|
||||
import io.appwrite.Client;
|
||||
import io.appwrite.coroutines.CoroutineCallback;
|
||||
import io.appwrite.services.Messaging;
|
||||
import io.appwrite.services.Users;
|
||||
import io.appwrite.enums.MessagingProviderType;
|
||||
|
||||
Client client = new Client()
|
||||
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
.setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ..."); // Your secret JSON Web Token
|
||||
.setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
|
||||
|
||||
Messaging messaging = new Messaging(client);
|
||||
Users users = new Users(client);
|
||||
|
||||
messaging.createSubscriber(
|
||||
"[TOPIC_ID]", // topicId
|
||||
"[SUBSCRIBER_ID]", // subscriberId
|
||||
"[TARGET_ID]" // targetId
|
||||
users.createTarget(
|
||||
"<USER_ID>", // userId
|
||||
"<TARGET_ID>", // targetId
|
||||
MessagingProviderType.PHONE, // providerType
|
||||
"<IDENTIFIER>", // identifier
|
||||
"<PROVIDER_ID>", // providerId (optional)
|
||||
"<NAME>", // name (optional)
|
||||
new CoroutineCallback<>((result, error) -> {
|
||||
if (error != null) {
|
||||
error.printStackTrace();
|
||||
@@ -254,18 +470,22 @@ messaging.createSubscriber(
|
||||
```
|
||||
```swift
|
||||
import Appwrite
|
||||
import AppwriteEnums
|
||||
|
||||
let client = Client()
|
||||
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
.setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...") // Your secret JSON Web Token
|
||||
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
|
||||
|
||||
let messaging = Messaging(client)
|
||||
let users = Users(client)
|
||||
|
||||
let subscriber = try await messaging.createSubscriber(
|
||||
topicId: "[TOPIC_ID]",
|
||||
subscriberId: "[SUBSCRIBER_ID]",
|
||||
targetId: "[TARGET_ID]"
|
||||
let target = try await users.createTarget(
|
||||
userId: "<USER_ID>",
|
||||
targetId: "<TARGET_ID>",
|
||||
providerType: .phone,
|
||||
identifier: "<IDENTIFIER>",
|
||||
providerId: "<PROVIDER_ID>", // optional
|
||||
name: "<NAME>" // optional
|
||||
)
|
||||
```
|
||||
{% /multicode %}
|
||||
@@ -297,16 +517,10 @@ client
|
||||
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
||||
;
|
||||
|
||||
const promise = messaging.createTopic(
|
||||
const topic = await messaging.createTopic(
|
||||
'[TOPIC_ID]', // topicId
|
||||
'[NAME]' // name
|
||||
);
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response);
|
||||
}, function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
```
|
||||
```deno
|
||||
import * as sdk from "https://deno.land/x/appwrite/mod.ts";
|
||||
@@ -322,16 +536,10 @@ client
|
||||
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
||||
;
|
||||
|
||||
const promise = messaging.createTopic(
|
||||
const topic = await messaging.createTopic(
|
||||
'[TOPIC_ID]', // topicId
|
||||
'[NAME]' // name
|
||||
);
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response);
|
||||
}, function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
```
|
||||
```php
|
||||
<?php
|
||||
@@ -410,6 +618,8 @@ Topic result = await messaging.CreateTopic(
|
||||
```
|
||||
```dart
|
||||
import 'package:dart_appwrite/dart_appwrite.dart';
|
||||
import 'package:dart_appwrite/enums.dart';
|
||||
import 'package:dart_appwrite/models.dart';
|
||||
|
||||
void main() { // Init SDK
|
||||
Client client = Client();
|
||||
@@ -503,7 +713,7 @@ let topic = try await messaging.createTopic(
|
||||
|
||||
# Send emails {% #send-emails %}
|
||||
You can send emails using a Server SDK.
|
||||
To send an email immediately, you can call the `createEmail` endpoint with `status` set to `'processing'` and `schedule` left empty.
|
||||
To send an email immediately, you can call the `createEmail` endpoint with `schedule` left empty.
|
||||
{% multicode %}
|
||||
```js
|
||||
const sdk = require('node-appwrite');
|
||||
@@ -519,7 +729,7 @@ client
|
||||
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
||||
;
|
||||
|
||||
const promise = messaging.createEmail(
|
||||
const message - await messaging.createEmail(
|
||||
'[MESSAGE_ID]', // messageId
|
||||
'[SUBJECT]', // subject
|
||||
'[CONTENT]', // content
|
||||
@@ -528,16 +738,10 @@ const promise = messaging.createEmail(
|
||||
[], // targets (optional)
|
||||
[], // cc (optional)
|
||||
[], // bcc (optional)
|
||||
'processing', // status (optional)
|
||||
false, // draft (optional)
|
||||
false, // html (optional)
|
||||
'' // scheduledAt (optional)
|
||||
);
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response);
|
||||
}, function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
```
|
||||
```deno
|
||||
import * as sdk from "https://deno.land/x/appwrite/mod.ts";
|
||||
@@ -553,7 +757,7 @@ client
|
||||
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
||||
;
|
||||
|
||||
const promise = messaging.createEmail(
|
||||
const message - await messaging.createEmail(
|
||||
'[MESSAGE_ID]', // messageId
|
||||
'[SUBJECT]', // subject
|
||||
'[CONTENT]', // content
|
||||
@@ -562,16 +766,10 @@ const promise = messaging.createEmail(
|
||||
[], // targets (optional)
|
||||
[], // cc (optional)
|
||||
[], // bcc (optional)
|
||||
'processing', // status (optional)
|
||||
false, // draft (optional)
|
||||
false, // html (optional)
|
||||
'' // scheduledAt (optional)
|
||||
);
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response);
|
||||
}, function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
```
|
||||
```php
|
||||
<?php
|
||||
@@ -598,7 +796,7 @@ $result = $messaging->createEmail(
|
||||
targets: [], // optional
|
||||
cc: [], // optional
|
||||
bcc: [], // optional
|
||||
status: 'processing', // optional
|
||||
draft: false, // optional
|
||||
html: false, // optional
|
||||
scheduledAt: '' // optional
|
||||
);
|
||||
@@ -626,7 +824,7 @@ result = messaging.create_email(
|
||||
targets = [], # optional
|
||||
cc = [], # optional
|
||||
bcc = [], # optional
|
||||
status = 'processing', # optional
|
||||
draft = False, # optional
|
||||
html = False, # optional
|
||||
scheduled_at = '' # optional
|
||||
)
|
||||
@@ -652,7 +850,7 @@ response = messaging.create_email(
|
||||
targets: [], # optional
|
||||
cc: [], # optional
|
||||
bcc: [], # optional
|
||||
status: 'processing', # optional
|
||||
draft: false, # optional
|
||||
html: false, # optional
|
||||
scheduled_at: '' # optional
|
||||
)
|
||||
@@ -680,12 +878,14 @@ Message result = await messaging.CreateEmail(
|
||||
targets: new List<string> {} // optional
|
||||
cc: new List<string> {} // optional
|
||||
bcc: new List<string> {} // optional
|
||||
status: "processing" // optional
|
||||
draft: false // optional
|
||||
html: false // optional
|
||||
scheduledAt: ""); // optional
|
||||
```
|
||||
```dart
|
||||
import 'package:dart_appwrite/dart_appwrite.dart';
|
||||
import 'package:dart_appwrite/enums.dart';
|
||||
import 'package:dart_appwrite/models.dart';
|
||||
|
||||
void main() { // Init SDK
|
||||
Client client = Client();
|
||||
@@ -706,7 +906,7 @@ void main() { // Init SDK
|
||||
targets: [], // optional
|
||||
cc: [], // optional
|
||||
bcc: [], // optional
|
||||
status: 'processing', // optional
|
||||
draft: false, // optional
|
||||
html: false, // optional
|
||||
scheduledAt: '', // optional
|
||||
);
|
||||
@@ -740,7 +940,7 @@ messaging.createEmail(
|
||||
listOf(), // targets (optional)
|
||||
listOf(), // cc (optional)
|
||||
listOf(), // bcc (optional)
|
||||
"processing", // status (optional)
|
||||
false, // draft (optional)
|
||||
false, // html (optional)
|
||||
"" // scheduledAt (optional)
|
||||
new CoroutineCallback<>((result, error) -> {
|
||||
@@ -774,7 +974,7 @@ messaging.createEmail(
|
||||
listOf(), // targets (optional)
|
||||
listOf(), // cc (optional)
|
||||
listOf(), // bcc (optional)
|
||||
"processing", // status (optional)
|
||||
false, // draft (optional)
|
||||
false, // html (optional)
|
||||
"" // scheduledAt (optional)
|
||||
new CoroutineCallback<>((result, error) -> {
|
||||
@@ -806,7 +1006,7 @@ let message = try await messaging.createEmail(
|
||||
targets: [], // optional
|
||||
cc: [], // optional
|
||||
bcc: [], // optional
|
||||
status: "processing", // optional
|
||||
draft: false, // optional
|
||||
html: xfalse, // optional
|
||||
scheduledAt: "" // optional
|
||||
)
|
||||
@@ -831,7 +1031,7 @@ client
|
||||
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
||||
;
|
||||
|
||||
const promise = messaging.createEmail(
|
||||
const message - await messaging.createEmail(
|
||||
'[MESSAGE_ID]', // messageId
|
||||
'[SUBJECT]', // subject
|
||||
'[CONTENT]', // content
|
||||
@@ -840,16 +1040,10 @@ const promise = messaging.createEmail(
|
||||
[], // targets (optional)
|
||||
[], // cc (optional)
|
||||
[], // bcc (optional)
|
||||
'scheduled', // status (optional)
|
||||
false, // draft (optional)
|
||||
false, // html (optional)
|
||||
'2025-02-13T22:01:00+0000' // scheduledAt (optional)
|
||||
);
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response);
|
||||
}, function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
```
|
||||
```deno
|
||||
import * as sdk from "https://deno.land/x/appwrite/mod.ts";
|
||||
@@ -865,7 +1059,7 @@ client
|
||||
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
||||
;
|
||||
|
||||
const promise = messaging.createEmail(
|
||||
const message - await messaging.createEmail(
|
||||
'[MESSAGE_ID]', // messageId
|
||||
'[SUBJECT]', // subject
|
||||
'[CONTENT]', // content
|
||||
@@ -874,16 +1068,10 @@ const promise = messaging.createEmail(
|
||||
[], // targets (optional)
|
||||
[], // cc (optional)
|
||||
[], // bcc (optional)
|
||||
'scheduled', // status (optional)
|
||||
false, // draft (optional)
|
||||
false, // html (optional)
|
||||
'2025-02-13T22:01:00+0000' // scheduledAt (optional)
|
||||
);
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response);
|
||||
}, function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
```
|
||||
```php
|
||||
<?php
|
||||
@@ -910,9 +1098,9 @@ $result = $messaging->createEmail(
|
||||
targets: [], // optional
|
||||
cc: [], // optional
|
||||
bcc: [], // optional
|
||||
status: 'scheduled', // optional
|
||||
draft: false, // optional
|
||||
html: false, // optional
|
||||
scheduledAt: '2025-02-13T22:01:00+0000']// optional//
|
||||
scheduledAt: '2025-02-13T22:01:00+0000'
|
||||
);
|
||||
```
|
||||
```python
|
||||
@@ -938,9 +1126,9 @@ result = messaging.create_email(
|
||||
targets = [], # optional
|
||||
cc = [], # optional
|
||||
bcc = [], # optional
|
||||
status = 'scheduled', # optional
|
||||
draft = False, # optional
|
||||
html = False, # optional
|
||||
scheduled_at = '2025-02-13T22:01:00+0000' # optional
|
||||
scheduled_at = '2025-02-13T22:01:00+0000'
|
||||
)
|
||||
```
|
||||
```ruby
|
||||
@@ -964,9 +1152,9 @@ response = messaging.create_email(
|
||||
targets: [], # optional
|
||||
cc: [], # optional
|
||||
bcc: [], # optional
|
||||
status: 'scheduled', # optional
|
||||
draft: false, # optional
|
||||
html: false, # optional
|
||||
scheduled_at: '2025-02-13T22:01:00+0000' # optional
|
||||
scheduled_at: '2025-02-13T22:01:00+0000'
|
||||
)
|
||||
|
||||
puts response.inspect
|
||||
@@ -979,7 +1167,7 @@ using Appwrite.Models;
|
||||
var client = new Client()
|
||||
.SetEndPoint("https://cloud.appwrite.io/v1") // Your API Endpoint
|
||||
.SetProject("5df5acd0d48c2") // Your project ID
|
||||
.SetKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
|
||||
.SetKey("919c2d18fb5d4...a2ae413da83346ad2");// Your secret API key
|
||||
|
||||
var messaging = new Messaging(client);
|
||||
|
||||
@@ -992,12 +1180,14 @@ Message result = await messaging.CreateEmail(
|
||||
targets: new List<string> {} // optional
|
||||
cc: new List<string> {} // optional
|
||||
bcc: new List<string> {} // optional
|
||||
status: "scheduled" // optional
|
||||
draft: false // optional
|
||||
html: false // optional
|
||||
scheduledAt: "2025-02-13T22:01:00+0000"); // optional
|
||||
```
|
||||
```dart
|
||||
import 'package:dart_appwrite/dart_appwrite.dart';
|
||||
import 'package:dart_appwrite/enums.dart';
|
||||
import 'package:dart_appwrite/models.dart';
|
||||
|
||||
void main() { // Init SDK
|
||||
Client client = Client();
|
||||
@@ -1018,9 +1208,9 @@ void main() { // Init SDK
|
||||
targets: [], // optional
|
||||
cc: [], // optional
|
||||
bcc: [], // optional
|
||||
status: 'scheduled', // optional
|
||||
draft: false, // optional
|
||||
html: false, // optional
|
||||
scheduledAt: '2025-02-13T22:01:00+0000', // optional
|
||||
scheduledAt: '2025-02-13T22:01:00+0000',
|
||||
);
|
||||
|
||||
result
|
||||
@@ -1052,7 +1242,7 @@ messaging.createEmail(
|
||||
listOf(), // targets (optional)
|
||||
listOf(), // cc (optional)
|
||||
listOf(), // bcc (optional)
|
||||
"scheduled", // status (optional)
|
||||
false, // draft (optional)
|
||||
false, // html (optional)
|
||||
"2025-02-13T22:01:00+0000" // scheduledAt (optional)
|
||||
new CoroutineCallback<>((result, error) -> {
|
||||
@@ -1073,7 +1263,7 @@ import io.appwrite.services.Messaging;
|
||||
Client client = new Client()
|
||||
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
.setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
|
||||
.setKey("919c2d18fb5d4...a2ae413da83346ad2");// Your secret API key
|
||||
|
||||
Messaging messaging = new Messaging(client);
|
||||
|
||||
@@ -1086,9 +1276,9 @@ messaging.createEmail(
|
||||
listOf(), // targets (optional)
|
||||
listOf(), // cc (optional)
|
||||
listOf(), // bcc (optional)
|
||||
"scheduled", // status (optional)
|
||||
false, // draft (optional)
|
||||
false, // html (optional)
|
||||
"2025-02-13T22:01:00+0000" // scheduledAt (optional)
|
||||
"2025-02-13T22:01:00+0000"
|
||||
new CoroutineCallback<>((result, error) -> {
|
||||
if (error != null) {
|
||||
error.printStackTrace();
|
||||
@@ -1118,9 +1308,9 @@ let message = try await messaging.createEmail(
|
||||
targets: [], // optional
|
||||
cc: [], // optional
|
||||
bcc: [], // optional
|
||||
status: "scheduled", // optional
|
||||
draft: false, // optional
|
||||
html: xfalse, // optional
|
||||
scheduledAt: "2025-02-13T22:01:00+0000" // optional
|
||||
scheduledAt: "2025-02-13T22:01:00+0000"
|
||||
)
|
||||
```
|
||||
{% /multicode %}
|
||||
|
||||
@@ -516,7 +516,7 @@ client
|
||||
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
||||
;
|
||||
|
||||
const promise = messaging.createPush(
|
||||
const messaging = await messaging.createPush(
|
||||
'[MESSAGE_ID]', // messageId
|
||||
'[TITLE]', // title
|
||||
'[BODY]', // body
|
||||
@@ -530,15 +530,9 @@ const promise = messaging.createPush(
|
||||
'[COLOR]', // color (optional)
|
||||
'[TAG]', // tag (optional)
|
||||
'[BADGE]', // badge (optional)
|
||||
'draft', // status (optional)
|
||||
false, // draft (optional)
|
||||
'' // scheduledAt (optional)
|
||||
);
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response);
|
||||
}, function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
```
|
||||
```deno
|
||||
import * as sdk from "https://deno.land/x/appwrite/mod.ts";
|
||||
@@ -554,7 +548,7 @@ client
|
||||
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
||||
;
|
||||
|
||||
const promise = messaging.createPush(
|
||||
const messaging = await messaging.createPush(
|
||||
'[MESSAGE_ID]', // messageId
|
||||
'[TITLE]', // title
|
||||
'[BODY]', // body
|
||||
@@ -568,15 +562,9 @@ const promise = messaging.createPush(
|
||||
'[COLOR]', // color (optional)
|
||||
'[TAG]', // tag (optional)
|
||||
'[BADGE]', // badge (optional)
|
||||
'draft', // status (optional)
|
||||
false, // draft (optional)
|
||||
'' // scheduledAt (optional)
|
||||
);
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response);
|
||||
}, function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
```
|
||||
```php
|
||||
<?php
|
||||
@@ -608,7 +596,7 @@ $result = $messaging->createPush(
|
||||
color: '[COLOR]', // optional
|
||||
tag: '[TAG]', // optional
|
||||
badge: '[BADGE]', // optional
|
||||
status: 'draft', // optional
|
||||
draft: false, // optional
|
||||
scheduledAt: '' // optional
|
||||
);
|
||||
```
|
||||
@@ -640,7 +628,7 @@ result = messaging.create_push(
|
||||
color = '[COLOR]', # optional
|
||||
tag = '[TAG]', # optional
|
||||
badge = '[BADGE]', # optional
|
||||
status = 'draft', # optional
|
||||
draft = False, # optional
|
||||
scheduled_at = '' # optional
|
||||
)
|
||||
```
|
||||
@@ -670,7 +658,7 @@ response = messaging.create_push(
|
||||
color: '[COLOR]', # optional
|
||||
tag: '[TAG]', # optional
|
||||
badge: '[BADGE]', # optional
|
||||
status: 'draft', # optional
|
||||
draft: false, # optional
|
||||
scheduled_at: '' # optional
|
||||
)
|
||||
|
||||
@@ -702,11 +690,13 @@ Message result = await messaging.CreatePush(
|
||||
color: "[COLOR]" // optional
|
||||
tag: "[TAG]" // optional
|
||||
badge: "[BADGE]" // optional
|
||||
status: "draft" // optional
|
||||
draft: false // optional
|
||||
scheduledAt: ""); // optional
|
||||
```
|
||||
```dart
|
||||
import 'package:dart_appwrite/dart_appwrite.dart';
|
||||
import 'package:dart_appwrite/enums.dart';
|
||||
import 'package:dart_appwrite/models.dart';
|
||||
|
||||
void main() { // Init SDK
|
||||
Client client = Client();
|
||||
@@ -732,7 +722,7 @@ void main() { // Init SDK
|
||||
color: '[COLOR]', // optional
|
||||
tag: '[TAG]', // optional
|
||||
badge: '[BADGE]', // optional
|
||||
status: 'draft', // optional
|
||||
draft: false, // optional
|
||||
scheduledAt: '', // optional
|
||||
);
|
||||
|
||||
@@ -769,7 +759,7 @@ val response = messaging.createPush(
|
||||
color = "[COLOR]", // optional
|
||||
tag = "[TAG]", // optional
|
||||
badge = "[BADGE]", // optional
|
||||
status = "draft", // optional
|
||||
draft = false, // optional
|
||||
scheduledAt = "" // optional
|
||||
)
|
||||
```
|
||||
@@ -799,7 +789,7 @@ messaging.createPush(
|
||||
"[COLOR]", // color (optional)
|
||||
"[TAG]", // tag (optional)
|
||||
"[BADGE]", // badge (optional)
|
||||
"draft", // status (optional)
|
||||
false, // draft (optional)
|
||||
"" // scheduledAt (optional)
|
||||
new CoroutineCallback<>((result, error) -> {
|
||||
if (error != null) {
|
||||
@@ -835,7 +825,7 @@ let message = try await messaging.createPush(
|
||||
color: "[COLOR]", // optional
|
||||
tag: "[TAG]", // optional
|
||||
badge: "[BADGE]", // optional
|
||||
status: "draft", // optional
|
||||
draft: false, // optional
|
||||
scheduledAt: "" // optional
|
||||
)
|
||||
```
|
||||
|
||||
@@ -96,13 +96,7 @@ client
|
||||
.setKey('<API_KEY>') // Your secret API key
|
||||
;
|
||||
|
||||
const promise = messaging.createEmail('<MESSAGE_ID>', '<SUBJECT>', '<CONTENT>');
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response);
|
||||
}, function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
const message - await messaging.createEmail('<MESSAGE_ID>', '<SUBJECT>', '<CONTENT>');
|
||||
```
|
||||
```deno
|
||||
import * as sdk from "https://deno.land/x/appwrite/mod.ts";
|
||||
@@ -119,13 +113,7 @@ client
|
||||
;
|
||||
|
||||
|
||||
let promise = messaging.createEmail('<MESSAGE_ID>', '<SUBJECT>', '<CONTENT>');
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response);
|
||||
}, function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
const messaging = await messaging.createEmail('<MESSAGE_ID>', '<SUBJECT>', '<CONTENT>');
|
||||
```
|
||||
```php
|
||||
<?php
|
||||
@@ -198,6 +186,8 @@ Message result = await messaging.CreateEmail(
|
||||
```
|
||||
```dart
|
||||
import 'package:dart_appwrite/dart_appwrite.dart';
|
||||
import 'package:dart_appwrite/enums.dart';
|
||||
import 'package:dart_appwrite/models.dart';
|
||||
|
||||
void main() { // Init SDK
|
||||
Client client = Client();
|
||||
@@ -316,7 +306,7 @@ client
|
||||
.setKey('<YOUR_API_KEY>') // Your secret API key
|
||||
;
|
||||
|
||||
const promise = messaging.updateMailgunProvider(
|
||||
const provider = await messaging.updateMailgunProvider(
|
||||
'[PROVIDER_ID]', // providerId
|
||||
'[NAME]', // name (optional)
|
||||
'[API_KEY]', // apiKey (optional)
|
||||
@@ -328,12 +318,6 @@ const promise = messaging.updateMailgunProvider(
|
||||
'[REPLY_TO_NAME]', // replyToName (optional)
|
||||
'[REPLY_TO_EMAIL]' // replyToEmail (optional)
|
||||
);
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response);
|
||||
}, function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
```
|
||||
```deno
|
||||
import * as sdk from "https://deno.land/x/appwrite/mod.ts";
|
||||
@@ -349,7 +333,7 @@ client
|
||||
.setKey('<YOUR_API_KEY>') // Your secret API key
|
||||
;
|
||||
|
||||
const promise = messaging.updateMailgunProvider(
|
||||
const provider = await messaging.updateMailgunProvider(
|
||||
'[PROVIDER_ID]', // providerId
|
||||
'[NAME]', // name (optional)
|
||||
'[API_KEY]', // apiKey (optional)
|
||||
@@ -361,12 +345,6 @@ const promise = messaging.updateMailgunProvider(
|
||||
'[REPLY_TO_NAME]', // replyToName (optional)
|
||||
'[REPLY_TO_EMAIL]' // replyToEmail (optional)
|
||||
);
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response);
|
||||
}, function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
```
|
||||
```php
|
||||
<?php
|
||||
@@ -477,6 +455,8 @@ Provider result = await messaging.UpdateMailgunProvider(
|
||||
```
|
||||
```dart
|
||||
import 'package:dart_appwrite/dart_appwrite.dart';
|
||||
import 'package:dart_appwrite/enums.dart';
|
||||
import 'package:dart_appwrite/models.dart';
|
||||
|
||||
void main() { // Init SDK
|
||||
Client client = Client();
|
||||
|
||||
@@ -102,13 +102,7 @@ client
|
||||
.setKey('<API_KEY>') // Your secret API key
|
||||
;
|
||||
|
||||
const promise = messaging.createEmail('<MESSAGE_ID>', '<SUBJECT>', '<CONTENT>');
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response);
|
||||
}, function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
cconst message - await messaging.createEmail('<MESSAGE_ID>', '<SUBJECT>', '<CONTENT>');
|
||||
```
|
||||
```deno
|
||||
import * as sdk from "https://deno.land/x/appwrite/mod.ts";
|
||||
@@ -124,13 +118,7 @@ client
|
||||
.setKey('<API_KEY>') // Your secret API key
|
||||
;
|
||||
|
||||
let promise = messaging.createEmail('<MESSAGE_ID>', '<SUBJECT>', '<CONTENT>');
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response);
|
||||
}, function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
const messaging = await messaging.createEmail('<MESSAGE_ID>', '<SUBJECT>', '<CONTENT>');
|
||||
```
|
||||
```php
|
||||
<?php
|
||||
@@ -203,6 +191,8 @@ Message result = await messaging.CreateEmail(
|
||||
```
|
||||
```dart
|
||||
import 'package:dart_appwrite/dart_appwrite.dart';
|
||||
import 'package:dart_appwrite/enums.dart';
|
||||
import 'package:dart_appwrite/models.dart';
|
||||
|
||||
void main() { // Init SDK
|
||||
Client client = Client();
|
||||
@@ -491,6 +481,8 @@ Provider result = await messaging.UpdateSendgridProvider(
|
||||
```
|
||||
```dart
|
||||
import 'package:dart_appwrite/dart_appwrite.dart';
|
||||
import 'package:dart_appwrite/enums.dart';
|
||||
import 'package:dart_appwrite/models.dart';
|
||||
|
||||
void main() { // Init SDK
|
||||
Client client = Client();
|
||||
|
||||
@@ -80,21 +80,15 @@ client
|
||||
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
||||
;
|
||||
|
||||
const promise = messaging.createSMS(
|
||||
const messaging = await messaging.createSMS(
|
||||
'[MESSAGE_ID]', // messageId
|
||||
'[CONTENT]', // content
|
||||
[], // topics (optional)
|
||||
[], // users (optional)
|
||||
[], // targets (optional)
|
||||
'draft', // status (optional)
|
||||
true, // draft (optional)
|
||||
'' // scheduledAt (optional)
|
||||
);
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response);
|
||||
}, function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
```
|
||||
```deno
|
||||
import * as sdk from "https://deno.land/x/appwrite/mod.ts";
|
||||
@@ -110,21 +104,15 @@ client
|
||||
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
||||
;
|
||||
|
||||
const promise = messaging.createSMS(
|
||||
const messaging = await messaging.createSMS(
|
||||
'[MESSAGE_ID]', // messageId
|
||||
'[CONTENT]', // content
|
||||
[], // topics (optional)
|
||||
[], // users (optional)
|
||||
[], // targets (optional)
|
||||
'draft', // status (optional)
|
||||
true, // draft (optional)
|
||||
'' // scheduledAt (optional)
|
||||
);
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response);
|
||||
}, function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
```
|
||||
```php
|
||||
<?php
|
||||
@@ -148,7 +136,7 @@ $result = $messaging->createSMS(
|
||||
topics: [], // optional
|
||||
users: [], // optional
|
||||
targets: [], // optional
|
||||
status: 'draft', // optional
|
||||
draft: true, // optional
|
||||
scheduledAt: '' // optional
|
||||
);
|
||||
```
|
||||
@@ -172,7 +160,7 @@ result = messaging.create_sms(
|
||||
topics = [], # optional
|
||||
users = [], # optional
|
||||
targets = [], # optional
|
||||
status = 'draft', # optional
|
||||
draft = True, # optional
|
||||
scheduled_at = '' # optional
|
||||
)
|
||||
```
|
||||
@@ -194,7 +182,7 @@ response = messaging.create_sms(
|
||||
topics: [], # optional
|
||||
users: [], # optional
|
||||
targets: [], # optional
|
||||
status: 'draft', # optional
|
||||
draft: true, # optional
|
||||
scheduled_at: '' # optional
|
||||
)
|
||||
|
||||
@@ -218,11 +206,13 @@ Message result = await messaging.CreateSMS(
|
||||
topics: new List<string> {} // optional
|
||||
users: new List<string> {} // optional
|
||||
targets: new List<string> {} // optional
|
||||
status: "draft" // optional
|
||||
draft: true // optional
|
||||
scheduledAt: ""); // optional
|
||||
```
|
||||
```dart
|
||||
import 'package:dart_appwrite/dart_appwrite.dart';
|
||||
import 'package:dart_appwrite/enums.dart';
|
||||
import 'package:dart_appwrite/models.dart';
|
||||
|
||||
void main() { // Init SDK
|
||||
Client client = Client();
|
||||
@@ -240,7 +230,7 @@ void main() { // Init SDK
|
||||
topics: [], // optional
|
||||
users: [], // optional
|
||||
targets: [], // optional
|
||||
status: 'draft', // optional
|
||||
draft: true, // optional
|
||||
scheduledAt: '', // optional
|
||||
);
|
||||
|
||||
@@ -270,7 +260,7 @@ messaging.createSMS(
|
||||
listOf(), // topics (optional)
|
||||
listOf(), // users (optional)
|
||||
listOf(), // targets (optional)
|
||||
"draft", // status (optional)
|
||||
true, // draft (optional)
|
||||
"" // scheduledAt (optional)
|
||||
new CoroutineCallback<>((result, error) -> {
|
||||
if (error != null) {
|
||||
@@ -300,7 +290,7 @@ messaging.createSMS(
|
||||
listOf(), // topics (optional)
|
||||
listOf(), // users (optional)
|
||||
listOf(), // targets (optional)
|
||||
"draft", // status (optional)
|
||||
true, // draft (optional)
|
||||
"" // scheduledAt (optional)
|
||||
new CoroutineCallback<>((result, error) -> {
|
||||
if (error != null) {
|
||||
@@ -328,7 +318,7 @@ let message = try await messaging.createSMS(
|
||||
topics: [], // optional
|
||||
users: [], // optional
|
||||
targets: [], // optional
|
||||
status: "draft", // optional
|
||||
draft: true, // optional
|
||||
scheduledAt: "" // optional
|
||||
)
|
||||
```
|
||||
@@ -365,7 +355,7 @@ client
|
||||
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
||||
;
|
||||
|
||||
const promise = messaging.updateTelesignProvider(
|
||||
const provider = await messaging.updateTelesignProvider(
|
||||
'[PROVIDER_ID]', // providerId
|
||||
'[NAME]', // name (optional)
|
||||
false, // enabled (optional)
|
||||
@@ -373,12 +363,6 @@ const promise = messaging.updateTelesignProvider(
|
||||
'[PASSWORD]', // password (optional)
|
||||
'[FROM]' // from (optional)
|
||||
);
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response);
|
||||
}, function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
```
|
||||
```deno
|
||||
import * as sdk from "https://deno.land/x/appwrite/mod.ts";
|
||||
@@ -394,7 +378,7 @@ client
|
||||
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
||||
;
|
||||
|
||||
const promise = messaging.updateTelesignProvider(
|
||||
const provider = await messaging.updateTelesignProvider(
|
||||
'[PROVIDER_ID]', // providerId
|
||||
'[NAME]', // name (optional)
|
||||
false, // enabled (optional)
|
||||
@@ -402,12 +386,6 @@ const promise = messaging.updateTelesignProvider(
|
||||
'[PASSWORD]', // password (optional)
|
||||
'[FROM]' // from (optional)
|
||||
);
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response);
|
||||
}, function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
```
|
||||
```php
|
||||
<?php
|
||||
@@ -502,6 +480,8 @@ Provider result = await messaging.UpdateTelesignProvider(
|
||||
```
|
||||
```dart
|
||||
import 'package:dart_appwrite/dart_appwrite.dart';
|
||||
import 'package:dart_appwrite/enums.dart';
|
||||
import 'package:dart_appwrite/models.dart';
|
||||
|
||||
void main() { // Init SDK
|
||||
Client client = Client();
|
||||
|
||||
@@ -80,21 +80,15 @@ client
|
||||
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
||||
;
|
||||
|
||||
const promise = messaging.createSMS(
|
||||
const messaging = await messaging.createSMS(
|
||||
'[MESSAGE_ID]', // messageId
|
||||
'[CONTENT]', // content
|
||||
[], // topics (optional)
|
||||
[], // users (optional)
|
||||
[], // targets (optional)
|
||||
'draft', // status (optional)
|
||||
true, // draft (optional)
|
||||
'' // scheduledAt (optional)
|
||||
);
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response);
|
||||
}, function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
```
|
||||
```deno
|
||||
import * as sdk from "https://deno.land/x/appwrite/mod.ts";
|
||||
@@ -110,21 +104,15 @@ client
|
||||
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
||||
;
|
||||
|
||||
const promise = messaging.createSMS(
|
||||
const messaging = await messaging.createSMS(
|
||||
'[MESSAGE_ID]', // messageId
|
||||
'[CONTENT]', // content
|
||||
[], // topics (optional)
|
||||
[], // users (optional)
|
||||
[], // targets (optional)
|
||||
'draft', // status (optional)
|
||||
true, // draft (optional)
|
||||
'' // scheduledAt (optional)
|
||||
);
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response);
|
||||
}, function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
```
|
||||
```php
|
||||
<?php
|
||||
@@ -148,7 +136,7 @@ $result = $messaging->createSMS(
|
||||
topics: [], // optional
|
||||
users: [], // optional
|
||||
targets: [], // optional
|
||||
status: 'draft', // optional
|
||||
draft: true, // optional
|
||||
scheduledAt: '' // optional
|
||||
);
|
||||
```
|
||||
@@ -172,7 +160,7 @@ result = messaging.create_sms(
|
||||
topics = [], # optional
|
||||
users = [], # optional
|
||||
targets = [], # optional
|
||||
status = 'draft', # optional
|
||||
draft = True, # optional
|
||||
scheduled_at = '' # optional
|
||||
)
|
||||
```
|
||||
@@ -194,7 +182,7 @@ response = messaging.create_sms(
|
||||
topics: [], # optional
|
||||
users: [], # optional
|
||||
targets: [], # optional
|
||||
status: 'draft', # optional
|
||||
draft: true, # optional
|
||||
scheduled_at: '' # optional
|
||||
)
|
||||
|
||||
@@ -218,11 +206,13 @@ Message result = await messaging.CreateSMS(
|
||||
topics: new List<string> {} // optional
|
||||
users: new List<string> {} // optional
|
||||
targets: new List<string> {} // optional
|
||||
status: "draft" // optional
|
||||
draft: true // optional
|
||||
scheduledAt: ""); // optional
|
||||
```
|
||||
```dart
|
||||
import 'package:dart_appwrite/dart_appwrite.dart';
|
||||
import 'package:dart_appwrite/enums.dart';
|
||||
import 'package:dart_appwrite/models.dart';
|
||||
|
||||
void main() { // Init SDK
|
||||
Client client = Client();
|
||||
@@ -240,7 +230,7 @@ void main() { // Init SDK
|
||||
topics: [], // optional
|
||||
users: [], // optional
|
||||
targets: [], // optional
|
||||
status: 'draft', // optional
|
||||
draft: true, // optional
|
||||
scheduledAt: '', // optional
|
||||
);
|
||||
|
||||
@@ -270,7 +260,7 @@ messaging.createSMS(
|
||||
listOf(), // topics (optional)
|
||||
listOf(), // users (optional)
|
||||
listOf(), // targets (optional)
|
||||
"draft", // status (optional)
|
||||
true, // draft (optional)
|
||||
"" // scheduledAt (optional)
|
||||
new CoroutineCallback<>((result, error) -> {
|
||||
if (error != null) {
|
||||
@@ -300,7 +290,7 @@ messaging.createSMS(
|
||||
listOf(), // topics (optional)
|
||||
listOf(), // users (optional)
|
||||
listOf(), // targets (optional)
|
||||
"draft", // status (optional)
|
||||
true, // draft (optional)
|
||||
"" // scheduledAt (optional)
|
||||
new CoroutineCallback<>((result, error) -> {
|
||||
if (error != null) {
|
||||
@@ -328,7 +318,7 @@ let message = try await messaging.createSMS(
|
||||
topics: [], // optional
|
||||
users: [], // optional
|
||||
targets: [], // optional
|
||||
status: "draft", // optional
|
||||
draft: true, // optional
|
||||
scheduledAt: "" // optional
|
||||
)
|
||||
```
|
||||
@@ -365,7 +355,7 @@ client
|
||||
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
||||
;
|
||||
|
||||
const promise = messaging.updateTextmagicProvider(
|
||||
const provider = await messaging.updateTextmagicProvider(
|
||||
'[PROVIDER_ID]', // providerId
|
||||
'[NAME]', // name (optional)
|
||||
false, // enabled (optional)
|
||||
@@ -373,12 +363,6 @@ const promise = messaging.updateTextmagicProvider(
|
||||
'[API_KEY]', // apiKey (optional)
|
||||
'[FROM]' // from (optional)
|
||||
);
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response);
|
||||
}, function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
```
|
||||
```deno
|
||||
import * as sdk from "https://deno.land/x/appwrite/mod.ts";
|
||||
@@ -394,7 +378,7 @@ client
|
||||
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
||||
;
|
||||
|
||||
const promise = messaging.updateTextmagicProvider(
|
||||
const provider = await messaging.updateTextmagicProvider(
|
||||
'[PROVIDER_ID]', // providerId
|
||||
'[NAME]', // name (optional)
|
||||
false, // enabled (optional)
|
||||
@@ -402,12 +386,6 @@ const promise = messaging.updateTextmagicProvider(
|
||||
'[API_KEY]', // apiKey (optional)
|
||||
'[FROM]' // from (optional)
|
||||
);
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response);
|
||||
}, function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
```
|
||||
```php
|
||||
<?php
|
||||
@@ -502,6 +480,8 @@ Provider result = await messaging.UpdateTextmagicProvider(
|
||||
```
|
||||
```dart
|
||||
import 'package:dart_appwrite/dart_appwrite.dart';
|
||||
import 'package:dart_appwrite/enums.dart';
|
||||
import 'package:dart_appwrite/models.dart';
|
||||
|
||||
void main() { // Init SDK
|
||||
Client client = Client();
|
||||
|
||||
@@ -58,17 +58,12 @@ client
|
||||
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
||||
;
|
||||
|
||||
const promise = messaging.createTopic(
|
||||
const topic = messaging.createTopic(
|
||||
'[TOPIC_ID]', // topicId
|
||||
'[NAME]', // name
|
||||
'[ROLES]' // permission roles for who can subscribe
|
||||
);
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response);
|
||||
}, function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
```
|
||||
```deno
|
||||
import * as sdk from "https://deno.land/x/appwrite/mod.ts";
|
||||
@@ -84,17 +79,11 @@ client
|
||||
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
||||
;
|
||||
|
||||
const promise = messaging.createTopic(
|
||||
const topic = messaging.createTopic(
|
||||
'[TOPIC_ID]', // topicId
|
||||
'[NAME]' // name
|
||||
'[NAME]', // name
|
||||
'[ROLES]' // permission roles for who can subscribe
|
||||
);
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response);
|
||||
}, function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
```
|
||||
```php
|
||||
<?php
|
||||
@@ -112,7 +101,7 @@ $client
|
||||
|
||||
$messaging = new Messaging($client);
|
||||
|
||||
$result = $messaging->createTopic(
|
||||
$topic = $messaging->createTopic(
|
||||
topicId: '[TOPIC_ID]',
|
||||
name: '[NAME]',
|
||||
subscribe: '[ROLES]' // permission roles for who can subscribe
|
||||
@@ -133,7 +122,7 @@ client = Client()
|
||||
|
||||
messaging = Messaging(client)
|
||||
|
||||
result = messaging.create_topic(
|
||||
topic = messaging.create_topic(
|
||||
topic_id = '[TOPIC_ID]',
|
||||
name = '[NAME]',
|
||||
subscribe = '[ROLES]' # permission roles for who can subscribe
|
||||
@@ -151,13 +140,13 @@ client = Client.new
|
||||
|
||||
messaging = Messaging.new(client)
|
||||
|
||||
response = messaging.create_topic(
|
||||
topic = messaging.create_topic(
|
||||
topic_id: '[TOPIC_ID]',
|
||||
name: '[NAME]',
|
||||
subscribe: '[ROLES]' # permission roles for who can subscribe
|
||||
)
|
||||
|
||||
puts response.inspect
|
||||
puts topic.inspect
|
||||
```
|
||||
```csharp
|
||||
using Appwrite;
|
||||
@@ -171,13 +160,15 @@ var client = new Client()
|
||||
|
||||
var messaging = new Messaging(client);
|
||||
|
||||
Topic result = await messaging.CreateTopic(
|
||||
Topic topic = await messaging.CreateTopic(
|
||||
topicId: "[TOPIC_ID]",
|
||||
name: "[NAME]",
|
||||
subscribe: "[ROLES]") // permission roles for who can subscribe
|
||||
```
|
||||
```dart
|
||||
import 'package:dart_appwrite/dart_appwrite.dart';
|
||||
import 'package:dart_appwrite/enums.dart';
|
||||
import 'package:dart_appwrite/models.dart';
|
||||
|
||||
void main() { // Init SDK
|
||||
Client client = Client();
|
||||
@@ -219,13 +210,13 @@ messaging.createTopic(
|
||||
"[TOPIC_ID]", // topicId
|
||||
"[NAME]" // name
|
||||
"[ROLES]" // permission roles for who can subscribe
|
||||
new CoroutineCallback<>((result, error) -> {
|
||||
new CoroutineCallback<>((topic, error) -> {
|
||||
if (error != null) {
|
||||
error.printStackTrace();
|
||||
return;
|
||||
}
|
||||
|
||||
System.out.println(result);
|
||||
System.out.println(topic);
|
||||
})
|
||||
);
|
||||
```
|
||||
@@ -245,13 +236,13 @@ messaging.createTopic(
|
||||
"[TOPIC_ID]", // topicId
|
||||
"[NAME]" // name
|
||||
"[ROLES]" // permission roles for who can subscribe
|
||||
new CoroutineCallback<>((result, error) -> {
|
||||
new CoroutineCallback<>((topic, error) -> {
|
||||
if (error != null) {
|
||||
error.printStackTrace();
|
||||
return;
|
||||
}
|
||||
|
||||
System.out.println(result);
|
||||
System.out.println(topic);
|
||||
})
|
||||
);
|
||||
```
|
||||
@@ -303,54 +294,34 @@ If you can't find the targets you'd like to add, see the [targets page](/docs/pr
|
||||
```js
|
||||
const sdk = require('node-appwrite');
|
||||
|
||||
// Init SDK
|
||||
const client = new sdk.Client();
|
||||
const client = new sdk.Client()
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
.setJWT('eyJhbVCJ9.eyJ...'); // Your secret JSON Web Token
|
||||
|
||||
const messaging = new sdk.Messaging(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
.setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token
|
||||
;
|
||||
|
||||
const promise = messaging.createSubscriber(
|
||||
const subscriber = await messaging.createSubscriber(
|
||||
'[TOPIC_ID]', // topicId
|
||||
'[SUBSCRIBER_ID]', // subscriberId
|
||||
'[TARGET_ID]' // targetId
|
||||
);
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response);
|
||||
}, function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
);
|
||||
```
|
||||
```deno
|
||||
import * as sdk from "https://deno.land/x/appwrite/mod.ts";
|
||||
|
||||
// Init SDK
|
||||
let client = new sdk.Client();
|
||||
|
||||
let messaging = new sdk.Messaging(client);
|
||||
|
||||
client
|
||||
const client = new sdk.Client()
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
.setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token
|
||||
;
|
||||
.setJWT('eyJhbVCJ9.eyJ...'); // Your secret JSON Web Token
|
||||
|
||||
const promise = messaging.createSubscriber(
|
||||
const messaging = new sdk.Messaging(client);
|
||||
|
||||
const subscriber = await messaging.createSubscriber(
|
||||
'[TOPIC_ID]', // topicId
|
||||
'[SUBSCRIBER_ID]', // subscriberId
|
||||
'[TARGET_ID]' // targetId
|
||||
);
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response);
|
||||
}, function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
);
|
||||
```
|
||||
```php
|
||||
<?php
|
||||
@@ -363,12 +334,11 @@ $client = new Client();
|
||||
$client
|
||||
->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
->setProject('5df5acd0d48c2') // Your project ID
|
||||
->setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token
|
||||
;
|
||||
->setJWT('eyJhbVCJ9.eyJ...'); // Your secret JSON Web Token
|
||||
|
||||
$messaging = new Messaging($client);
|
||||
|
||||
$result = $messaging->createSubscriber(
|
||||
$subscriber = $messaging->createSubscriber(
|
||||
topicId: '[TOPIC_ID]',
|
||||
subscriberId: '[SUBSCRIBER_ID]',
|
||||
targetId: '[TARGET_ID]'
|
||||
@@ -379,16 +349,13 @@ from appwrite.client import Client
|
||||
from appwrite.services.messaging import Messaging
|
||||
|
||||
client = Client()
|
||||
|
||||
(client
|
||||
.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
|
||||
.set_project('5df5acd0d48c2') # Your project ID
|
||||
.set_jwt('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') # Your secret JSON Web Token
|
||||
)
|
||||
client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
|
||||
client.set_project('5df5acd0d48c2') # Your project ID
|
||||
client.set_jwt('eyJhbVCJ9.eyJ...') # Your secret JSON Web Token
|
||||
|
||||
messaging = Messaging(client)
|
||||
|
||||
result = messaging.create_subscriber(
|
||||
subscriber = messaging.create_subscriber(
|
||||
topic_id = '[TOPIC_ID]',
|
||||
subscriber_id = '[SUBSCRIBER_ID]',
|
||||
target_id = '[TARGET_ID]'
|
||||
@@ -402,29 +369,27 @@ include Appwrite
|
||||
client = Client.new
|
||||
.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
|
||||
.set_project('5df5acd0d48c2') # Your project ID
|
||||
.set_jwt('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') # Your secret JSON Web Token
|
||||
.set_jwt('eyJhbVCJ9.eyJ...') # Your secret JSON Web Token
|
||||
|
||||
messaging = Messaging.new(client)
|
||||
|
||||
response = messaging.create_subscriber(
|
||||
subscriber = messaging.create_subscriber(
|
||||
topic_id: '[TOPIC_ID]',
|
||||
subscriber_id: '[SUBSCRIBER_ID]',
|
||||
target_id: '[TARGET_ID]'
|
||||
)
|
||||
|
||||
puts response.inspect
|
||||
```
|
||||
```csharp
|
||||
using Appwrite;
|
||||
using Appwrite.Services;
|
||||
using Appwrite.Models;
|
||||
|
||||
var client = new Client()
|
||||
Client client = new Client()
|
||||
.SetEndPoint("https://cloud.appwrite.io/v1") // Your API Endpoint
|
||||
.SetProject("5df5acd0d48c2") // Your project ID
|
||||
.SetJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ..."); // Your secret JSON Web Token
|
||||
.SetJWT("eyJhbVCJ9.eyJ..."); // Your secret JSON Web Token
|
||||
|
||||
var messaging = new Messaging(client);
|
||||
Messaging messaging = new Messaging(client);
|
||||
|
||||
Subscriber result = await messaging.CreateSubscriber(
|
||||
topicId: "[TOPIC_ID]",
|
||||
@@ -433,56 +398,39 @@ Subscriber result = await messaging.CreateSubscriber(
|
||||
```
|
||||
```dart
|
||||
import 'package:dart_appwrite/dart_appwrite.dart';
|
||||
import 'package:dart_appwrite/enums.dart';
|
||||
import 'package:dart_appwrite/models.dart';
|
||||
|
||||
void main() { // Init SDK
|
||||
Client client = Client();
|
||||
Messaging messaging = Messaging(client);
|
||||
|
||||
client
|
||||
Client client = Client()
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
.setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token
|
||||
;
|
||||
.setJWT('eyJhbVCJ9.eyJ...'); // Your secret JSON Web Token
|
||||
|
||||
Future result = messaging.createSubscriber(
|
||||
Messaging messaging = Messaging(client);
|
||||
|
||||
Subscriber subscriber result = await messaging.createSubscriber(
|
||||
topicId: '[TOPIC_ID]',
|
||||
subscriberId: '[SUBSCRIBER_ID]',
|
||||
targetId: '[TARGET_ID]',
|
||||
);
|
||||
|
||||
result
|
||||
.then((response) {
|
||||
print(response);
|
||||
}).catchError((error) {
|
||||
print(error.response);
|
||||
});
|
||||
}
|
||||
);
|
||||
```
|
||||
```kotlin
|
||||
import io.appwrite.Client;
|
||||
import io.appwrite.coroutines.CoroutineCallback;
|
||||
import io.appwrite.services.Messaging;
|
||||
|
||||
Client client = new Client()
|
||||
val client = Client()
|
||||
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
.setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ..."); // Your secret JSON Web Token
|
||||
.setJWT("eyJhbVCJ9.eyJ...") // Your secret JSON Web Token
|
||||
|
||||
Messaging messaging = new Messaging(client);
|
||||
val messaging = new Messaging(client)
|
||||
|
||||
messaging.createSubscriber(
|
||||
"[TOPIC_ID]", // topicId
|
||||
"[SUBSCRIBER_ID]", // subscriberId
|
||||
"[TARGET_ID]" // targetId
|
||||
new CoroutineCallback<>((result, error) -> {
|
||||
if (error != null) {
|
||||
error.printStackTrace();
|
||||
return;
|
||||
}
|
||||
|
||||
System.out.println(result);
|
||||
})
|
||||
);
|
||||
val subscriber = messaging.createSubscriber(
|
||||
topicId = "[TOPIC_ID]",
|
||||
subscriberId = "[SUBSCRIBER_ID]",
|
||||
targetId = "[TARGET_ID]"
|
||||
)
|
||||
```
|
||||
```java
|
||||
import io.appwrite.Client;
|
||||
@@ -492,7 +440,7 @@ import io.appwrite.services.Messaging;
|
||||
Client client = new Client()
|
||||
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
.setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ..."); // Your secret JSON Web Token
|
||||
.setJWT("eyJhbVCJ9.eyJ..."); // Your secret JSON Web Token
|
||||
|
||||
Messaging messaging = new Messaging(client);
|
||||
|
||||
@@ -516,7 +464,7 @@ import Appwrite
|
||||
let client = Client()
|
||||
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
.setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...") // Your secret JSON Web Token
|
||||
.setJWT("eyJhbVCJ9.eyJ...") // Your secret JSON Web Token
|
||||
|
||||
let messaging = Messaging(client)
|
||||
|
||||
|
||||
@@ -81,21 +81,15 @@ client
|
||||
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
||||
;
|
||||
|
||||
const promise = messaging.createSMS(
|
||||
const message = await messaging.createSMS(
|
||||
'[MESSAGE_ID]', // messageId
|
||||
'[CONTENT]', // content
|
||||
[], // topics (optional)
|
||||
[], // users (optional)
|
||||
[], // targets (optional)
|
||||
'draft', // status (optional)
|
||||
true, // draft (optional)
|
||||
'' // scheduledAt (optional)
|
||||
);
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response);
|
||||
}, function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
```
|
||||
```deno
|
||||
import * as sdk from "https://deno.land/x/appwrite/mod.ts";
|
||||
@@ -111,21 +105,15 @@ client
|
||||
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
||||
;
|
||||
|
||||
const promise = messaging.createSMS(
|
||||
const message = await messaging.createSMS(
|
||||
'[MESSAGE_ID]', // messageId
|
||||
'[CONTENT]', // content
|
||||
[], // topics (optional)
|
||||
[], // users (optional)
|
||||
[], // targets (optional)
|
||||
'draft', // status (optional)
|
||||
true, // draft (optional)
|
||||
'' // scheduledAt (optional)
|
||||
);
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response);
|
||||
}, function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
```
|
||||
```php
|
||||
<?php
|
||||
@@ -149,7 +137,7 @@ $result = $messaging->createSMS(
|
||||
topics: [], // optional
|
||||
users: [], // optional
|
||||
targets: [], // optional
|
||||
status: 'draft', // optional
|
||||
draft: true, // optional
|
||||
scheduledAt: '' // optional
|
||||
);
|
||||
```
|
||||
@@ -173,7 +161,7 @@ result = messaging.create_sms(
|
||||
topics = [], # optional
|
||||
users = [], # optional
|
||||
targets = [], # optional
|
||||
status = 'draft', # optional
|
||||
draft = True, # optional
|
||||
scheduled_at = '' # optional
|
||||
)
|
||||
```
|
||||
@@ -195,7 +183,7 @@ response = messaging.create_sms(
|
||||
topics: [], # optional
|
||||
users: [], # optional
|
||||
targets: [], # optional
|
||||
status: 'draft', # optional
|
||||
draft: true, # optional
|
||||
scheduled_at: '' # optional
|
||||
)
|
||||
|
||||
@@ -219,11 +207,13 @@ Message result = await messaging.CreateSMS(
|
||||
topics: new List<string> {} // optional
|
||||
users: new List<string> {} // optional
|
||||
targets: new List<string> {} // optional
|
||||
status: "draft" // optional
|
||||
draft: true // optional
|
||||
scheduledAt: ""); // optional
|
||||
```
|
||||
```dart
|
||||
import 'package:dart_appwrite/dart_appwrite.dart';
|
||||
import 'package:dart_appwrite/enums.dart';
|
||||
import 'package:dart_appwrite/models.dart';
|
||||
|
||||
void main() { // Init SDK
|
||||
Client client = Client();
|
||||
@@ -241,7 +231,7 @@ void main() { // Init SDK
|
||||
topics: [], // optional
|
||||
users: [], // optional
|
||||
targets: [], // optional
|
||||
status: 'draft', // optional
|
||||
draft: true, // optional
|
||||
scheduledAt: '', // optional
|
||||
);
|
||||
|
||||
@@ -271,7 +261,7 @@ messaging.createSMS(
|
||||
listOf(), // topics (optional)
|
||||
listOf(), // users (optional)
|
||||
listOf(), // targets (optional)
|
||||
"draft", // status (optional)
|
||||
true, // draft (optional)
|
||||
"" // scheduledAt (optional)
|
||||
new CoroutineCallback<>((result, error) -> {
|
||||
if (error != null) {
|
||||
@@ -301,7 +291,7 @@ messaging.createSMS(
|
||||
listOf(), // topics (optional)
|
||||
listOf(), // users (optional)
|
||||
listOf(), // targets (optional)
|
||||
"draft", // status (optional)
|
||||
true, // draft (optional)
|
||||
"" // scheduledAt (optional)
|
||||
new CoroutineCallback<>((result, error) -> {
|
||||
if (error != null) {
|
||||
@@ -329,7 +319,7 @@ let message = try await messaging.createSMS(
|
||||
topics: [], // optional
|
||||
users: [], // optional
|
||||
targets: [], // optional
|
||||
status: "draft", // optional
|
||||
draft: true, // optional
|
||||
scheduledAt: "" // optional
|
||||
)
|
||||
```
|
||||
@@ -364,7 +354,7 @@ client
|
||||
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
||||
;
|
||||
|
||||
const promise = messaging.updateTwilioProvider(
|
||||
const provider = await messaging.updateTwilioProvider(
|
||||
'[PROVIDER_ID]', // providerId
|
||||
'[NAME]', // name (optional)
|
||||
false, // enabled (optional)
|
||||
@@ -372,12 +362,6 @@ const promise = messaging.updateTwilioProvider(
|
||||
'[AUTH_TOKEN]', // authToken (optional)
|
||||
'[FROM]' // from (optional)
|
||||
);
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response);
|
||||
}, function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
```
|
||||
```deno
|
||||
import * as sdk from "https://deno.land/x/appwrite/mod.ts";
|
||||
@@ -393,7 +377,7 @@ client
|
||||
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
||||
;
|
||||
|
||||
const promise = messaging.updateTwilioProvider(
|
||||
const provider = await messaging.updateTwilioProvider(
|
||||
'[PROVIDER_ID]', // providerId
|
||||
'[NAME]', // name (optional)
|
||||
false, // enabled (optional)
|
||||
@@ -401,12 +385,6 @@ const promise = messaging.updateTwilioProvider(
|
||||
'[AUTH_TOKEN]', // authToken (optional)
|
||||
'[FROM]' // from (optional)
|
||||
);
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response);
|
||||
}, function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
```
|
||||
```php
|
||||
<?php
|
||||
@@ -501,6 +479,8 @@ Provider result = await messaging.UpdateTwilioProvider(
|
||||
```
|
||||
```dart
|
||||
import 'package:dart_appwrite/dart_appwrite.dart';
|
||||
import 'package:dart_appwrite/enums.dart';
|
||||
import 'package:dart_appwrite/models.dart';
|
||||
|
||||
void main() { // Init SDK
|
||||
Client client = Client();
|
||||
|
||||
@@ -81,21 +81,15 @@ client
|
||||
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
||||
;
|
||||
|
||||
const promise = messaging.createSMS(
|
||||
const message = await messaging.createSMS(
|
||||
'[MESSAGE_ID]', // messageId
|
||||
'[CONTENT]', // content
|
||||
[], // topics (optional)
|
||||
[], // users (optional)
|
||||
[], // targets (optional)
|
||||
'draft', // status (optional)
|
||||
true, // draft (optional)
|
||||
'' // scheduledAt (optional)
|
||||
);
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response);
|
||||
}, function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
```
|
||||
```deno
|
||||
import * as sdk from "https://deno.land/x/appwrite/mod.ts";
|
||||
@@ -111,21 +105,15 @@ client
|
||||
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
||||
;
|
||||
|
||||
const promise = messaging.createSMS(
|
||||
const message = await messaging.createSMS(
|
||||
'[MESSAGE_ID]', // messageId
|
||||
'[CONTENT]', // content
|
||||
[], // topics (optional)
|
||||
[], // users (optional)
|
||||
[], // targets (optional)
|
||||
'draft', // status (optional)
|
||||
true, // draft (optional)
|
||||
'' // scheduledAt (optional)
|
||||
);
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response);
|
||||
}, function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
```
|
||||
```php
|
||||
<?php
|
||||
@@ -149,7 +137,7 @@ $result = $messaging->createSMS(
|
||||
topics: [], // optional
|
||||
users: [], // optional
|
||||
targets: [], // optional
|
||||
status: 'draft', // optional
|
||||
draft: true, // optional
|
||||
scheduledAt: '' // optional
|
||||
);
|
||||
```
|
||||
@@ -173,7 +161,7 @@ result = messaging.create_sms(
|
||||
topics = [], # optional
|
||||
users = [], # optional
|
||||
targets = [], # optional
|
||||
status = 'draft', # optional
|
||||
draft = True, # optional
|
||||
scheduled_at = '' # optional
|
||||
)
|
||||
```
|
||||
@@ -195,7 +183,7 @@ response = messaging.create_sms(
|
||||
topics: [], # optional
|
||||
users: [], # optional
|
||||
targets: [], # optional
|
||||
status: 'draft', # optional
|
||||
draft: true, # optional
|
||||
scheduled_at: '' # optional
|
||||
)
|
||||
|
||||
@@ -219,11 +207,13 @@ Message result = await messaging.CreateSMS(
|
||||
topics: new List<string> {} // optional
|
||||
users: new List<string> {} // optional
|
||||
targets: new List<string> {} // optional
|
||||
status: "draft" // optional
|
||||
draft: true // optional
|
||||
scheduledAt: ""); // optional
|
||||
```
|
||||
```dart
|
||||
import 'package:dart_appwrite/dart_appwrite.dart';
|
||||
import 'package:dart_appwrite/enums.dart';
|
||||
import 'package:dart_appwrite/models.dart';
|
||||
|
||||
void main() { // Init SDK
|
||||
Client client = Client();
|
||||
@@ -241,7 +231,7 @@ void main() { // Init SDK
|
||||
topics: [], // optional
|
||||
users: [], // optional
|
||||
targets: [], // optional
|
||||
status: 'draft', // optional
|
||||
draft: true, // optional
|
||||
scheduledAt: '', // optional
|
||||
);
|
||||
|
||||
@@ -271,7 +261,7 @@ messaging.createSMS(
|
||||
listOf(), // topics (optional)
|
||||
listOf(), // users (optional)
|
||||
listOf(), // targets (optional)
|
||||
"draft", // status (optional)
|
||||
true, // draft (optional)
|
||||
"" // scheduledAt (optional)
|
||||
new CoroutineCallback<>((result, error) -> {
|
||||
if (error != null) {
|
||||
@@ -301,7 +291,7 @@ messaging.createSMS(
|
||||
listOf(), // topics (optional)
|
||||
listOf(), // users (optional)
|
||||
listOf(), // targets (optional)
|
||||
"draft", // status (optional)
|
||||
true, // draft (optional)
|
||||
"" // scheduledAt (optional)
|
||||
new CoroutineCallback<>((result, error) -> {
|
||||
if (error != null) {
|
||||
@@ -329,7 +319,7 @@ let message = try await messaging.createSMS(
|
||||
topics: [], // optional
|
||||
users: [], // optional
|
||||
targets: [], // optional
|
||||
status: "draft", // optional
|
||||
draft: true, // optional
|
||||
scheduledAt: "" // optional
|
||||
)
|
||||
```
|
||||
@@ -366,7 +356,7 @@ client
|
||||
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
||||
;
|
||||
|
||||
const promise = messaging.updateVonageProvider(
|
||||
const provider = await messaging.updateVonageProvider(
|
||||
'[PROVIDER_ID]', // providerId
|
||||
'[NAME]', // name (optional)
|
||||
false, // enabled (optional)
|
||||
@@ -374,12 +364,6 @@ const promise = messaging.updateVonageProvider(
|
||||
'[API_SECRET]', // apiSecret (optional)
|
||||
'[FROM]' // from (optional)
|
||||
);
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response);
|
||||
}, function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
```
|
||||
```deno
|
||||
import * as sdk from "https://deno.land/x/appwrite/mod.ts";
|
||||
@@ -395,7 +379,7 @@ client
|
||||
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
||||
;
|
||||
|
||||
const promise = messaging.updateVonageProvider(
|
||||
const provider = await messaging.updateVonageProvider(
|
||||
'[PROVIDER_ID]', // providerId
|
||||
'[NAME]', // name (optional)
|
||||
false, // enabled (optional)
|
||||
@@ -403,12 +387,6 @@ const promise = messaging.updateVonageProvider(
|
||||
'[API_SECRET]', // apiSecret (optional)
|
||||
'[FROM]' // from (optional)
|
||||
);
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response);
|
||||
}, function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
```
|
||||
```php
|
||||
<?php
|
||||
@@ -503,6 +481,8 @@ Provider result = await messaging.UpdateVonageProvider(
|
||||
```
|
||||
```dart
|
||||
import 'package:dart_appwrite/dart_appwrite.dart';
|
||||
import 'package:dart_appwrite/enums.dart';
|
||||
import 'package:dart_appwrite/models.dart';
|
||||
|
||||
void main() { // Init SDK
|
||||
Client client = Client();
|
||||
|
||||
@@ -89,7 +89,13 @@
|
||||
icon: 'icon-android',
|
||||
image: '/images/blog/placeholder.png',
|
||||
href: 'android'
|
||||
}
|
||||
},
|
||||
{
|
||||
title: 'React Native',
|
||||
icon: 'icon-react',
|
||||
image: '/images/blog/placeholder.png',
|
||||
href: 'react-native'
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
141
src/routes/docs/quick-starts/react-native/+page.markdoc
Normal file
@@ -0,0 +1,141 @@
|
||||
---
|
||||
layout: article
|
||||
title: Start with React Native
|
||||
description: Build React Native apps on iOS, Android, and other native platforms with Appwrite and learn how to use our powerful backend to add authentication, user management, file storage, and more.
|
||||
difficulty: beginner
|
||||
readtime: 10
|
||||
back: /docs/quick-starts
|
||||
---
|
||||
|
||||
Learn how to setup your first React Native project powered by Appwrite.
|
||||
|
||||
{% info title="React for web" %}
|
||||
Looking to start with React for web?
|
||||
Follow the [React quickstart](/docs/quick-starts/react) and [React tutorial](/docs/tutorials/react/step-1) flows.
|
||||
{% /info %}
|
||||
|
||||
{% section #step-1 step=1 title="Create React Native project" %}
|
||||
Create a React Native project using [npx](https://www.npmjs.com/package/npx).
|
||||
|
||||
```sh
|
||||
npx react-native@latest init my_app && cd my_app
|
||||
```
|
||||
{% /section %}
|
||||
|
||||
{% section #step-2 step=2 title="Create project" %}
|
||||
Head to the [Appwrite Console](https://cloud.appwrite.io/console).
|
||||
|
||||
{% only_dark %}
|
||||

|
||||
{% /only_dark %}
|
||||
{% only_light %}
|
||||

|
||||
{% /only_light %}
|
||||
|
||||
If this is your first time using Appwrite, create an account and create your first project.
|
||||
|
||||
Then, under **Add a platform**, add a **Android app** or a **Apple app**.
|
||||
|
||||
{% tabs %}
|
||||
{% tabsitem #ios title="iOS" %}
|
||||
|
||||
Add your app **name** and **Bundle ID**. You can find your **Bundle Identifier** in the **General** tab for your app's primary target in XCode.
|
||||
|
||||
{% only_dark %}
|
||||

|
||||
{% /only_dark %}
|
||||
{% only_light %}
|
||||

|
||||
{% /only_light %}
|
||||
|
||||
{% /tabsitem %}
|
||||
|
||||
{% tabsitem #android title="Android" %}
|
||||
Add your app's **name** and **package name**, Your package name is generally the **applicationId** in your app-level [build.gradle](https://github.com/appwrite/playground-for-flutter/blob/master/android/app/build.gradle#L41) file.
|
||||
|
||||
{% arrow_link href="https://developer.android.com/build/configure-app-module" %}
|
||||
Learn more about Android app module
|
||||
{% /arrow_link %}
|
||||
{% /tabsitem %}
|
||||
|
||||
{% /tabs %}
|
||||
|
||||
You can skip optional steps.
|
||||
|
||||
{% /section %}
|
||||
|
||||
{% section #step-3 step=3 title="Install Appwrite" %}
|
||||
Install the Appwrite SDK for React Native and required dependencies.
|
||||
|
||||
```sh
|
||||
npm install react-native-appwrite react-native-fs react-native-url-polyfill --save
|
||||
```
|
||||
|
||||
On iOS, you will need to install cocoapod dependencies.
|
||||
|
||||
```sh
|
||||
cd iOS && pod install && cd ..
|
||||
```
|
||||
|
||||
{% /section %}
|
||||
|
||||
{% section #step-4 step=4 title="Import Appwrite" %}
|
||||
Find your project's ID in the **Settings** page.
|
||||
|
||||
{% only_dark %}
|
||||

|
||||
{% /only_dark %}
|
||||
{% only_light %}
|
||||

|
||||
{% /only_light %}
|
||||
|
||||
Open `index.js` and import `react-native-url-polyfill`.
|
||||
|
||||
```js
|
||||
import 'react-native-url-polyfill/auto'
|
||||
```
|
||||
|
||||
Open `App.tsx` and add the following code to it, replace `<YOUR_PROJECT_ID>` with your project ID and `<YOUR_PLATFORM>` with your application id or package name.
|
||||
|
||||
This imports and initializes Appwrite.
|
||||
|
||||
```js
|
||||
import { Client, Account, ID } from 'react-native-appwrite';
|
||||
|
||||
let client: Client;
|
||||
let account: Account;
|
||||
|
||||
function App(): React.JSX.Element {
|
||||
const isDarkMode = useColorScheme() === 'dark';
|
||||
|
||||
let setupAppwrite = async () => {
|
||||
client = new Client();
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/v1')
|
||||
.setProject('<YOUR_PROJECT_ID>')
|
||||
.setPlatform('<YOUR_PLATFORM>');
|
||||
|
||||
account = new Account(client);
|
||||
}
|
||||
}
|
||||
```
|
||||
{% /section %}
|
||||
{% section #step-5 step=5 title="Make first request" %}
|
||||
With `Client` and `Account` service initialized, you can now make your first requests to Appwrite.
|
||||
|
||||
```js
|
||||
let createUser = async () => {
|
||||
let user = await account.create(ID.unique(), 'example@email.com', 'strongPassword', 'Example user');
|
||||
console.log(user);
|
||||
}
|
||||
```
|
||||
|
||||
{% /section %}
|
||||
|
||||
{% section #step-6 step=6 title="All set" %}
|
||||
Run your project with `npm run ios` or `npm run android`.
|
||||
|
||||
{% arrow_link href="https://github.com/appwrite/playground-for-react-native" %}
|
||||
React Native playground
|
||||
{% /arrow_link %}
|
||||
{% /section %}
|
||||
@@ -8,6 +8,12 @@ back: /docs/quick-starts
|
||||
---
|
||||
|
||||
Learn how to setup your first React project powered by Appwrite.
|
||||
|
||||
{% info title="React Native" %}
|
||||
Looking to start with React Native?
|
||||
Follow the [React Native quickstart](/docs/quick-starts/react-native) to build apps for iOS, Android, and other native platforms.
|
||||
{% /info %}
|
||||
|
||||
{% section #step-1 step=1 title="Create project" %}
|
||||
Head to the [Appwrite Console](https://cloud.appwrite.io/console).
|
||||
|
||||
|
||||
@@ -0,0 +1,109 @@
|
||||
<script lang="ts">
|
||||
import type { SDKMethod } from '$lib/utils/specs';
|
||||
|
||||
export let method: SDKMethod;
|
||||
export let platformType: string;
|
||||
|
||||
const rateKeys = method['rate-key'];
|
||||
const rateTime = method['rate-time'];
|
||||
const rateLimit = method['rate-limit'];
|
||||
|
||||
enum RateKeys {
|
||||
'ip' = 'IP',
|
||||
'userId' = 'USER ID',
|
||||
'url' = 'URL',
|
||||
'phone' = 'PHONE',
|
||||
'token' = 'TOKEN',
|
||||
'method' = 'METHOD',
|
||||
'email' = 'EMAIL'
|
||||
}
|
||||
|
||||
function hasMultipleKeys(keys: string | string[]): keys is string[] {
|
||||
if (Array.isArray(keys)) {
|
||||
return true;
|
||||
} else return false;
|
||||
}
|
||||
|
||||
function parseKeys(keys: string) {
|
||||
if (!keys) return '';
|
||||
const keyValuePairs = keys.split(',');
|
||||
|
||||
return keyValuePairs
|
||||
.map((pair) => {
|
||||
const key = pair.split(':')[0] as keyof typeof RateKeys;
|
||||
return RateKeys[key];
|
||||
})
|
||||
.join(' + ');
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="aw-card is-normal u-padding-16">
|
||||
<div class="u-flex-vertical u-gap-24">
|
||||
<div class="u-flex-vertical u-gap-16">
|
||||
{#if platformType === 'CLIENT'}
|
||||
<p class="aw-sub-body-400">
|
||||
This endpoint is rate limited. You can only make a limited number of request to his
|
||||
endpoint within a specific time frame.
|
||||
</p>
|
||||
{:else }
|
||||
<p class="aw-sub-body-400">
|
||||
This endpoint is not limited when using Server SDKs with API keys. If you are using SSR
|
||||
with <code>setSession</code>, these rate limits will still apply.
|
||||
<a href="/docs/products/auth/server-side-rendering#rate-limits" class="u-link aw-u-color-text-primary">
|
||||
Learn more about SSR rate limits.
|
||||
</a>
|
||||
</p>
|
||||
{/if}
|
||||
<p class="aw-sub-body-400">The limit is applied for each unique limit key.</p>
|
||||
</div>
|
||||
<div class="aw-table-wrapper">
|
||||
<div class="aw-table-scroll is-remove-outer-styles">
|
||||
<table class="aw-table">
|
||||
<thead class="aw-table-header">
|
||||
<tr class="aw-table-row">
|
||||
<th class="aw-table-head-col">
|
||||
<div class="aw-eyebrow aw-u-color-text-primary">Time frame</div>
|
||||
</th>
|
||||
<th class="aw-table-head-col">
|
||||
<div class="aw-eyebrow aw-u-color-text-primary">Attempts</div>
|
||||
</th>
|
||||
<th class="aw-table-head-col">
|
||||
<div class="aw-eyebrow aw-u-color-text-primary">Key</div>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="aw-table-body">
|
||||
{#if hasMultipleKeys(rateKeys)}
|
||||
{#each rateKeys as key, i}
|
||||
<tr class="aw-table-row">
|
||||
<td class="aw-table-col">{Math.floor(rateTime / 60)} minutes</td
|
||||
>
|
||||
<td class="aw-table-col">{rateLimit} requests</td>
|
||||
<td class="aw-table-col">{parseKeys(key)}</td>
|
||||
</tr>
|
||||
{/each}
|
||||
{:else if typeof rateKeys === 'string'}
|
||||
<tr class="aw-table-row">
|
||||
<td class="aw-table-col">{Math.floor(rateTime / 60)} minutes</td>
|
||||
<td class="aw-table-col">{rateLimit} requests</td>
|
||||
<td class="aw-table-col">{parseKeys(rateKeys)}</td>
|
||||
</tr>
|
||||
{/if}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="">
|
||||
<a href="/docs/advanced/platform/rate-limits" class="u-link aw-u-color-text-primary">
|
||||
<span>Learn more about rate limits</span>
|
||||
<span class="aw-icon-arrow-right" aria-hidden="true"></span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.aw-card {
|
||||
margin-block-end: 2rem;
|
||||
}
|
||||
</style>
|
||||
@@ -25,6 +25,7 @@
|
||||
import { Accordion, AccordionItem } from '$lib/components/Accordion';
|
||||
import Request from './(components)/Request.svelte';
|
||||
import Response from './(components)/Response.svelte';
|
||||
import RateLimits from './(components)/RateLimits.svelte';
|
||||
|
||||
export let data;
|
||||
|
||||
@@ -204,6 +205,11 @@
|
||||
<AccordionItem title="Response">
|
||||
<Response {method} />
|
||||
</AccordionItem>
|
||||
{#if method?.['rate-limit'] > 0 && method?.['rate-key']?.length > 0}
|
||||
<AccordionItem title="Rate limits">
|
||||
<RateLimits {method} {platformType} />
|
||||
</AccordionItem>
|
||||
{/if}
|
||||
</Accordion>
|
||||
</div>
|
||||
<div class="web-article-content-grid-6-4-column-2 u-flex-vertical u-gap-32">
|
||||
|
||||
@@ -41,6 +41,12 @@ Client libraries for integrating with Appwrite to build client-based application
|
||||
* Android SDK `4.0.0`
|
||||
* [appwrite/sdk-for-android](https://github.com/appwrite/sdk-for-android)
|
||||
*
|
||||
---
|
||||
* {% only_dark %}{% icon_image src="/images/platforms/dark/react.svg" alt="React logo" size="m" /%}{% /only_dark %}
|
||||
{% only_light %}{% icon_image src="/images/platforms/react.svg" alt="React logo" size="m" /%}{% /only_light %}
|
||||
* React Native SDK `0.1.0`
|
||||
* [appwrite/sdk-for-react-native](https://github.com/appwrite/sdk-for-react-native)
|
||||
* `beta`
|
||||
{% /table %}
|
||||
|
||||
# Server {% #server %}
|
||||
|
||||
@@ -31,9 +31,7 @@ For a completely dependency-free installation, the CLI also ships with a conveni
|
||||
Using [Homebrew](https://brew.sh/)
|
||||
|
||||
```sh
|
||||
brew tap appwrite/sdk-for-cli https://github.com/appwrite/sdk-for-cli
|
||||
brew update
|
||||
brew install --HEAD appwrite
|
||||
brew install appwrite
|
||||
```
|
||||
|
||||
or terminal
|
||||
|
||||
@@ -27,6 +27,10 @@
|
||||
question: 'What happens if I reach a resource limit in my Starter plan?',
|
||||
answer: 'Your project will freeze, and Appwrite Console will continue running in read-only mode. You need to upgrade to Pro, remove resources that exceed their limit, or wait for the next billing cycle, which resets usage limits. <a class="web-link is-inline" href="/docs/advanced/platform/pro#reaching-resource-limits">Learn more in our docs</a>.'
|
||||
},
|
||||
{
|
||||
question: 'Why does Appwrite ask for payment verification for up to $150?',
|
||||
answer: 'The Reserve Bank of India (RBI) mandates additional security measures for recurring payments on Indian cards. Appwrite is obligated to ask for verification before billing your card. Appwrite asks for verification for up to $150 in case you use add-ons, but will not charge more than the actual amount used or your budget cap. If you need higher limits, <a class="aw-link is-inline" href="mailto:billing@appwrite.io">contact us</a>.'
|
||||
},
|
||||
{
|
||||
question: 'How can I join the OSS program?',
|
||||
answer: `The OSS program is exclusively for active open-source maintainers using Appwrite Cloud. You can find more information on how to join the program in our <a class="web-link is-inline" href="/blog/post/announcing-the-appwrite-oss-program">announcement blog</a>.`
|
||||
|
||||
@@ -74,6 +74,7 @@ What personal data we collect, why we collect it, and how it is used
|
||||
* Specific personal data we collect
|
||||
* - Full name
|
||||
- Email address
|
||||
- Phone number
|
||||
- IP address
|
||||
- Country
|
||||
- User-agent (info about the browser)
|
||||
@@ -82,7 +83,7 @@ What personal data we collect, why we collect it, and how it is used
|
||||
---
|
||||
* The purpose of data collection
|
||||
* - To be able to create an account
|
||||
- To be able to log in
|
||||
- To be able to log in using two-factor authentication
|
||||
- To be able to enjoy features available to registered users
|
||||
- To collect Informative reason for the administrator.
|
||||
- To better project development (identify reported problem)
|
||||
@@ -94,9 +95,11 @@ What personal data we collect, why we collect it, and how it is used
|
||||
* Consent
|
||||
---
|
||||
* Third parties with whom we share your personal data
|
||||
* 3rd party platforms such as for the following purposes:
|
||||
* 3rd party platforms such as:
|
||||
- Orbit
|
||||
* 3rd party platforms such as for the following purposes:
|
||||
- MSG91 (India only)
|
||||
- Twilio
|
||||
* 3rd party platforms such as:
|
||||
- Mailgun
|
||||
- Orbit
|
||||
- Hubspot
|
||||
@@ -133,7 +136,7 @@ What personal data we collect, why we collect it, and how it is used
|
||||
- Legitimate interest (e.g. to allow you to purchase Appwrite's swag products)
|
||||
---
|
||||
* Third parties with whom we share your personal data
|
||||
* 3rd party platforms such as for the following purposes:
|
||||
* 3rd party platforms such as:
|
||||
- Shopify
|
||||
- Printful
|
||||
- Paypal
|
||||
@@ -161,15 +164,9 @@ What personal data we collect, why we collect it, and how it is used
|
||||
- Legitimate interest (e.g. send you more information about Appwrite)
|
||||
---
|
||||
* Third parties with whom we share your personal data
|
||||
* 3rd party platforms such as for the following purposes:
|
||||
* 3rd party platforms such as:
|
||||
- Mailgun
|
||||
- Orbit
|
||||
- MSG91 (India only)
|
||||
- Twilio
|
||||
- Telesign
|
||||
- Textmagic
|
||||
- Vonage
|
||||
- Sendgrid
|
||||
---
|
||||
* Consequences of not providing the personal data
|
||||
* - Cannot add you to our mailing list
|
||||
@@ -201,7 +198,7 @@ What personal data we collect, why we collect it, and how it is used
|
||||
- Legitimate interest (e.g. process your job application)
|
||||
---
|
||||
* Third parties with whom we share your personal data
|
||||
* 3rd party platforms such as for the following purposes:
|
||||
* 3rd party platforms such as:
|
||||
- Homerun
|
||||
- LinkedIn Premium
|
||||
---
|
||||
@@ -232,7 +229,7 @@ What personal data we collect, why we collect it, and how it is used
|
||||
- Legitimate interest (e.g. respond to a query sent by you)
|
||||
---
|
||||
* Third parties with whom we share your personal data
|
||||
* 3rd party platforms such as for the following purposes:
|
||||
* 3rd party platforms such as:
|
||||
- HelpScout
|
||||
- Docusign (for DPAs)
|
||||
- Typeform
|
||||
@@ -266,7 +263,7 @@ What personal data we collect, why we collect it, and how it is used
|
||||
- Legitimate interest (e.g. process your fund application)
|
||||
---
|
||||
* Third parties with whom we share your personal data
|
||||
* 3rd party platforms such as for the following purposes:
|
||||
* 3rd party platforms such as:
|
||||
- GitHub
|
||||
- OpenCollective
|
||||
- Linear
|
||||
@@ -297,7 +294,7 @@ What personal data we collect, why we collect it, and how it is used
|
||||
* Depending on the context, legitimate interest (B2B marketing), pre-contractual discussions or consent
|
||||
---
|
||||
* Third parties with whom we share your personal data
|
||||
* 3rd party platforms such as for the following purposes:
|
||||
* 3rd party platforms such as:
|
||||
- Hubspot
|
||||
---
|
||||
* Consequences of not providing the personal data
|
||||
@@ -324,7 +321,7 @@ What personal data we collect, why we collect it, and how it is used
|
||||
* Depending on the context, legitimate interest (B2B marketing), pre-contractual discussions or consent
|
||||
---
|
||||
* Third parties with whom we share your personal data
|
||||
* 3rd party platforms such as for the following purposes:
|
||||
* 3rd party platforms such as:
|
||||
- Social media platforms (e.g. Facebook, GitHub, Twitter, LinkedIn, Discord)
|
||||
---
|
||||
* Consequences of not providing the personal data
|
||||
|
||||
@@ -20,3 +20,8 @@ body {
|
||||
/* focus styles */
|
||||
box-shadow: var(--focus-box-shadow);
|
||||
}
|
||||
|
||||
::selection {
|
||||
color: hsl(var(--aw-color-black)); -webkit-text-fill-color: hsl(var(--aw-color-black));
|
||||
background-color: hsl(var(--aw-color-mint-500)); background-clip:revert; -webkit-background-clip:revert;
|
||||
}
|
||||
@@ -11,5 +11,6 @@
|
||||
padding-inline: pxToRem(4);
|
||||
padding-block: pxToRem(1);
|
||||
border-radius: pxToRem(4);
|
||||
font-family: var(--web-font-family-fira-code);
|
||||
font-family: var(--aw-font-family-fira-code);
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
@@ -41,7 +41,27 @@
|
||||
}
|
||||
}
|
||||
&-head-col { padding:pxToRem(12); min-inline-size:pxToRem(180); }
|
||||
&-col { padding-block:pxToRem(19); padding-inline:pxToRem(12); }
|
||||
&-col {
|
||||
padding-block:pxToRem(19); padding-inline:pxToRem(12);
|
||||
img { max-inline-size:none; max-block-size:none; }
|
||||
}
|
||||
|
||||
/* state of table with-remove outer style */
|
||||
&-scroll:where(.is-remove-outer-styles) {
|
||||
border-width:0;
|
||||
--p-table-header-bg-color: 0 0 0 / 0;
|
||||
--p-table-row-bg-odd-color: 0 0 0 / 0;
|
||||
--p-table-row-bg-even-color: 0 0 0 / 0;
|
||||
border-block-end:solid pxToRem(1) hsl(var(--p-table-border-color));
|
||||
|
||||
.#{$p}-table {
|
||||
&-row { }
|
||||
&-head-col { padding-block-start:pxToRem(8); padding-block-end:pxToRem(16); }
|
||||
&-col { padding-block:pxToRem(16); }
|
||||
&-head-col:first-child { padding-inline-start:0; }
|
||||
&-col:first-child { padding-inline-start:0; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
--p-font-size: var(--web-font-size-medium);
|
||||
--p-line-height: var(--web-line-height-md);
|
||||
--p-letter-spacing: var(--web-letter-spacing-tight);
|
||||
--p-font-weight: var(--web-font-weight-medium);
|
||||
--p-font-weight: var(--web-font-weight-regular);
|
||||
|
||||
font-family: var(--p-font-family);
|
||||
font-size: var(--p-font-size);
|
||||
|
||||
@@ -38,10 +38,9 @@
|
||||
&-code-snippet { margin-block-end:pxToRem(32); }
|
||||
}
|
||||
&-header {
|
||||
position:relative; display:flex; flex-wrap:wrap; align-items:center; gap:pxToRem(16);
|
||||
position:relative; display:flex; flex-wrap:wrap; align-items:start; gap:pxToRem(16);
|
||||
.#{$p}-numeric-badge {
|
||||
|
||||
@media #{$break2open} { position:absolute; transform:translateX(calc(calc(-100% - pxToRem(16) ) * var(--transform-direction) )); }
|
||||
@media #{$break2open} { position:absolute; inset-block-start:pxToRem(2); transform:translateX(calc(calc(-100% - pxToRem(16) ) * var(--transform-direction) )); }
|
||||
}
|
||||
}
|
||||
&-section {
|
||||
|
||||
@@ -3,16 +3,18 @@
|
||||
|
||||
@mixin numeric-badge {
|
||||
--p-numeric-badge-text-color: var(--web-color-pink-500);
|
||||
--p-numeric-badge-bg-color: calc(var(--web-color-pink-hue) - 1) 68% 85%;
|
||||
|
||||
color: hsl(var(--p-numeric-badge-text-color));
|
||||
background:hsl(var(--p-numeric-badge-bg-color));
|
||||
|
||||
display:grid; place-content:center; user-select:none;
|
||||
min-inline-size:pxToRem(24); block-size:pxToRem(24); padding-inline:pxToRem(6);
|
||||
background:hsl(var(--web-color-pink-500) / 0.08);
|
||||
border:pxToRem(1) solid hsl(var(--web-color-pink-500) / 0.32); border-radius:pxToRem(6);
|
||||
font-size:pxToRem(14);
|
||||
|
||||
#{$theme-dark} & {
|
||||
--p-numeric-badge-text-color: var(--web-color-greyscale-100);
|
||||
--p-numeric-badge-bg-color: calc(var(--web-color-pink-hue) - 9) 22% 14%;
|
||||
}
|
||||
}
|
||||
BIN
static/images/blog/building-init-giveaway-app/cover.png
Normal file
|
After Width: | Height: | Size: 3.4 MiB |
BIN
static/images/blog/building-init-giveaway-app/discord.png
Normal file
|
After Width: | Height: | Size: 308 KiB |
BIN
static/images/blog/building-init-giveaway-app/signin.png
Normal file
|
After Width: | Height: | Size: 349 KiB |
BIN
static/images/blog/building-init-giveaway-app/winner.png
Normal file
|
After Width: | Height: | Size: 396 KiB |
BIN
static/images/changelog/2024-03-07.png
Normal file
|
After Width: | Height: | Size: 46 KiB |
BIN
static/images/changelog/2024-03-08.png
Normal file
|
After Width: | Height: | Size: 657 KiB |
|
Before Width: | Height: | Size: 338 KiB After Width: | Height: | Size: 353 KiB |
|
Before Width: | Height: | Size: 342 KiB After Width: | Height: | Size: 360 KiB |
|
Before Width: | Height: | Size: 338 KiB After Width: | Height: | Size: 353 KiB |
|
Before Width: | Height: | Size: 342 KiB After Width: | Height: | Size: 360 KiB |
@@ -8,7 +8,7 @@ version: '3'
|
||||
|
||||
services:
|
||||
traefik:
|
||||
image: traefik:2.9
|
||||
image: traefik:2.11
|
||||
container_name: appwrite-traefik
|
||||
<<: *x-logging
|
||||
command:
|
||||
@@ -34,7 +34,7 @@ services:
|
||||
- appwrite
|
||||
|
||||
appwrite:
|
||||
image: appwrite/appwrite:1.4.13
|
||||
image: appwrite/appwrite:1.5.1
|
||||
container_name: appwrite
|
||||
<<: *x-logging
|
||||
restart: unless-stopped
|
||||
@@ -64,7 +64,6 @@ services:
|
||||
- mariadb
|
||||
- redis
|
||||
# - clamav
|
||||
- influxdb
|
||||
environment:
|
||||
- _APP_ENV
|
||||
- _APP_WORKER_PER_CORE
|
||||
@@ -72,6 +71,7 @@ services:
|
||||
- _APP_CONSOLE_WHITELIST_ROOT
|
||||
- _APP_CONSOLE_WHITELIST_EMAILS
|
||||
- _APP_CONSOLE_WHITELIST_IPS
|
||||
- _APP_CONSOLE_HOSTNAMES
|
||||
- _APP_SYSTEM_EMAIL_NAME
|
||||
- _APP_SYSTEM_EMAIL_ADDRESS
|
||||
- _APP_SYSTEM_SECURITY_EMAIL_ADDRESS
|
||||
@@ -99,8 +99,6 @@ services:
|
||||
- _APP_SMTP_USERNAME
|
||||
- _APP_SMTP_PASSWORD
|
||||
- _APP_USAGE_STATS
|
||||
- _APP_INFLUXDB_HOST
|
||||
- _APP_INFLUXDB_PORT
|
||||
- _APP_STORAGE_LIMIT
|
||||
- _APP_STORAGE_PREVIEW_LIMIT
|
||||
- _APP_STORAGE_ANTIVIRUS
|
||||
@@ -137,9 +135,8 @@ services:
|
||||
- _APP_EXECUTOR_HOST
|
||||
- _APP_LOGGING_PROVIDER
|
||||
- _APP_LOGGING_CONFIG
|
||||
- _APP_STATSD_HOST
|
||||
- _APP_STATSD_PORT
|
||||
- _APP_MAINTENANCE_INTERVAL
|
||||
- _APP_MAINTENANCE_DELAY
|
||||
- _APP_MAINTENANCE_RETENTION_EXECUTION
|
||||
- _APP_MAINTENANCE_RETENTION_CACHE
|
||||
- _APP_MAINTENANCE_RETENTION_ABUSE
|
||||
@@ -162,7 +159,7 @@ services:
|
||||
- _APP_ASSISTANT_OPENAI_API_KEY
|
||||
|
||||
appwrite-realtime:
|
||||
image: appwrite/appwrite:1.4.13
|
||||
image: appwrite/appwrite:1.5.1
|
||||
entrypoint: realtime
|
||||
container_name: appwrite-realtime
|
||||
<<: *x-logging
|
||||
@@ -206,7 +203,7 @@ services:
|
||||
- _APP_LOGGING_CONFIG
|
||||
|
||||
appwrite-worker-audits:
|
||||
image: appwrite/appwrite:1.4.13
|
||||
image: appwrite/appwrite:1.5.1
|
||||
entrypoint: worker-audits
|
||||
<<: *x-logging
|
||||
container_name: appwrite-worker-audits
|
||||
@@ -233,7 +230,7 @@ services:
|
||||
- _APP_LOGGING_CONFIG
|
||||
|
||||
appwrite-worker-webhooks:
|
||||
image: appwrite/appwrite:1.4.13
|
||||
image: appwrite/appwrite:1.5.1
|
||||
entrypoint: worker-webhooks
|
||||
<<: *x-logging
|
||||
container_name: appwrite-worker-webhooks
|
||||
@@ -256,7 +253,7 @@ services:
|
||||
- _APP_LOGGING_CONFIG
|
||||
|
||||
appwrite-worker-deletes:
|
||||
image: appwrite/appwrite:1.4.13
|
||||
image: appwrite/appwrite:1.5.1
|
||||
entrypoint: worker-deletes
|
||||
<<: *x-logging
|
||||
container_name: appwrite-worker-deletes
|
||||
@@ -312,7 +309,7 @@ services:
|
||||
- _APP_EXECUTOR_HOST
|
||||
|
||||
appwrite-worker-databases:
|
||||
image: appwrite/appwrite:1.4.13
|
||||
image: appwrite/appwrite:1.5.1
|
||||
entrypoint: worker-databases
|
||||
<<: *x-logging
|
||||
container_name: appwrite-worker-databases
|
||||
@@ -339,7 +336,7 @@ services:
|
||||
- _APP_LOGGING_CONFIG
|
||||
|
||||
appwrite-worker-builds:
|
||||
image: appwrite/appwrite:1.4.13
|
||||
image: appwrite/appwrite:1.5.1
|
||||
entrypoint: worker-builds
|
||||
<<: *x-logging
|
||||
container_name: appwrite-worker-builds
|
||||
@@ -403,7 +400,7 @@ services:
|
||||
- _APP_STORAGE_WASABI_BUCKET
|
||||
|
||||
appwrite-worker-certificates:
|
||||
image: appwrite/appwrite:1.4.13
|
||||
image: appwrite/appwrite:1.5.1
|
||||
entrypoint: worker-certificates
|
||||
<<: *x-logging
|
||||
container_name: appwrite-worker-certificates
|
||||
@@ -437,7 +434,7 @@ services:
|
||||
- _APP_LOGGING_CONFIG
|
||||
|
||||
appwrite-worker-functions:
|
||||
image: appwrite/appwrite:1.4.13
|
||||
image: appwrite/appwrite:1.5.1
|
||||
entrypoint: worker-functions
|
||||
<<: *x-logging
|
||||
container_name: appwrite-worker-functions
|
||||
@@ -474,7 +471,7 @@ services:
|
||||
- _APP_LOGGING_PROVIDER
|
||||
|
||||
appwrite-worker-mails:
|
||||
image: appwrite/appwrite:1.4.13
|
||||
image: appwrite/appwrite:1.5.1
|
||||
entrypoint: worker-mails
|
||||
<<: *x-logging
|
||||
container_name: appwrite-worker-mails
|
||||
@@ -502,7 +499,7 @@ services:
|
||||
- _APP_LOGGING_CONFIG
|
||||
|
||||
appwrite-worker-messaging:
|
||||
image: appwrite/appwrite:1.4.13
|
||||
image: appwrite/appwrite:1.5.1
|
||||
entrypoint: worker-messaging
|
||||
<<: *x-logging
|
||||
container_name: appwrite-worker-messaging
|
||||
@@ -514,17 +511,23 @@ services:
|
||||
environment:
|
||||
- _APP_ENV
|
||||
- _APP_WORKER_PER_CORE
|
||||
- _APP_OPENSSL_KEY_V1
|
||||
- _APP_REDIS_HOST
|
||||
- _APP_REDIS_PORT
|
||||
- _APP_REDIS_USER
|
||||
- _APP_REDIS_PASS
|
||||
- _APP_SMS_PROVIDER
|
||||
- _APP_SMS_FROM
|
||||
- _APP_DB_HOST
|
||||
- _APP_DB_PORT
|
||||
- _APP_DB_SCHEMA
|
||||
- _APP_DB_USER
|
||||
- _APP_DB_PASS
|
||||
- _APP_LOGGING_PROVIDER
|
||||
- _APP_LOGGING_CONFIG
|
||||
- _APP_SMS_FROM
|
||||
- _APP_SMS_PROVIDER
|
||||
|
||||
appwrite-worker-migrations:
|
||||
image: appwrite/appwrite:1.4.13
|
||||
image: appwrite/appwrite:1.5.1
|
||||
entrypoint: worker-migrations
|
||||
<<: *x-logging
|
||||
container_name: appwrite-worker-migrations
|
||||
@@ -555,7 +558,7 @@ services:
|
||||
- _APP_MIGRATIONS_FIREBASE_CLIENT_SECRET
|
||||
|
||||
appwrite-maintenance:
|
||||
image: appwrite/appwrite:1.4.13
|
||||
image: appwrite/appwrite:1.5.1
|
||||
entrypoint: maintenance
|
||||
<<: *x-logging
|
||||
container_name: appwrite-maintenance
|
||||
@@ -588,16 +591,16 @@ services:
|
||||
- _APP_MAINTENANCE_RETENTION_USAGE_HOURLY
|
||||
- _APP_MAINTENANCE_RETENTION_SCHEDULES
|
||||
|
||||
appwrite-usage:
|
||||
image: appwrite/appwrite:1.4.13
|
||||
entrypoint: usage
|
||||
container_name: appwrite-usage
|
||||
appwrite-worker-usage:
|
||||
image: appwrite/appwrite:1.5.1
|
||||
entrypoint: worker-usage
|
||||
container_name: appwrite-worker-usage
|
||||
<<: *x-logging
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
- appwrite
|
||||
depends_on:
|
||||
- influxdb
|
||||
- redis
|
||||
- mariadb
|
||||
environment:
|
||||
- _APP_ENV
|
||||
@@ -608,9 +611,6 @@ services:
|
||||
- _APP_DB_SCHEMA
|
||||
- _APP_DB_USER
|
||||
- _APP_DB_PASS
|
||||
- _APP_INFLUXDB_HOST
|
||||
- _APP_INFLUXDB_PORT
|
||||
- _APP_USAGE_AGGREGATION_INTERVAL
|
||||
- _APP_REDIS_HOST
|
||||
- _APP_REDIS_PORT
|
||||
- _APP_REDIS_USER
|
||||
@@ -618,11 +618,65 @@ services:
|
||||
- _APP_USAGE_STATS
|
||||
- _APP_LOGGING_PROVIDER
|
||||
- _APP_LOGGING_CONFIG
|
||||
- _APP_USAGE_AGGREGATION_INTERVAL
|
||||
|
||||
appwrite-schedule:
|
||||
image: appwrite/appwrite:1.4.13
|
||||
entrypoint: schedule
|
||||
container_name: appwrite-schedule
|
||||
appwrite-worker-usage-dump:
|
||||
image: appwrite/appwrite:1.5.1
|
||||
entrypoint: worker-usage-dump
|
||||
<<: *x-logging
|
||||
container_name: appwrite-worker-usage-dump
|
||||
networks:
|
||||
- appwrite
|
||||
depends_on:
|
||||
- redis
|
||||
- mariadb
|
||||
environment:
|
||||
- _APP_ENV
|
||||
- _APP_WORKER_PER_CORE
|
||||
- _APP_OPENSSL_KEY_V1
|
||||
- _APP_DB_HOST
|
||||
- _APP_DB_PORT
|
||||
- _APP_DB_SCHEMA
|
||||
- _APP_DB_USER
|
||||
- _APP_DB_PASS
|
||||
- _APP_REDIS_HOST
|
||||
- _APP_REDIS_PORT
|
||||
- _APP_REDIS_USER
|
||||
- _APP_REDIS_PASS
|
||||
- _APP_USAGE_STATS
|
||||
- _APP_LOGGING_PROVIDER
|
||||
- _APP_LOGGING_CONFIG
|
||||
- _APP_USAGE_AGGREGATION_INTERVAL
|
||||
|
||||
appwrite-scheduler-functions:
|
||||
image: appwrite/appwrite:1.5.1
|
||||
entrypoint: schedule-functions
|
||||
container_name: appwrite-scheduler-functions
|
||||
<<: *x-logging
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
- appwrite
|
||||
depends_on:
|
||||
- mariadb
|
||||
- redis
|
||||
environment:
|
||||
- _APP_ENV
|
||||
- _APP_WORKER_PER_CORE
|
||||
- _APP_OPENSSL_KEY_V1
|
||||
- _APP_REDIS_HOST
|
||||
- _APP_REDIS_PORT
|
||||
- _APP_REDIS_USER
|
||||
- _APP_REDIS_PASS
|
||||
- _APP_DB_HOST
|
||||
- _APP_DB_PORT
|
||||
- _APP_DB_SCHEMA
|
||||
- _APP_DB_USER
|
||||
- _APP_DB_PASS
|
||||
|
||||
appwrite-scheduler-messages:
|
||||
image: appwrite/appwrite:1.5.1
|
||||
entrypoint: schedule-messages
|
||||
container_name: appwrite-scheduler-messages
|
||||
<<: *x-logging
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
@@ -645,7 +699,7 @@ services:
|
||||
- _APP_DB_PASS
|
||||
|
||||
appwrite-assistant:
|
||||
image: appwrite/assistant:0.2.2
|
||||
image: appwrite/assistant:0.4.0
|
||||
container_name: appwrite-assistant
|
||||
<<: *x-logging
|
||||
restart: unless-stopped
|
||||
@@ -660,7 +714,7 @@ services:
|
||||
<<: *x-logging
|
||||
restart: unless-stopped
|
||||
stop_signal: SIGINT
|
||||
image: openruntimes/executor:0.4.5
|
||||
image: openruntimes/executor:0.4.9
|
||||
networks:
|
||||
- appwrite
|
||||
- runtimes
|
||||
@@ -705,7 +759,7 @@ services:
|
||||
- OPR_EXECUTOR_STORAGE_WASABI_BUCKET=$_APP_STORAGE_WASABI_BUCKET
|
||||
|
||||
mariadb:
|
||||
image: mariadb:10.7 # fix issues when upgrading using: mysql_upgrade -u root -p
|
||||
image: mariadb:10.11 # fix issues when upgrading using: mysql_upgrade -u root -p
|
||||
container_name: appwrite-mariadb
|
||||
<<: *x-logging
|
||||
restart: unless-stopped
|
||||
@@ -721,7 +775,7 @@ services:
|
||||
command: 'mysqld --innodb-flush-method=fsync'
|
||||
|
||||
redis:
|
||||
image: redis:7.0.4-alpine
|
||||
image: redis:7.2.4-alpine
|
||||
container_name: appwrite-redis
|
||||
<<: *x-logging
|
||||
restart: unless-stopped
|
||||
@@ -744,27 +798,6 @@ services:
|
||||
# volumes:
|
||||
# - appwrite-uploads:/storage/uploads
|
||||
|
||||
influxdb:
|
||||
image: appwrite/influxdb:1.5.0
|
||||
container_name: appwrite-influxdb
|
||||
<<: *x-logging
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
- appwrite
|
||||
volumes:
|
||||
- appwrite-influxdb:/var/lib/influxdb:rw
|
||||
|
||||
telegraf:
|
||||
image: appwrite/telegraf:1.4.0
|
||||
container_name: appwrite-telegraf
|
||||
<<: *x-logging
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
- appwrite
|
||||
environment:
|
||||
- _APP_INFLUXDB_HOST
|
||||
- _APP_INFLUXDB_PORT
|
||||
|
||||
networks:
|
||||
gateway:
|
||||
name: gateway
|
||||
@@ -781,5 +814,4 @@ volumes:
|
||||
appwrite-certificates:
|
||||
appwrite-functions:
|
||||
appwrite-builds:
|
||||
appwrite-influxdb:
|
||||
appwrite-config:
|
||||