# Importing a collection via a Twise XML Feed

You can import a collection via a Twise XML feed. To add such a feed to your twise, go to `Edit Twise -> Content -> Collections -> Settings -> Import feed` and add the URL that points to the feed. The feed contents are going to be synced every 24 hours.

The XML feed should be of the formats shown in the examples below. In each feed, the `<document>` tag differs depending on the collection type. All fields unless specified otherwise are strings.

### Product XML feed

`Product` document requirements:

| Field                | Required | Description                                      |
| -------------------- | -------- | ------------------------------------------------ |
| `id`                 | no       | Product ID                                       |
| `title`              | yes      | Product Title                                    |
| `url`                | yes      | URL to product page                              |
| `description`        | no       | Product Description                              |
| `category`           | no       | Product Category                                 |
| `product_type`       | no       | General product type                             |
| `updated_at`         | no       | ISO-formatted date                               |
| `vendor`             | no       | Vendor name                                      |
| `tags`               | no       | List of product tags.                            |
| `media`              | no       | List of image URLs.                              |
| `available_for_sale` | no       | Boolean if product variant is available for sale |
| `price`              | no       | Decimal amount                                   |
| `currency`           | no       | ISO 3-letter currency code                       |

#### Example Products XML feed

```xml
<twise-feed version="1.0">
  <documents type="product">
    <document>
      <id>65f4a3b2c7d8e9f0a1b2c3d4</id>
      <title>Premium Wireless Headphones</title>
      <url>https://example.com/products/premium-wireless-headphones</url>
      <description>High-quality wireless headphones with noise cancellation and 30-hour battery life.</description>
      <category>Headphones</category>
      <product_type>Audio Equipment</product_type>
      <updated_at>2023-09-15T14:30:45+00:00</updated_at>
      <vendor>SoundTech</vendor>
      <available_for_sale>true</available_for_sale>
      <price>149.99</price>
      <currency>USD</currency>
      <tags>
        <tag>wireless</tag>
        <tag>noise-cancellation</tag>
        <tag>premium</tag>
        <tag>bluetooth</tag>
      </tags>
      <media>
        <image>https://example.com/images/headphones-main.jpg</image>
        <image>https://example.com/images/headphones-lifestyle.jpg</image>
        <image>https://example.com/images/headphones-features.jpg</image>
      </media>
    </document>
  </documents>
</twise-feed>
```

### Events XML Feed

`Event` document requirements:

| Field           | Required | Description                                                                                              |
| --------------- | -------- | -------------------------------------------------------------------------------------------------------- |
| `id`            | no       | Event ID                                                                                                 |
| `title`         | yes      | Event Title                                                                                              |
| `description`   | yes      | Event Description                                                                                        |
| `url`           | no       | URL to event page                                                                                        |
| `venue`         | no       | Event venue                                                                                              |
| `phone_number`  | no       | Contact phone number                                                                                     |
| `contact_email` | no       | Contact email                                                                                            |
| `address`       | no       | Event address                                                                                            |
| `city`          | no       | Event city name                                                                                          |
| `category`      | no       | Event category                                                                                           |
| `date_start`    | no       | Event start time (ISO date string). Can specify `date_start`without `date_end`if it is not a date range. |
| `date_end`      | no       | Event end time (ISO date string)                                                                         |
| `price`         | no       | Decimal amount for event ticket price                                                                    |
| `currency`      | no       | ISO 3-letter currency code                                                                               |
| `media`         | no       | List of image URLs                                                                                       |

#### Example Events XML feed

