> For the complete documentation index, see [llms.txt](https://help.smartico.ai/welcome/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.smartico.ai/welcome/~/changes/B87CND5z8x8BAzJwmSVQ/technical-guides/secured-email-sms-gateway.md).

# Secured Email/SMS Gateway

The primary goal of this API is to allow Smartico.ai sending of emails and SMS messages without any exposure to the personal and identifiable information (PII) such as phone numbers and email addresses of the end users.

### Sending Emails via custom HTTP API supplied by customer:

The service should be accessible from provided IP addresses only.

The API should accept the following parameters as HTTP POST JSON Body and protected by "**Authorization**" header with secret value generated by the customer:

1. ext\_user\_id / String / platform user id the way it’s reported to Smartico.ai via integration
2. from\_email\_address / String / from email address that should be used in the outgoing email
3. reply\_to\_email\_address / String / replyTo email address that should be used in the outgoing email
4. subject / String / Email subject
5. body / String / HTML email body content
6. text\_body / String / Text variation on the email
7. email\_uid / String / unique email ID on Smartico.ai platform
8. callback\_url / String / HTTP API endpoint to be called when email status is changed&#x20;

```
{
  "ext_user_id": "hhu234556",
  "from_email_address": "Amazing <noreply@amazing.co>",
  "reply_to_email_address": "Amazing <noreply@amazing.co>",
  "subject": "The best offer your can find on the market",
  "body": "<html>..........</html>",
  "text_body": "Get the offer.....",
  "email_uid": "ksjhdf3428yqwr8fhjhfkdj",
  "callback_url" : "https://api.smartico.ai/......callback"
}
```

**Response as JSON message, always with 200 code:**

* If mail was accepted
  * error\_code = 0
  * ext\_message\_id - unique SMS id from the gateway (MUST Have)
* If failed
  * error\_code > 0
  * error\_message - explain why the request to send email failed

```
{
  "error_code": 0,
  "ext_message_id": "a540f662-45b3-11ee-be56-0242ac120002"
}

{
  "error_code": 1,
  "error_message": "User was not found"
}
```

### Sending SMS/IM via custom API supplied by customer:

The service should be accessible from provided IP addresses only.

The API should accept the following parameters as HTTP POST JSON Body:

1. ext\_user\_id / String / platform user id the way it’s reported to Smartico
2. from\_number / String / Optional, if integration supports
3. body / String / text body content of the message
4. im\_uid / String / unique instant message ID on Smartico platform
5. callback\_url / String / HTTP API endpoint to be called when message status is changed&#x20;

```
{
  "ext_user_id": "hhu234556",
  "from_number": "Amazing",
  "body": "Best offer ever",
  "im_uid": "ksjhdf3428yqwr8fhjhfkdj",
  "callback_url" : "https://api.smartico.ai/......callback"
}
```

**Response as JSON message, always with 200 code:**

* If SMS was accepted
  * error\_code = 0
  * ext\_message\_id - unique SMS id from the gateway
* If failed
  * error\_code > 0
  * error\_message - describe what is the problem

```
{
  "error_code": 0,
  "ext_message_id": "a540f662-45b3-11ee-be56-0242ac120002"
}

{
  "error_code": 1,
  "error_message": "User was not found"
}
```

### [**Reverse Integration / Delivery Statuses**](#user-content-fn-1)[^1]

Upon customer getting any status update regarding email/sms deliverability, it should call Smartico.ai API, the API is simple HTTP GET call to an endpoint that will be provided by account manager.

Example:

**<https://api.smartico.ai/...../>?**<mark style="color:red;">**type**</mark>**=email&**<mark style="color:red;">**ext\_message\_id**</mark>**=71e92bca-48a8-11ee-be56-0242ac120002&**<mark style="color:red;">**status**</mark>**=delivered**&<mark style="color:red;">**api\_key**</mark>=**48a8-11ee-be56-0242**

**The following parameters should be included:**

* api\_key = api key provided for a customer
* type = email/sms ONLY those values are supported
* ext\_message\_id = same ext\_message\_id that was provided to Smartico.ai when sending the communication
* status = at text ONLY the following values:
  * accepted
  * delivered
  * failed
  * rejected
  * complained
  * opened
  * unsubscribed

**Response as JSON message, always with 200 code:**

```
{
  "error_code": 0,
}

{
  "error_code": 1,
  "error_message": "email was not found"
}
```

[^1]:


---

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://help.smartico.ai/welcome/~/changes/B87CND5z8x8BAzJwmSVQ/technical-guides/secured-email-sms-gateway.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
