能否利用JSON Path实现Manychat查询Team Dynamix知识库并返回结果?
Great question! You absolutely can use JSON Path to parse Team Dynamix knowledge base search results and return them as clickable links in your Manychat bot. Let’s walk through the exact steps to set this up:
1. Confirm Team Dynamix API Access First
First, make sure Team Dynamix exposes a search API for its knowledge base that returns JSON-formatted results. Most enterprise tools like TDX offer this—check their official API docs for endpoints like GET /api/knowledgebase/articles/search (the exact path may vary by your instance). This API should accept a search query parameter (e.g., ?query=your-search-term) and return data with fields like article titles, URLs, and summaries.
2. Set Up a Custom Action in Manychat
Manychat’s Custom Actions are the bridge between your bot and external APIs. Here’s how to configure one:
- Go to your Manychat dashboard → Automation → Custom Actions → Create New Action
- Configure the request:
- Method: Choose
GET(orPOSTif TDX requires it) - URL: Paste your TDX search API endpoint, and inject the user’s search query using a Manychat variable. For example:
https://your-tdx-domain.com/api/knowledgebase/search?query={{user.search_query}}
(Replace{{user.search_query}}with the variable you’re using to store the user’s input) - Headers: Add any required authentication (e.g.,
Authorization: Bearer YOUR_TDX_API_KEY—get this from your TDX admin settings)
- Method: Choose
- Save the request configuration.
3. Use JSON Path to Extract Results
Once the API returns JSON data, use JSON Path to pull out the fields you need (titles, URLs, summaries). Let’s say TDX returns a response like this:
{ "articles": [ { "title": "Resetting Your TDX Account Password", "url": "https://your-tdx-domain.com/kb/123", "summary": "Step-by-step guide to resetting your password via the self-service portal." }, { "title": "Troubleshooting Ticket Submission Errors", "url": "https://your-tdx-domain.com/kb/456", "summary": "Common fixes for when you can’t submit a support ticket." } ] }
In your Manychat Custom Action, add a "Parse JSON" step and use these JSON Path expressions:
- To get all article titles:
$.articles[*].title - To get all article URLs:
$.articles[*].url - To get all summaries:
$.articles[*].summary
Store these extracted values in Manychat variables (e.g., {{parsed.titles}}, {{parsed.urls}}, {{parsed.summaries}}).
4. Build the Chat Response with Hyperlinks
Now, you’ll format the extracted data into clickable links for the Manychat interface. Use Manychat’s message builder and loop through the results (if you have multiple):
- Create a "Text" message, and use a loop to iterate over the parsed variables
- For each result, format it as a Markdown hyperlink:
[{{title}}]({{url}})\n{{summary}}\n\n - If there are no results, add a fallback message like: "Sorry, I couldn’t find any articles matching your search. Try rephrasing your query!"
5. Test and Troubleshoot
- Test the Custom Action directly in Manychat to ensure it’s pulling data correctly
- Use a local JSON Path tester tool to validate your expressions before adding them to Manychat
- Check that your TDX API allows requests from Manychat’s servers (you may need to whitelist Manychat’s IPs in TDX’s security settings)
- Verify authentication is set up correctly—invalid API keys will cause failed requests
Quick Example of a Final Chat Response
If the user searches "password reset", the bot would return:
Resetting Your TDX Account Password
Step-by-step guide to resetting your password via the self-service portal.Troubleshooting Ticket Submission Errors
Common fixes for when you can’t submit a support ticket.
内容的提问来源于stack exchange,提问作者Zanzibar

