# Outgoing Messages

The only endpoint you'll need to poll is: [/outgoing-messages/](#outgoing-messages)

The main difference to V1 is the supplication of the <mark style="color:orange;">`send_response_url`</mark> variable in the body of your request.

{% hint style="info" %}
Many of our clients use the Zapier Step,[ "Webhooks By Zapier" ](https://zapier.com/apps/webhook/integrations) to fulfill<mark style="color:orange;">`send_response_url`</mark>and <mark style="color:orange;">`followup_url`</mark>
{% endhint %}

### /outgoing-messages/

## Generates an answer to a message.

<mark style="color:green;">`POST`</mark> `https://app.max.ai/api/v2/outgoing-messages/`

This endpoint tasks Maax AI with generating a response to a message you received

#### Query Parameters

| Name                                                  | Type    | Description                                                                                                                                                                                                                                                                                                                                                                                |
| ----------------------------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| message\_content<mark style="color:red;">\*</mark>    | String  | Contents of the message from your customer.                                                                                                                                                                                                                                                                                                                                                |
| platform<mark style="color:red;">\*</mark>            | String  | <p>Where will you be sending the response to? <br><br><em>website, email, sms</em></p>                                                                                                                                                                                                                                                                                                     |
| ai\_id<mark style="color:red;">\*</mark>              | Integer | <p>s<em>ales\_automation</em> </p><p></p><p>Retrieve the ID from the <a href="https://app.maax.ai/dashboard/sales-ai/">Sales AI dashboard. </a></p>                                                                                                                                                                                                                                        |
| prospect\_id                                          | Integer | The id of prospect who is asking the question (If it is not provided, the new one will be created based on the prospect\_info)                                                                                                                                                                                                                                                             |
| prospect\_info<mark style="color:red;">\*</mark>      | JSON    | <p><code>{"first\_name": student, "last\_name": test,</code></p><p><code>"email": <email@test.com>,</code></p><p><code>"phone": 1234567778,</code></p><p><code>"facebook": fbname,</code></p><p><code>"instagram": igname,</code></p><p><code>"intercom": icname</code></p><p><code>}</code></p><p></p><p>First name is required, and at least one other variables (except last\_name)</p> |
| conversation\_id                                      | Int     | <p>The conversation id between this user and the prospect. If it is not given, the latest conversation between these two will be used, otherwise, a new one will be created.<br><br>Please review the <a href="#create-conversation">/create\_conversation/</a> endpoint if you want to create a conversation and specify an id. Recommended for sales applications.  </p>                 |
| output\_format                                        | String  | <p><em>plain\_text</em> if you wish to receve an unformatted response (recommended for SMS)</p><p></p><p>Leave blank if you wish to receive a HTML formatted response</p>                                                                                                                                                                                                                  |
| service\_type<mark style="color:red;">\*</mark>       | String  | sales\_automation                                                                                                                                                                                                                                                                                                                                                                          |
| send\_response\_url<mark style="color:red;">\*</mark> | String  | The URL to which Maax will send a response after the message is processed                                                                                                                                                                                                                                                                                                                  |
| followup\_url<mark style="color:red;">\*</mark>       | String  | The URL to which Maax will send a follow-up message to                                                                                                                                                                                                                                                                                                                                     |

#### Headers

| Name                                           | Type   | Description                                                                             |
| ---------------------------------------------- | ------ | --------------------------------------------------------------------------------------- |
| Content-Type<mark style="color:red;">\*</mark> | String | *application/json*                                                                      |
| 2hd-api-key<mark style="color:red;">\*</mark>  | String | Your MAAX AI API key, which you can locate at <https://app.maax.ai/dashboard/api-keys/> |

#### Request Body

| Name | Type   | Description |
| ---- | ------ | ----------- |
|      | String |             |

{% tabs %}
{% tab title="200: OK {     "incoming\_message\_id": Integer }" %}

{% endtab %}

{% tab title="401: Unauthorized Returned if the provided api key is not valid (or not provided). " %}

{% endtab %}

{% tab title="400: Bad Request Returned if  there are incorrectly formatted parameters" %}

{% endtab %}

{% tab title="403: Forbidden " %}

{% endtab %}
{% endtabs %}


---

# Agent Instructions: 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:

```
GET https://documentation.maax.ai/main/technical-guides/apis/v2/outgoing-messages.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
