# Send an inbound message to a session task.

Source: <https://everruns.com/docs/api/operations/post_task_message/>

POST

/v1/sessions/{session\_id}/tasks/{task\_id}/messages

Select code samplecURL (shell:curl)

```js
const url = 'https://app.everruns.com/api/v1/sessions/example/tasks/example/messages';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: '{"content":[{"text":"example","type":"text"}],"in_reply_to":"example","text":"example"}'
};


try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```sh
curl --request POST \
  --url https://app.everruns.com/api/v1/sessions/example/tasks/example/messages \
  --header 'Content-Type: application/json' \
  --data '{ "content": [ { "text": "example", "type": "text" } ], "in_reply_to": "example", "text": "example" }'
```

* Production APIapp.everruns.com/api/v1/sessions/{session\_id}/tasks/{task\_id}/messages

## Parameters

### Path Parameters

**session\_id**

required

string

Session ID

**task\_id**

required

string

Task ID

## Request Bodyrequired

Media typeapplication/json

Request body for posting an inbound task message.

object

**content**

Structured message parts (alternative to `text`).

Array | null

One of:

* object

  object

  **text**

  required

  string

  **type**

  required

  string

  Allowed values: text

* object

  object

  **data**

  required

  object

  **type**

  required

  string

  Allowed values: data

**in\_reply\_to**

Input request ID this message answers, when applicable.

string | null

**text**

Plain-text message (alternative to `content`).

string | null

## Responses

### 200

Recorded task message

Media typeapplication/json

A message exchanged between a session and one of its tasks.

object

**content**

required

Array

One of:

* object

  object

  **text**

  required

  string

  **type**

  required

  string

  Allowed values: text

* object

  object

  **data**

  required

  object

  **type**

  required

  string

  Allowed values: data

**created\_at**

required

string format: date-time

**direction**

required

Direction of a task message. Inbound = session → task.

string

Allowed values: inbound outbound

**id**

required

`tmsg_*` public ID.

string

**in\_reply\_to**

Set when this message answers a `TaskInputRequest`.

string | null

**task\_id**

required

string

##### Example

```json
{
  "content": [
    {
      "type": "text"
    }
  ],
  "direction": "inbound"
}
```

### 400

Empty message

### 404

Session or task not found