> For the complete documentation index, see [llms.txt](https://developer.ecall-messaging.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.ecall-messaging.com/api-references/https-interface/callbacks-and-inbound-sms.md).

# Callbacks and inbound SMS

### SMS reply callback

Use the `Answer` function to receive SMS replies.

{% hint style="warning" %}
This callback uses Windows-1252 character encoding.
{% endhint %}

| Parameter     | Type     | Description                                  |
| ------------- | -------- | -------------------------------------------- |
| `AddressTo`   | Required | Recipient number                             |
| `AddressFrom` | Required | Sender number                                |
| `Message`     | Required | Reply content                                |
| `TimeStamp`   | Required | Receipt time in `dd.mm.yyyy hh:mm:ss` format |
| `JobID`       | Optional | Original message identifier                  |

Acknowledge the callback with HTTP `200 OK`.

**Example:**

```
http://www.mycompany.com/answers?Function=Answer&AddressTo=0041766012999&AddressFrom=0041791234567&Message=My+reply&TimeStamp=11%2E12%2E2015+10%3A37%3A00
```

### Delivery notification callback

Use the `Notification` function to receive delivery notifications.

| Parameter    | Type     | Description                                          |
| ------------ | -------- | ---------------------------------------------------- |
| `ResultCode` | Required | Message status code                                  |
| `ResultText` | Required | Message status text                                  |
| `Number`     | Required | Recipient number                                     |
| `TimeStamp`  | Required | Message receipt time in `dd.mm.yyyy hh:mm:ss` format |
| `JobID`      | Optional | Original message identifier                          |

Acknowledge the callback with HTTP `200 OK`.

**Example:**

```
http://www.mycompany.com/notifications?Function=Notification&ResultCode=0&ResultText=Message+has+been+delivered&TimeStamp=17%2E07%2E2014+12%3A55%3A15&Number=0041787557539&JobID=FB551638-A320-476F-A47D-F2EE68
```

#### Notification result codes

| ResultCode | ResultText                     | Description                                       |
| ---------- | ------------------------------ | ------------------------------------------------- |
| `0`        | Message has been delivered     | Delivery confirmed by the recipient               |
| `1`        | Message has been buffered      | Delivery could not yet be confirmed               |
| `2`        | Message has not been delivered | Delivery could not be confirmed                   |
| `3`        | Error Code / Error Message     | Error while handing off to the destination center |
| `4`        | Transmission OK                | Job was forwarded to the destination center       |

### Inbound SMS forwarding

Incoming SMS can be forwarded to an HTTP or HTTPS URL.

Configure the target URL per leased SMS number in the portal.

#### GET forwarding

eCall appends these parameters to the configured URL:

| Parameter     | Description                                  |
| ------------- | -------------------------------------------- |
| `Function`    | Always `IncomingSMS`                         |
| `AddressTo`   | eCall receive number                         |
| `AddressFrom` | Sender number                                |
| `Message`     | SMS content                                  |
| `TimeStamp`   | Receipt time in `DD.MM.YYYY HH:MM:SS` format |

**Example:**

```
...?AddressFrom=0041799999999&AddressTo=0041766666666&Function=IncomingSMS&Message=Yes%2C%20noon%20is%20ok.&TimeStamp=01.01.2020%2012%3A00%3A00
```

Decoded values:

| Parameter     | Value                 |
| ------------- | --------------------- |
| `Function`    | `IncomingSMS`         |
| `AddressTo`   | `0041766666666`       |
| `AddressFrom` | `0041799999999`       |
| `Message`     | `Yes, noon is ok.`    |
| `TimeStamp`   | `01.01.2020 12:00:00` |

#### POST forwarding

POST forwarding sends JSON.

```json
{
  "messageId": "string",
  "channel": "Sms",
  "to": "string",
  "from": "string",
  "content": {
    "text": "string",
    "type": "Text"
  },
  "timestamp": "2024-03-13T11:44:40Z"
}
```

| Field          | Description                               |
| -------------- | ----------------------------------------- |
| `messageId`    | GUID that uniquely identifies the message |
| `channel`      | Always `Sms`                              |
| `to`           | eCall receive number                      |
| `from`         | Sender number                             |
| `content.type` | Always `Text`                             |
| `content.text` | SMS content                               |
| `timestamp`    | Receipt time in UTC using ISO 8601        |

**Example:**

```json
{
  "messageId": "6815c501-2fe1-ee11-812a-00155dfb061c",
  "channel": "Sms",
  "to": "0041766666666",
  "from": "0041777777777",
  "content": {
    "text": "Hello eCall!",
    "type": "Text"
  },
  "timestamp": "2024-03-13T11:44:40Z"
}
```
