Skip to content

Messaging

Targets_

Manage avenues of communication by targetting user's device, email, or phone number in your notification and messages.

3 min read

Raw

Targets are different ways a user can be reached. For example, a user might have two emails, a phone number as well as a phone and a tablet with your app installed. This means, the user has five different targets that you can deliver messages to.

Target overview
Target overview

Topics and targets

A user can have multiple targets, such as emails, phone numbers, and devices with your app installed. These targets can subscribe to a topic, so when messages are published to a topic, all subscribed targets receive the message.

Types of targets

There are three types of targets you can use to reach your targets.

Target TypeDescription
EmailAllows you to send emails to the user's email.
SMSAllows you to send SMS messages to the user's phone.
Push notificationAllows you to send push notifications to the user's device.

Add a target

Before you can send messages, make sure you have the appropriate targets added for your user.

Add email target

Verified emails for users that signed up with email password, magic URL, email OTP, and OAuth2 login will already have an email target.

Add SMS target

Verified phone numbers for users that signed up with Phone OTP login will already have a phone target.

Add push notification target

Push notifications require configuration on both the Appwrite platform and your client app's code.

  1. In your Firebase console, navigate to Settings > General > Your apps > add an iOS app.
  2. Register and download your google-services.json config file.
  3. Head to Apple Developer Member Center > Program resources > Certificates, Identifiers & Profiles > Keys. The key needs Apple Push Notification Service enabled.
  4. Create a new key, note down the key ID and download your key.
  5. In Firebase console, go to Settings* > Cloud Messaging > APNs authentication key > click Upload. Upload your key here.
  6. Add push notification capability to your app by clicking your root-level app in XCode > Signing & Capabilities > Capabilities > Search for Push Notifications.
  7. If using SwiftUI, disable swizzling by setting FirebaseAppDelegateProxyEnabled to NO in your Info.plist.

Enable Push Notification in XCode
Enable Push Notification in XCode

Was this page helpful?

Share what worked or what we should fix. Once approved, our agents automatically apply suggested updates to the docs.