HivePress Email Token Summary

Hey @everyone,

Just thought I’d quiz HivePress AI on Email Tokens and share the answer it provided, as there seems to be a lot of similar topics posted regarding this subject.

If any of the information isn’t 100% accurate, it would be good if @kseniia or @ihor could correct things, so there’s a ‘source of truth’, anyone can easily reference in the future.


At the moment, HivePress does not provide a comprehensive, official list of all available email tokens for every event. However, you can always see the available tokens for each email event by following these steps:

  1. Go to WP Dashboard → HivePress → Emails.
  2. Add or edit an email template.
  3. Select the desired Event and save.
  4. At the bottom of the page, in the Details section, you’ll see a list of tokens available for that specific email event.

General Information about Tokens

  • Simple tokens (with underscores, e.g. %user_name%, %listing_title%, %booking_dates%) can be used directly.
  • Object tokens (like %user%, %listing%, %vendor%, %booking%, %message%, etc.) require you to specify a field using dot notation, e.g. %user.first_name%, %listing.title%, %vendor.display_name%.

Example: Common Tokens by Email Event

Below are the most common tokens for frequently used email events. Please note that the actual tokens available may vary depending on your installed extensions and customizations.

1. Booking Confirmed (User & Vendor)

  • %user_name%
  • %listing_title%
  • %booking_dates%
  • %booking_url%
  • %user% (object)
  • %listing% (object)
  • %booking% (object)
  • %vendor% (object)

Examples of object tokens:

  • %user.first_name%
  • %listing.title%
  • %vendor.display_name%
  • %booking.number%
  • %booking.total% (if added via custom code)

2. Booking Declined

  • %user_name%
  • %listing_title%
  • %booking_dates%
  • %booking_url%
  • %decline_reason%
  • %user% (object)
  • %vendor% (object)
  • %listing% (object)
  • %booking% (object)

3. Message Received

  • %user_name%
  • %message_url%
  • %message_text%
  • %message% (object)
  • %sender% (object)
  • %recipient% (object)

4. Booking Reminder

  • %user_name%
  • %booking_number%
  • %booking_dates%
  • %booking_url%
  • %user% (object)
  • %listing% (object)
  • %booking% (object)

5. Listing Approved

  • %user_name%
  • %listing_url%
  • %listing% (object)

6. Other Events

Other events (like order received, registration, etc.) will have their own set of tokens, visible in the Details section as described above.


How to Use Custom Attribute Tokens

You can use custom attributes in emails without code if the attribute is added to a supported object (e.g., Listing, Vendor, User):

  • For a Listing custom attribute (e.g., contact_email), use:
    %listing.contact_email%
  • For a Vendor custom attribute (e.g., bank_number), use:
    %vendor.bank_number%
  • For a User custom attribute (e.g., phone), use:
    %user.phone%

Important:

  • The attribute must be created in the correct section (e.g., Vendors/Attributes for vendor attributes).
  • The object token must be available for the email event (check the Details section).

Adding Custom Tokens via Code

If you need a token that is not available by default, you can add it via a code snippet. For example, to add a vendor’s bank number to the booking confirmation email:

add_filter(
    'hivepress/v1/emails/booking_confirm_user',
    function ( $email_args ) {
        $booking = $email_args['tokens']['booking'];
        if ( $booking ) {
            $listing = $booking->get_listing();
            $vendor  = $listing->get_vendor();
            if ( $vendor ) {
                $email_args['tokens']['vendor_bank_number'] = $vendor->get_attribute('bank_number');
            }
        }
        return $email_args;
    },
    1000
);

You can then use %vendor_bank_number% in your email template.


Summary

  • Always check the Details section in HivePress > Emails for available tokens per event.
  • Use dot notation for object tokens to access fields and custom attributes.
  • Custom attributes can be used as tokens if they are assigned to the correct object.
  • For advanced tokens, a custom code snippet may be required.

I hope the community finds this useful!

Cheers,
Chris :victory_hand:

5 Likes

Hi @ChrisB,

Thanks for sharing! It would be really helpful for the community. We plan to improve the UI with prompts in a future update.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.