Expert Guide: Integrating ticketing systems and GraphQL interfaces
Configure complex API queries for live availability, dates and prices in the chatbot
This article describes an advanced use case for complex ticketing systems and GraphQL POST requests. For the basics of how webhooks work and how to set up simple REST queries, start with the article Webhooks: Use and configuration.
Automatically checking available places, start times and prices is one of the most demanding service use cases for ticketing and event platforms. Simple interfaces often work with standard REST GET requests, but many modern ticketing systems use GraphQL interfaces with the POST method and complex URL queries.
By combining webhooks, a specialised AI agent and tailored AI actions, the AI chatbot can answer live enquiries precisely. This includes converting prices automatically (e.g. pence into pounds), handling time zones, filtering by group size and querying flexible time windows.
The example in this article: Moinbury City Museum 🏛️🎟️ (click to expand)
🏛️ The scenario
Moinbury City Museum serves as the running example in this article. It sells three publicly bookable formats through its ticketing system: the daily Highlights tour of the permanent exhibition, the monthly Torchlight tour in the evening and the Museum trail for kids. School groups, nursery groups and private viewings, on the other hand, are handled by enquiry and quote, not via the chat. If a teacher still asks about places in the chat, the AI chatbot treats this as a request for individual places on a public tour.
💬 The result
Question in the chat: "Do you still have places on the Highlights tour on Saturday?"
Answer from the AI chatbot: "There are still places available on Saturday, 15 August: 11:00 with 8 places, 14:00 with 3 places and 16:00 with 12 places. Admission costs £12.00."
The times, the available places and the price all come live from the ticketing system. None of it is maintained in the moinAI Hub.
🎬 Watch it in action
1. Prerequisites and system components
A real-time availability query requires the following components in the moinAI Hub:
- 1x webhook: the technical interface to the external ticketing system.
- 1x AI agent: responsible for the subject “ticket availability”.
- 1–2x knowledge sources: the web pages or documents describing the event catalogue (in the example, the pages about the museum’s tours) and, optionally, the FAQ page on booking and cancellation terms.
- 2x AI actions: the logical links between AI agent, webhook and rules (one action for queries about a specific day and one action for finding the next available date).
- 1x instructions: the rules for how the AI agent responds.
Additional requirements:
- Tenant identifier: the domain of the ticket shop (in the example
ticket.moinbury-museum.com). The webhook sends this domain as a header value so that the external ticketing system can assign the request.
The read-only query described in this guide does not require an API key, because it uses the public read view of the ticketing system. For protected APIs that require write permission or authentication, you can store an API key or bearer token in the header, as shown in the “Order status” use case in the main article on webhooks.
Even if no key is technically required, agree on the use of the interface with its operator before going live. Both sides then know that the AI chatbot queries dates regularly.
The following steps are tailored to the schema of one specific ticketing system. Another system needs the same details, which you can collect in a single request to the interface provider:
- The endpoint URL of the interface, in the example
https://api.ticketing-example.com/graphql - A working sample query that returns the dates for a period
- The field names for start time, available places and price, in the example
spanBeginStr,remainingQuotaandcurrentPriceValue - The unit of the price field and the time zone of the start time, in the example pence and local time
- The type of authentication, if required
- The list of event IDs of all publicly bookable formats
Pay particular attention to the unit of the price field and the time zone of the start time. A mix-up there stays unnoticed the longest in live operation, because the answer sounds plausible even with wrong values.
2. Create the webhook (GraphQL)
A central webhook connects the ticketing system.
- In the moinAI Hub, go to Integrations > API-Connector.
- Click Create webhook to open a blank configuration form.
- Enter the following values:
| Field | Value |
|---|---|
| Name | Availability |
| Method | POST |
| Target URL | Complete GraphQL string, e.g. https://api.ticketing-example.com/graphql?query=query%28%24d%3A%5BDateRange%21%5D%2C%24t%3A%5BIdOrNumber%21%5D%2C%24p%3AID%21%29%7BeventTemplatePotentialEvents%28posId%3A%24p%2Cdates%3A%24d%2CeventTemplates%3A%24t%2CincludeQuota%3Atrue%2Cquantity%3A1%2Cfirst%3A100%29%7Bedges%7Bnode%7BspanBeginStr%20name%20remainingQuota%20maxQuota%20currentPriceValue%20defaultPriceValue%7D%7D%7D%7D&variables=%7B%22p%22%3A%22auto%22,%22d%22%3A%5B%22%5B{{from}},{{to}}%29%22%5D,%22t%22%3A%5B{{#if tour_type}}{{tour_type}}{{else}}1001,1002,1003{{/if}}%5D%7D |
| Body / payload | Default |
| Authentication | No authentication |
| Header 1 | X-Tenant-Domain: ticket.moinbury-museum.com |
| Header 2 | Accept-Language: {{#if language}}{{language}}{{else}}en{{/if}} |
| Use of cookies | No |
The query in readable form (click to expand)
This view is for understanding only and shows what the encoded target URL from the table actually queries. The webhook uses the encoded version.
query($d: [DateRange!], $t: [IdOrNumber!], $p: ID!) {
eventTemplatePotentialEvents(
posId: $p
dates: $d
eventTemplates: $t
includeQuota: true
quantity: 1
first: 100
) {
edges { node {
spanBeginStr # start time as text in local time -> for answers
name # name of the event / price variant
remainingQuota # available places (0 = fully booked)
maxQuota # total capacity, for context only
currentPriceValue # current price in pence
defaultPriceValue # standard price in pence
} }
}
}
Variables
{ "p": "auto",
"d": ["[2026-08-15,2026-08-16)"], # day, end exclusive
"t": [1001,1002,1003] } # IDs of the Highlights tour


Technical requirements for the target URL
- Placeholders and parameters belong together: at runtime, the placeholders
{{from}},{{to}},{{tour_type}}and{{language}}in the target URL are replaced with the values of the AI action parameters of the same name. The names must match exactly. If you rename a parameter in the AI action, rename the placeholder in the target URL as well. Otherwise the value stays empty and the query returns a wrong result without reporting an error. You create the parameters in the two AI actions. - HTTP method POST: the GraphQL interface requires the
POSTmethod even for read queries. AGETrequest causes a server error. - Keep the URL encoding: do not convert characters such as
%7Bor%7Dinto unencoded curly brackets, because the Hub would interpret them as its own placeholders. - Default fallback in
tour_type: the block{{#if tour_type}}...{{else}}1001,1002,1003{{/if}}ensures that a query without an explicitly named event automatically checks the default events (in the example, the three price variants of the Highlights tour). Without this default, the interface would also return internal or non-public group formats.
Run the webhook once with the Hub’s test function straight after creating it. The expected result is status 200 with a data block. A response with the key errors usually means that the target URL was not copied completely or not unchanged. The section Testing and validation in the main article explains how webhook testing works in general.

💡 Most common error
The AI action runs in the AI Playground but returns no availability. The cause is almost always the target URL: a truncated line ending or a curly bracket decoded during copying is enough. In this case, paste the URL again as a single string and test the webhook again.
3. Configure the AI agent
Create a separate, specialised AI agent for the subject “ticket availability”. Mixing it with general FAQ agents is not recommended, because the specific behaviour rules should apply to availability questions only.
The main article Create AI agents describes in detail how to create an AI agent.
- In the Knowledge Base menu item, click the plus icon.
- Define the fields as follows:
| Field | Value / setting |
|---|---|
| Name | Ticket availability |
| Purpose of the agent | The agent answers all questions about available places, bookable times and dates of tours and events at the museum, including availability for groups of a specific size. |
| Sample enquiries |
Are there still places on the Highlights tour on Saturday? |

The system uses the AI agent’s description to decide whether a request is processed by this agent. The description should contain the terms that users typically use in the chat, in the example “tour” and “trail” rather than the internal format names of the ticketing system.
New AI agents are disabled at first. For testing in the AI Playground, enable the AI agent in the preview (staging); the activation for live operation follows in the chapter on publication.
4. Link the event catalogue as a knowledge source
The webhook returns dynamic figures such as times, available places and prices, but contains no editorial explanations about event content, duration or target groups. So that the AI agent can also answer questions about content (e.g. “What is the difference between the Highlights tour and the Torchlight tour?”), assign suitable knowledge sources to it in the Knowledge Base:
- The overview page of the event catalogue, in the example “Tours and dates” (https://moinbury-museum.com/tours), and the detail pages of all publicly bookable offers.
- The FAQ page on booking and cancellation terms, in the example “Tickets, booking and cancellation” (https://moinbury-museum.com/service/tickets-faq).
Import runs asynchronously: a knowledge source can only be used once it has reached the status “active”.

Linking individual subpages gives more precise results than importing the entire website, because navigation and footer texts can dilute answer quality.
5. Create the AI action “Availability” (single-day query)
The AI action connects the webhook to the AI agent. This first action handles enquiries about a specific date (in the example “Are there still places on the Highlights tour on Saturday?”).
General details on how AI actions work and which types exist are described in the article AI Actions.
- In the moinAI Hub, go to Knowledge Base > RAG and click Add Action in the Actions & Follow-Up card.
- Under Choose tool, select the webhook “Availability”.
- Enter the following configuration:
- Action name: Availability
- Tool description: Checks available places, bookable start times and prices of an event on ONE day. Use the tool when the user wants to know whether an event can be booked, how many places are available or which times there are. Always query exactly one day: to = the day after from. For questions about several days, check the first day and offer further days one at a time.
- Instructions after: Take times only from spanBeginStr, never from spanBegin (UTC). currentPriceValue.amount is in pence: 1200 = GBP 12.00, divide by 100. remainingQuota is the number of available places, 0 means fully booked. If the user has named a number of people, only list dates whose remainingQuota reaches or exceeds this number. A date with fewer available places must not appear, not even as the earliest or latest time. If no date is sufficient, say so and state the largest number of places available. List up to five start times explicitly; if there are more, give the earliest and the latest. Do not invent times in between. If the list is empty, the event is not offered on that day. Then answer: "The [event] is not offered on [date]. Shall I look for the next date for you?" Do not use "cancelled", "no longer taking place" or "fully booked". If the response contains errors or no data, do not list any dates and refer to the booking page. This answer is final; do not call any further tool afterwards.
The Instructions after field has a character limit. If the text cannot be saved in full, drop the rule on the number of start times first. Keep the rules on fields and units, the group filter and the prescribed sentence for days without a date. The first ensure that the figures are correct; the other two are each checked by a test case in the acceptance list.

Parameters for the single-day query
Use the plus icon in the Parameters section to create four parameters of the type string:
| Parameter | Description |
|---|---|
from |
Start date of the requested day in the format YYYY-MM-DD. Convert relative dates such as today, tomorrow or next Saturday into this format. If the user gives no date, use today's date. The format must be exact. |
to |
End date in the format YYYY-MM-DD, exclusive (not included). ALWAYS set it to the day AFTER from, e.g. from=2026-08-15, to=2026-08-16. Even for questions about several days, always query a single day only. |
tour_type |
Comma-separated list of the event's IDs (one event can have several price variants, each with its own ID). Mapping: Highlights tour → 1001,1002,1003 ; Torchlight tour → 1004,1005 ; Museum trail for kids → 1006. If the user names no format, leave the parameter empty; the default from the target URL then applies and the Highlights tour is checked automatically. Only use IDs from this list. |
language |
ISO 639-1 code of the language the user writes in: en for English, de for German. Only the two-letter code. |
The three IDs of the Highlights tour stand for full price, concession and family ticket. One format can therefore have several IDs in the ticketing system, although visitors see it as a single offer.
The operator of the ticketing system provides the actual IDs. They are among the details listed in the overview of required interface details, which you request from the provider in one go. The list should contain all price variants of a format and no internal or non-public formats.

The language parameter controls the format in which the interface returns date and time: en returns “Sat, 15 Aug 09:00 AM”, de returns “Sa, 15. Aug 09:00”. The value is passed via the Accept-Language header from the webhook set-up.
6. Create the AI action “Next date” (wide time window)
A second AI action covers questions without a fixed date (e.g. “When is the next Torchlight tour?”). Rare events would not be found with a single-day query, so this action uses a 90-day window. The Torchlight tour only takes place once a month: a query for a single day therefore comes back empty in most cases, even though there is a next date. The limit of 100 dates per query does not matter here: the list of results is sorted chronologically, so the earliest date is always at the top, even if the end of the list is cut off.
This action uses the same webhook “Availability”.
- Action name: Next date
- Tool description: Finds the NEXT date on which an event takes place when the user does not name a specific day: "When is the next Torchlight tour?", "When is it on again?", "What is the earliest I can come?". Do NOT use it when the user names a specific day; the tool Availability handles that. Use only one of the two tools per answer.
- Instructions after: The list is sorted chronologically. Give the earliest date with date and time from spanBeginStr, if needed the next one or two dates as well, and the available places from remainingQuota. Price from currentPriceValue.amount in pence, divide by 100. If the list is empty, the event does not take place in the coming months: say so and refer to the booking page. Never list dates that are not in the list. This answer is final; do not call any further tool afterwards.
Different parameters for the wide time window
This action also gets four parameters of the type string, explicitly including from and to, although they contain a date. The type number cannot pass the format YYYY-MM-DD.
The parameters tour_type and language match the configuration of the AI action “Availability”. For the date parameters, change the descriptions as follows:
| Parameter | Description |
|---|---|
from |
Today's date in the format YYYY-MM-DD. |
to |
Date 90 days after today in the format YYYY-MM-DD. |

7. Define instructions and system rules
The moinAI Hub strictly separates general agent rules (instructions) from action-specific data processing:
- Instructions (in the AI agent): global behaviour rules, system role and tone.
- Instructions after (in the AI action): technical field evaluation, unit conversion and error handling of the interface.
Enter the following text in the moinAI Hub under Knowledge Base > RAG in the Instructions tile of the agent “Ticket availability”:
You provide information about available places and start times of the museum's tours and events. Check first, then answer only with the values received. Never invent dates, times, places or prices. Check exactly once per answer. Do not announce a further check; ask whether you should carry it out instead. For questions about several days, answer one day specifically and offer the others one at a time; never infer from one day to another. If no event is named, use the Highlights tour; if no date is given, use today; state the assumption. Answer in the user's language. Never talk about technology or where the data comes from.
Instructions must not contain prices, opening hours, event names or dates. Anything that can change belongs in the knowledge sources or comes from the live query. Instructions contain rules only. Otherwise a second, invisible copy of the data is created that nobody maintains and that quietly goes out of date. The Highlights tour may appear here as a default, because it is a rule for handling missing details and not a data record.

Further security guidelines and protection against manipulation (e.g. attempts to read out system prompts) are described in detail in the articles Guardrails and Protection against prompt injection.
8. Run tests in the AI Playground
{% video_player "embed_player" overrideable=False, type='hsvideo2', hide_playlist=True, viral_sharing=False, embed_button=False, autoplay=False, hidden_controls=False, loop=False, muted=False, full_width=False, width='1920', height='1080', player_id='485813964019', style='' %}
Before release, test the function in the AI Playground. The following test list serves as acceptance criteria:
| # | Test question in the AI Playground | Expected behaviour / validation |
|---|---|---|
| 1 | Are there still places on the Highlights tour on Saturday? | Specific times with available places, price as an amount in pounds (e.g. £12.00), no unchecked pence values. |
| 2 | Is there anything available tomorrow? | Answer for the Highlights tour for tomorrow, stating the assumption made. |
| 3 | Which dates do you have next week? | Exactly one day is answered specifically; further days are offered for checking. |
| 4 | We are a group of 25, is Saturday possible? | Only dates whose available capacity (remainingQuota) is at least 25. Dates with 24 places or fewer are not shown, not even as the “earliest time”. |
| 5 | Can I book the Torchlight tour on [day without a date]? | Message: “The Torchlight tour is not offered on [date]”, with an offer to look for the next date. Not “fully booked”, not “cancelled”. |
| 6 | When is the next Torchlight tour? | The action “Next date” runs and the earliest entry from the 90-day window is given. |
Test case 4 also checks the museum’s most important special case: a group asking for places in the chat is not looking for a bookable group tour, but for 25 individual places on a public tour. The internal group formats are excluded because their IDs are not in the tour_type parameter.

Spot-check figures from the answers against the real ticket shop. A comparison ensures that parameters and time zones are processed correctly. A fluently worded answer with wrong figures is the error that stays unnoticed the longest in live operation.
In every test, also check whether the right AI agent was chosen. If a request reaches the wrong AI agent, correct the assignment with the feedback function and sharpen the AI agent’s description.
When the AI chatbot offers to look for the next date, a plain “Yes, please” does not carry the subject forward: a simple confirmation is recognised as small talk. “Yes, please, when is the next Torchlight tour?” leads to the result. Word offers so that the user’s reply names the subject.
Every test actually queries the connected ticketing system. This is not critical, because it only reads data. However, these are real requests, not a simulation.
9. Publication and ongoing maintenance
After successful testing in the AI Playground, the settings go live.
Check two settings before activation, because from this point on the AI chatbot states prices and quotas: the knowledge check (protection against statements without a knowledge basis) should be enabled, and the tone of voice in the persona should match your brand.
- Set the AI agent
Ticket availabilityto Enabled in Live-Bot for the desired channel (e.g. the chat widget on the website). - Publish in the Hub via the publishing status. Only after this confirmation are the AI actions available for real conversations in the chat widget.
- After publishing, ask a control question in the published chat widget.

Regular maintenance
Dates, times, available places and prices need no maintenance; they come fresh from the ticketing system with every enquiry. Exactly one point needs attention:
As soon as new event formats are created in the external ticketing system, add their IDs to the tour_type parameter of both AI actions (Availability and Next date). Without these IDs, new offers remain invisible to the AI chatbot. If the museum creates a special tour of a temporary exhibition, for example, it cannot be found in the chat until its ID is in both actions. Internal or private booking IDs are deliberately left out so that they are not offered in the public chat; in the example, the school group tour, the nursery group and the private viewing.
It is also advisable to repeat test cases 1, 4 and 5 from the acceptance list in the published chat widget once a quarter. Changes to the interface then become apparent before they show up in live operation.
10. Optional background: why the rules are worded this way
Four characteristics of such interfaces explain why the rules in this guide are worded as they are. Leave these points untouched when making later changes.
| Characteristic of the interface | Consequence for the configuration |
|---|---|
| Exactly one query runs per answer | Two checks in one answer are not intended. Announced follow-up checks lead to repetitions; users request the second check themselves. |
| The group filter needs a hard limit | Only the explicit wording “reaches or exceeds” together with “not even as the earliest or latest time” reliably keeps dates with too few places out. |
| Instructions work better than prohibitions | For wording rules, put the desired sentence in the instruction, not just the unwanted word. Hence the prescribed sentence for days without a date. |
| Errors come back as success | Many GraphQL interfaces answer even faulty queries with status 200 and an errors block. To the AI, this looks like data; hence the errors rule in the Instructions after field. |