> For the complete documentation index, see [llms.txt](https://developerdocs.instructure.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developerdocs.instructure.com/services/canvas/resources/comm_messages.md).

# CommMessages

API for accessing the messages (emails, sms, etc) that have been sent to a user.

#### A CommMessage object looks like: <a href="#commmessage" id="commmessage"></a>

```js
{
  // The ID of the CommMessage.
  "id": 42,
  // The date and time this message was created
  "created_at": "2013-03-19T21:00:00Z",
  // The date and time this message was sent
  "sent_at": "2013-03-20T22:42:00Z",
  // The workflow state of the message. Possible values: 'created' : The message
  // has been created, but not yet processed. 'staged' : The message is queued for
  // sending. 'sending' : The message is being sent currently. 'sent' : The
  // message has been successfully sent. 'bounced' : An error occurred during the
  // sending of the message.'dashboard' : The message has been sent to the
  // dashboard. 'closed' :  The message has been sent and closed, typically for
  // dashboard messages or messages sent to deleted users. 'cancelled' : The
  // message was cancelled before it could be sent.
  "workflow_state": "sent",
  // The address that was put in the 'from' field of the message
  "from": "notifications@example.com",
  // The display name for the from address
  "from_name": "Instructure Canvas",
  // The address the message was sent to:
  "to": "someone@example.com",
  // The reply_to header of the message
  "reply_to": "notifications+specialdata@example.com",
  // The message subject
  "subject": "example subject line",
  // The plain text body of the message
  "body": "This is the body of the message",
  // The HTML body of the message.
  "html_body": "<html><body>This is the body of the message</body></html>"
}
```

## [List of CommMessages for a user](#method.comm_messages_api.index) <a href="#method.comm_messages_api.index" id="method.comm_messages_api.index"></a>

[CommMessagesApiController#index](https://github.com/instructure/canvas-lms/blob/master/app/controllers/comm_messages_api_controller.rb)

#### `GET /api/v1/comm_messages`

**Scope:** `url:GET|/api/v1/comm_messages`

Retrieve a paginated list of messages sent to a user.

#### Request Parameters:

| Parameter    | Type              | Description                                                                                                                       |
| ------------ | ----------------- | --------------------------------------------------------------------------------------------------------------------------------- |
| `user_id`    | Required `string` | The user id for whom you want to retrieve CommMessages                                                                            |
| `start_time` | `DateTime`        | <p>The beginning of the time range you want to retrieve message from.<br>Up to a year prior to the current date is available.</p> |
| `end_time`   | `DateTime`        | <p>The end of the time range you want to retrieve messages for.<br>Up to a year prior to the current date is available.</p>       |

Returns a list of [CommMessage](#commmessage) objects.


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://developerdocs.instructure.com/services/canvas/resources/comm_messages.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
