# Events

## `message.phone.received`&#x20;

This event is emitted when your Android phone receives a new SMS. It contains the SMS sender and recipient address together with the content of the SMS.

```json
{
    "data": {
        "contact": "+18005550100",
        "content": "This is a test incoming message",
        "message_id": "0b0123bb-ef2e-468f-908a-c026d51636aa",
        "owner": "+18005550199",
        "sim": "SIM1",
        "timestamp": "2023-06-29T03:21:19.814Z",
        "user_id": "XtABz6zdeFMoBLoltz6SREDvRSh2"
    },
    "datacontenttype": "application/json",
    "id": "f4aed1d3-ab4f-42b9-b9dd-9fc7182f7197",
    "source": "/v1/messages/receive",
    "specversion": "1.0",
    "time": "2023-06-29T03:21:19.524331882Z",
    "type": "message.phone.received"
}
```

***

## `message.phone.sent`

&#x20;This event is emitted when the httpSMS app on your Android phone sends out an SMS.

```json
{
    "data": {
        "contact": "+18005550100",
        "content": "This is a test outgoing message",
        "id": "ff313c14-17a3-4f74-bcb2-ca77213a64af",
        "owner": "+18005550100",
        "request_id": "optional request id",
        "sim": "SIM1",
        "timestamp": "2023-07-17T19:05:45.166Z",
        "user_id": "TcZ3PaOieTexxXJKAQJWO8rr1Mv1"
    },
    "datacontenttype": "application/json",
    "id": "cf241cb9-0762-43d0-8b74-4f763f788c93",
    "source": "/v1/messages/ff313c14-17a3-4f74-bcb2-ca77213a64af/events",
    "specversion": "1.0",
    "time": "2023-07-17T19:05:45.877240866Z",
    "type": "message.phone.sent"
}
```

***

## `message.phone.delivered`

This event is emitted when an SMS is delivered to the recipient's phone.

```json
{
    "data": {
        "contact": "+18005550100",
        "content": "This is a sample outgoing message",
        "id": "5be8f09e-7007-4fe9-86b6-591d63fd38ad",
        "owner": "+18005550100",
        "request_id": null,
        "sim": "SIM2",
        "timestamp": "2023-07-17T18:54:22.262Z",
        "user_id": "XtABz6zdeFMoBLoltz6SREDvRSh2"
    },
    "datacontenttype": "application/json",
    "id": "f4b86c6d-8c90-4ba7-a599-516a27f1a1e9",
    "source": "/v1/messages/5be8f09e-7007-4fe9-86b6-591d63fd38ad/events",
    "specversion": "1.0",
    "time": "2023-07-17T18:54:20.012355134Z",
    "type": "message.phone.delivered"
}
```

***

## `message.send.failed`

This event is emitted when an SMS fails to be sent out by the httpSMS app on your Android phone

```json
{
    "data": {
        "contact": "+18005550100",
        "content": "This is a sample outgoing message",
        "error_message": "MOBILE_APP_INACTIVE",
        "id": "508d783f-df33-4eaf-85e8-0fcab9958654",
        "owner": "+18005550100",
        "request_id": null,
        "sim": "SIM2",
        "timestamp": "2023-07-17T18:56:01.218Z",
        "user_id": "XtABz6zdeFMoBLoltz6SREDvRSh2"
    },
    "datacontenttype": "application/json",
    "id": "d69c96fb-9f46-498b-811d-3adfb785e439",
    "source": "/v1/messages/508d783f-df33-4eaf-85e8-0fcab9958654/events",
    "specversion": "1.0",
    "time": "2023-07-17T18:55:58.979647773Z",
    "type": "message.send.failed"
}
```

***

## `message.send.expired`

This event is emitted when an SMS expires before being sent out by your Android phone. It can happen in cases where your Android phone is powered off.

```json
{
    "data": {
        "contact": "+18005550100",
        "content": "This is a sample outgoing message",
        "is_final": true,
        "message_id": "ff313c14-17a3-4f74-bcb2-ca77213a64af",
        "owner": "+18005550100",
        "send_attempt_count": 2,
        "request_id": null,
        "sim": "SIM1",
        "timestamp": "2023-07-17T19:10:43.461254738Z",
        "user_id": "XtABz6zdeFMoBLoltz6SREDvRSh2"
    },
    "datacontenttype": "application/json",
    "id": "8f5a9eaf-c495-4487-b11c-1824b8df6da2",
    "source": "/v1/messages/send",
    "specversion": "1.0",
    "time": "2023-07-17T19:10:43.461263458Z",
    "type": "message.send.expired"
}
```

***

## `phone.heartbeat.offline`

This event is emitted when the httpSMS server didn't get a ping (heartbeat) from the phone in the past 1 hour. The httpSMS app on your android phone sends a ping to the server ever 15 minutes. If the server doesn't receive a heartbeat event in a 1 hour interval, then your phone is considered to be offline.

```json
{
    "data": {
        "phone_id": "ff313c14-17a3-4f74-bcb2-ca77213a64af",
        "monitor_id": "ff313c14-17a3-4f74-bcb2-ca77213a64af",
        "owner": "+18005550100",
        "last_heartbeat_timestamp": "2023-07-17T19:10:43.461254738Z",
        "timestamp": "2023-07-17T20:20:23.461254738Z",
        "user_id": "XtABz6zdeFMoBLoltz6SREDvRSh2"
    },
    "datacontenttype": "application/json",
    "id": "8f5a9eaf-c495-4487-b11c-1824b8df6da2",
    "source": "/v1/messages/send",
    "specversion": "1.0",
    "time": "2023-07-17T19:10:43.461263458Z",
    "type": "phone.heartbeat.offline"
}
```

***

## `phone.heartbeat.online`

This event is emitted when the httpSMS server receives a heartbeat (ping) from your Android phone after it was previously offline.

```json
{
    "data": {
        "phone_id": "ff313c14-17a3-4f74-bcb2-ca77213a64af",
        "monitor_id": "ff313c14-17a3-4f74-bcb2-ca77213a64af",
        "owner": "+18005550100",
        "last_heartbeat_timestamp": "2023-07-17T19:10:43.461254738Z",
        "timestamp": "2023-07-17T20:20:23.461254738Z",
        "user_id": "XtABz6zdeFMoBLoltz6SREDvRSh2"
    },
    "datacontenttype": "application/json",
    "id": "8f5a9eaf-c495-4487-b11c-1824b8df6da2",
    "source": "/v1/messages/send",
    "specversion": "1.0",
    "time": "2023-07-17T19:10:43.461263458Z",
    "type": "phone.heartbeat.online"
}
```

***

## `message.call.missed`

This event is emitted when your Android phone receives a missed phone call. You can use this event to trigger some automation e.g You may want to reply that the phone number is used sending SMS messages and they shouldn't call the phone number.

```json
{
    "data": {
        "contact": "+18005550199",
        "message_id": "682a47cd-adfd-4b5c-b4f2-65302746ac52",
        "owner": "+18005550100",
        "sim": "SIM1",
        "timestamp": "2022-06-05T14:26:09.527976+03:00",
        "user_id": "XtABz6zdeFMoBLoltz6SREDvRSh2"
    },
    "datacontenttype": "application/json",
    "id": "f39d4b09-e2b7-42e2-b08f-d45820a18b05",
    "source": "/v1/messages/calls/missed",
    "specversion": "1.0",
    "time": "2024-04-14T17:48:35.3664741Z",
    "type": "message.call.missed"
}
```


---

# 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://docs.httpsms.com/webhooks/events.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.
