ZAppwrite icon

ZAppwrite

Use Appwrite's API from inside N8N, updated by @ZachHandley

Overview

This node operation allows you to create a messaging provider configuration within the Appwrite platform via n8n. Messaging providers are services that enable sending messages such as emails, push notifications, or SMS through various third-party platforms (e.g., SMTP servers, Twilio, Sendgrid, Mailgun). By creating a provider, you register and configure the credentials and settings needed to send messages using that service.

Common scenarios include:

  • Setting up an SMTP server provider to send transactional emails.
  • Configuring a Twilio or Vonage provider for SMS messaging.
  • Adding a Firebase Cloud Messaging (FCM) or Apple Push Notification Service (APNS) provider for push notifications.
  • Integrating email delivery services like Sendgrid or Mailgun.

Practical example: You want to automate sending notification emails from your workflow. You create an SMTP provider with your mail server details, then use this provider in subsequent messaging operations to send emails.

Properties

Name Meaning
Provider Type The type of messaging provider to create. Options include: APNS (Apple Push), FCM (Firebase), Mailgun, MSG91, Sendgrid, SMTP, Telesign, Textmagic, Twilio, Vonage.
Provider ID Unique identifier for the provider. You can generate a random ID using unique() or provide a custom string.
Provider Name Human-readable name for the provider.

Additional fields depending on Provider Type:

  • SMTP

    • Host: SMTP server host address
    • Port: SMTP server port (default 587)
    • Username: SMTP username
    • Password: SMTP password
    • Encryption: None, SSL, or TLS
    • Auto TLS: Enable automatic TLS negotiation
    • Mailer: SMTP mailer name
  • Mailgun

    • API Key: Mailgun API key
    • Domain: Mailgun domain
    • EU Region: Whether to use Mailgun's EU region
    • From Name: Sender name
    • From Email: Sender email address
    • Reply To Name: Reply-to name
    • Reply To Email: Reply-to email address
  • MSG91

    • Template ID: MSG91 template ID
    • Sender ID: MSG91 sender ID
    • Auth Key: MSG91 authentication key
  • Sendgrid

    • API Key: Sendgrid API key
    • From Name: Sender name
    • From Email: Sender email address
    • Reply To Name: Reply-to name
    • Reply To Email: Reply-to email address
  • FCM (Firebase)

    • Service Account JSON: Firebase service account JSON object
  • APNS (Apple Push)

    • Auth Key: APNS authentication key
    • Auth Key ID: APNS auth key ID
    • Team ID: APNS team ID
    • Bundle ID: APNS bundle ID
    • Sandbox: Use APNS sandbox environment (boolean)
  • Telesign

    • From: Phone number to send from
    • Customer ID: Telesign customer ID
    • API Key: Telesign API key
  • Textmagic

    • From: Phone number to send from
    • Username: Textmagic username
    • API Key: Textmagic API key
  • Twilio

    • From: Phone number to send from
    • Account SID: Twilio account SID
    • Auth Token: Twilio auth token
  • Vonage

    • From: Phone number to send from
    • API Key: Vonage API key
    • API Secret: Vonage API secret

Additional Fields Collection (optional)

These fields apply generally to messaging providers and include:

Name Meaning
BCC Comma-separated list of BCC email addresses
CC Comma-separated list of CC email addresses
Draft Whether the message is a draft (boolean)
Enabled Whether the provider is enabled (boolean)
From Email Sender email address
From Name Sender name
HTML Whether email content is HTML (boolean)
Scheduled At Scheduled delivery time in ISO 8601 format
Targets Comma-separated list of target IDs
Topics Comma-separated list of topic IDs
Users Comma-separated list of user IDs

Output

The output is a JSON array containing the response from the Appwrite API after creating the messaging provider. This typically includes the full details of the newly created provider such as its ID, name, type, configuration, and status.

No binary data output is produced by this operation.

Example output snippet (simplified):

[
  {
    "providerId": "your-provider-id",
    "providerName": "My SMTP Provider",
    "providerType": "smtp",
    "config": {
      "host": "smtp.example.com",
      "port": 587,
      "username": "user",
      "encryption": "tls"
    },
    "enabled": true
  }
]

Dependencies

  • Requires an active Appwrite project with API access.
  • Requires an API key credential configured in n8n for authenticating with Appwrite.
  • The node uses the Appwrite SDK internally to communicate with the Appwrite backend.
  • Proper permissions must be granted to the API key to manage messaging providers.

Troubleshooting

  • Invalid Credentials or Permissions: If the API key lacks permissions or is invalid, the node will throw authentication errors. Ensure the API key has sufficient rights to create messaging providers.
  • Missing Required Fields: Omitting required fields like Provider ID, Provider Name, or specific provider configuration parameters will cause validation errors.
  • Incorrect Provider Configuration: Providing incorrect hostnames, ports, or keys for the chosen provider type may result in failures when sending messages later.
  • Duplicate Provider ID: Using a Provider ID that already exists will cause conflicts. Use unique() to generate unique IDs or ensure custom IDs are unique.
  • Malformed JSON for FCM Service Account: For FCM providers, the service account JSON must be valid JSON; otherwise, creation will fail.

To resolve errors, verify all required inputs, check API key permissions, and consult Appwrite documentation for provider-specific requirements.

Links and References

Discussion