Contact Search
To use the product database for contact search, you can follow these steps:
1. Upload your contacts
Upload your contacts to the product database using the LoyJoy
backend. Each contact should have a unique identifier, such as a contact
ID, and relevant information such as address, phone number, and email address.
Take special note of the title and description fields, as these are the ones
that will be shown in the chat interface. The title can be the name of the contact,
while the description can include the address and phone number. You can
also include a URL to the contact's website in the url field.
Example: Here is an example table you can use when uploading store locations to the product database:
| reference_id | title | description | city | zip_codes | phone_number | url | |
|---|---|---|---|---|---|---|---|
| 1 | Peter Newman | You can reach Peter Newman via phone [555-555-5555](tel:5555555555) or email [peter.newman@example.org](mailto:peter.newman@example.org) | peter.newman@example.org | Chicago | 60001,60002,60003 | 555-555-5555 | https://example.org/peter-newman |
| 2 | Kathy Smith | You can reach Kathy Smith via phone [555-123-4567](tel:5551234567) or email [kathy.smith@example.org](mailto:kathy.smith@example.org) | kathy.smith@example.org | Miami | 33101,33102,33103 | 555-123-4567 | https://example.org/kathy-smith |
title: Contact namedescription: E.g. email and phone number (shown in chat, can include Markdown links)email,city,phone_number,url: Additional fields for search/filtering or informationzip_codes: A comma-separated list of zip codes that the contact serves (used for search/filtering). You can control which contact is shown for which zip code by changing the list of zip codes in this column.
You can add more contacts by adding more rows to this table.
2. Search for Contacts
There are various ways to search for contacts in the product database, for example:
- Ask the user to enter a city or zip code and save it in a variable (e.g. via a questionnaire), which is then used to query the product database
- Add an AI Agent module with a
products_searchtool that queries the product database based on user input. The AI agent module can reply with the contact information or use theproducts_displaytool to show the search results in a product gallery format.
All these methods function similarly: A variable is set to narrow down the search criteria, and the product database is queried using this variable.
3. Display the Results
Once the search is performed, you can display the results using the Product Feed module.
To do this, you need to add a Product database connector to the module and add an SQL query that uses the variable set in the previous step to filter the results. For example, if you set a variable location to the user's input, you can use the following SQL query:
SELECT * FROM products WHERE city LIKE '%${location}%' OR zip_code LIKE '%${location}%';