> For the complete documentation index, see [llms.txt](https://documentation.maax.ai/main/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://documentation.maax.ai/main/setup-your-integration/v1-customer-ai-zapier/step-4-get-the-answer.md).

# Step 4 – Get the Answer

Create another Code by Zapier (Python) step and copy + paste the code below. It needs to receive the `incoming_message_id` field from Step 2 as an input

<figure><img src="/files/F2fxNorWso6yuLwJhPE2" alt=""><figcaption></figcaption></figure>

***

```python
import requests

# Fill value
api_key = # your API key here

# URL and headers
url = 'https://app.maax.ai/api/retrieve_answer/'
headers = {
    'Content-Type': 'application/json',  
    '2hd-api-key': api_key
}

# Fill value
service_type = # 'customer_service_automation' or 'sales_automation'
incoming_message_id = input_data['incoming_message_id']

# Define payload
payload = {  
    'incoming_message_id': incoming_message_id,  
    'service_type': service_type 
}

# GET request
try:
    response = requests.get(url, headers=headers, params=payload)
    # Raise an exception if an HTTP error occurred
    response.raise_for_status()  
    output = [response.json()]
except requests.exceptions.RequestException as e:
    # Handle any error that may have occurred
    error_message = str(e)
    output = {"error": error_message}

```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://documentation.maax.ai/main/setup-your-integration/v1-customer-ai-zapier/step-4-get-the-answer.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
