Send messages, notices and one-time codes
Your organization’s servers send messages to residents in the 1.ae app through the 1.ae API. You identify each recipient by phone number, Emirates ID, username or account ID. Send one message and get its result in the answer, or send a batch of up to 500 messages that 1.ae sends at your batch rate.
Before you start
Section titled “Before you start”Each message goes to the direct conversation between your organization and the resident. There are three kinds of message:
| Kind | Use it for | What the resident sees |
|---|---|---|
| Message | An ordinary reply or note | A message in your conversation |
| Notice | A service update, a bill, a reminder | A message with a title. It is also in the resident’s Updates list. You can read its status. |
| One-time code | A sign-in or confirmation code that your system checks | A notice that shows the code only in the app. The app hides the code when it expires. |
You need two things:
- A verified 1.ae organization account, of type government or business. 1.ae creates and verifies it.
- An API key. An owner of your organization makes one in the 1.ae console. See Authenticate.
| API | https://api.1.ae |
| Console | https://console.1.ae |
| Protocol | Connect, JSON over HTTPS POST |
Each call is an HTTPS POST to https://api.1.ae/horizon.apis.chat.v1.ChatService/<Method> with a JSON body and these headers:
Authorization: Bearer 1ae.<your API key>Content-Type: application/jsonConnect-Protocol-Version: 1JSON rules
Section titled “JSON rules”- Field names are in lowerCamelCase, for example
idempotencyKey. - Enum values are full strings, for example
"SERVICE_KIND_CODE". - 64-bit numbers, such as
seq, arrive as strings. - A response leaves out each field that has its zero value. For example, the first result in a list has no
indexfield. Read a missingindexas 0. - Send Arabic text as raw UTF-8. Some JSON libraries change each Arabic character to a 6-byte escape. This makes a batch much larger.
Two ways to send
Section titled “Two ways to send”| Call | Items | Answer | Use it for |
|---|---|---|---|
SendServiceMessage |
1 | When the message is in the conversation | One-time codes, and anything a resident waits for |
SendServiceMessages |
Up to 500 | At once, before it sends anything | Bills, reminders and other notices to many residents |
A batch is a queue. 1.ae accepts it, sends its items at your batch rate, and keeps a result for each item. Read the results with GetServiceBatch. Single sends never wait behind your batches.
Your system api.1.ae Resident's app │── SendServiceMessage ────────▶│── message + push ─────────────▶│ │◀──────────── SENT, noticeId ──│ │ │ │ │ │── SendServiceMessages ───────▶│ │ │◀── batchId, QUEUED per item ──│── items at your batch rate ───▶│ │── GetServiceBatch ───────────▶│ │ │◀── state, counts, outcomes ───│ │