```xml
<twise-feed version="1.0">
  <documents type="event">
    <document>
      <id>event-001</id>
      <title>Music Festival 2023</title>
      <description>A grand music festival featuring top artists from around the world.</description>
      <url>https://example.com/events/music-festival-2023</url>
      <venue>Central Park</venue>
      <phone_number>+1234567890</phone_number>
      <contact_email>info@example.com</contact_email>
      <address>123 Main St, New York, NY</address>
      <city>New York</city>
      <category>Music</category>
      <date_start>2023-11-01T18:00:00+00:00</date_start>
      <date_end>2023-11-03T23:00:00+00:00</date_end>
      <price>99.99</price>
      <currency>USD</currency>
      <media>
        <image>https://example.com/images/music-festival.jpg</image>
      </media>
    </document>
    <document>
      <id>event-002</id>
      <title>Art Exhibition</title>
      <description>An exhibition showcasing contemporary art from emerging artists.</description>
      <url>https://example.com/events/art-exhibition</url>
      <venue>Art Gallery</venue>
      <phone_number>+0987654321</phone_number>
      <contact_email>contact@artgallery.com</contact_email>
      <address>456 Art St, San Francisco, CA</address>
      <city>San Francisco</city>
      <category>Art</category>
      <date_start>2023-12-05T10:00:00+00:00</date_start>
      <date_end>2023-12-20T18:00:00+00:00</date_end>
      <price>20.00</price>
      <currency>USD</currency>
      <media>
        <image>https://example.com/images/art-exhibition.jpg</image>
      </media>
    </document>
    <!-- Add more documents as needed -->
  </documents>
</twise-feed>
```

### Villas XML feed

`Villa`document requirements:

| Field          | Required | Description                                            |
| -------------- | -------- | ------------------------------------------------------ |
| `id`           | no       | Villa ID                                               |
| `title`        | yes      | Villa Title                                            |
| `url`          | yes      | URL to villa page                                      |
| `description`  | yes      | Villa Description                                      |
| `address`      | no       | Address                                                |
| `city`         | no       | City                                                   |
| `region`       | no       | Region                                                 |
| `country`      | no       | Country                                                |
| `latitude`     | no       | Latitude ('float' type)                                |
| `longitude`    | no       | Longitude ('float' type)                               |
| `neighborhood` | no       | Neighborhood                                           |
| `view_type`    | no       | Villa view type (e.g. 'oceanfront', 'beachview', etc.) |
| `guests`       | no       | Number of guests                                       |
| `rooms`        | no       | Number of bedrooms                                     |
| `bathrooms`    | no       | Number of bathrooms                                    |
| `price`        | no       | Decimal amount for villa nightly rate                  |
| `currency`     | no       | ISO 3-letter currency code                             |
| `features`     | no       | List of villa features                                 |
| `media`        | no       | List of image URLs                                     |

#### Example Villas XML feed

```xml
<twise-feed version="1.0">
  <documents type="villa">
    <document>
      <id>villa-001</id>
      <title>Luxury Beachfront Villa</title>
      <url>https://example.com/villas/luxury-beachfront-villa</url>
      <description>A stunning beachfront villa with breathtaking ocean views and modern amenities.</description>
      <address>123 Ocean Drive</address>
      <city>Miami</city>
      <region>Florida</region>
      <country>USA</country>
      <latitude>25.7617</latitude>
      <longitude>-80.1918</longitude>
      <neighborhood>South Beach</neighborhood>
      <view_type>Ocean</view_type>
      <guests>10</guests>
      <rooms>5</rooms>
      <bathrooms>4.5</bathrooms>
      <price>1500.00</price>
      <currency>USD</currency>
      <features>
        <feature>Private Pool</feature>
        <feature>Wi-Fi</feature>
        <feature>Gym</feature>
      </features>
      <media>
        <image>https://example.com/images/villa-beachfront.jpg</image>
        <image>https://example.com/images/villa-interior.jpg</image>
      </media>
    </document>
    <document>
      <id>villa-002</id>
      <title>Mountain Retreat Villa</title>
      <url>https://example.com/villas/mountain-retreat-villa</url>
      <description>A cozy villa nestled in the mountains, perfect for a peaceful getaway.</description>
      <address>456 Mountain Road</address>
      <city>Aspen</city>
      <region>Colorado</region>
      <country>USA</country>
      <latitude>39.1911</latitude>
      <longitude>-106.8175</longitude>
      <neighborhood>Snowmass</neighborhood>
      <view_type>Mountain</view_type>
      <guests>8</guests>
      <rooms>4</rooms>
      <bathrooms>3.0</bathrooms>
      <price>1200.00</price>
      <currency>USD</currency>
      <features>
        <feature>Fireplace</feature>
        <feature>Hot Tub</feature>
        <feature>Hiking Trails</feature>
      </features>
      <media>
        <image>https://example.com/images/villa-mountain.jpg</image>
        <image>https://example.com/images/villa-livingroom.jpg</image>
      </media>
    </document>
    <!-- Add more documents as needed -->
  </documents>
</twise-feed>
```

### Page or post feed example

Twise can also create a collection of pages and/or posts (from WordPress or any website).

```
<twise-feed version="1.0">
  <documents type="page">
    <document>
      <id>92f7d6e5a4b3c2d1e0f9a8b7</id>
      <title>OpenAI Unveils GPT-5 with Revolutionary Multimodal Capabilities</title>
      <content>OpenAI has officially announced GPT-5, their most advanced AI model to date. The new system demonstrates unprecedented capabilities in understanding and generating content across text, images, audio, and video simultaneously. Industry experts are calling it a quantum leap in artificial intelligence development.</content>
      <url>https://techjournal.com/openai-gpt5-announcement</url>
      <content_type>post</content_type>
      <excerpt>OpenAI's latest AI model breaks new ground with integrated multimodal processing capabilities.</excerpt>
      <featured_image>https://techjournal.com/images/gpt5-announcement.jpg</featured_image>
      <categories>
        <category>Artificial Intelligence</category>
        <category>Machine Learning</category>
      </categories>
      <tags>
        <tag>OpenAI</tag>
        <tag>GPT-5</tag>
        <tag>AI</tag>
        <tag>machine learning</tag>
      </tags>
    </document>
    <document>
      <id>83e2d1c0b9a8f7e6d5c4b3a2</id>
      <title>Quantum Computing Breakthrough Promises Encryption Revolution</title>
      <content>Researchers at MIT have achieved a major breakthrough in quantum computing stability, maintaining quantum coherence for over 10 minutes - a new record that brings practical quantum computing applications within reach. This development could revolutionize encryption technologies and accelerate scientific computing across multiple domains.</content>
      <url>https://techjournal.com/quantum-computing-breakthrough</url>
      <content_type>post</content_type>
      <excerpt>MIT researchers break quantum coherence records, bringing quantum computing closer to practical applications.</excerpt>
      <featured_image>https://techjournal.com/images/quantum-computer-lab.jpg</featured_image>
      <categories>
        <category>Quantum Computing</category>
        <category>Cybersecurity</category>
      </categories>
      <tags>
        <tag>quantum</tag>
        <tag>encryption</tag>
        <tag>MIT</tag>
        <tag>research</tag>
      </tags>
    </document>
    <document>
      <id>74c5b6a7d8e9f0a1b2c3d4e5</id>
      <title>Tesla Unveils Next-Generation Energy Storage System for Homes</title>
      <content>Tesla has announced its new Powerwall 4, featuring twice the energy density of previous models while reducing costs by 30%. The revolutionary home battery system integrates seamlessly with solar installations and can power an average home for up to five days during grid outages. Pre-orders have already exceeded 100,000 units within 24 hours of announcement.</content>
      <url>https://techjournal.com/tesla-powerwall-4-launch</url>
      <content_type>post</content_type>
      <excerpt>Tesla's latest home battery system doubles capacity while cutting costs by nearly a third.</excerpt>
      <featured_image>https://techjournal.com/images/powerwall-4-reveal.jpg</featured_image>
      <categories>
        <category>Clean Energy</category>
        <category>Smart Home</category>
      </categories>
      <tags>
        <tag>Tesla</tag>
        <tag>Powerwall</tag>
        <tag>renewable energy</tag>
        <tag>battery technology</tag>
      </tags>
    </document>
  </documents>
</twise-feed>
```
