# Connect Infobip

Source: https://kirora.io/docs/guides/messaging/sms/connect-infobip

Create an Infobip API key with the right scopes, connect it in Kirora, forward each number's replies to Kirora, and send your first text.

Kirora sends through your own Infobip account, from your numbers and registered sender IDs. Infobip bills you at your rates; Kirora adds nothing per message.

## Before you start

- **An Infobip account with credit.**
- **A number or a registered sender ID for each country you send to.** Many countries ask you to register a sender ID before it can send, and Infobip arranges that with you. See [Choose and register your senders](https://kirora.io/docs/guides/messaging/sms/senders-and-registration).
- **The owner, admin or developer role** in Kirora.

## Create an API key

1. In Infobip, go to **Developer Tools › API Keys** and create a key, named *Kirora* for example.
2. Give it these scopes:

| Scope | Needed for |
| --- | --- |
| `sms:message:send` | Sending. Required. |
| `sms:logs:read` | Checking the key, and settling messages whose delivery report never arrived. Required. |
| `numbers:manage` | Listing your numbers. Without it, add your numbers by hand. |
| `account-management:manage` | Showing your balance, and resuming held texts once you top up. Without it, sending works, but the **Balance** card asks you to add the scope. |

3. Copy the key, and your **API base URL** shown beside your keys, such as `https://xxxx.api.infobip.com`.

## Connect it in Kirora

1. Go to **Settings › Messaging › SMS** and choose **Connect** on the Infobip card. You can also start from **Integrations › Infobip**.
2. Enter the **API base URL** and **API key**. Leave **Signing secret** empty unless your replies come through a subscription: see [Sign replies](#sign-replies-optional).
3. Choose **Connect**. Kirora checks the key against your SMS logs, so a missing `sms:logs:read` shows straight away. A missing send scope shows on the first send, when Infobip refuses it and the connection changes to **Credentials refused**. Then Kirora lists your senders and shows your balance, which it reads at most every five minutes.

## Forward replies to Kirora

Kirora shows an **Inbound URL** on the Infobip page, under **Paste this into Infobip**. It brings replies and STOP back to Kirora. Delivery reports need no setup: Kirora asks for them with every message.

For each number you send from:

1. In Infobip, open the number under **Channels and Numbers** and edit its SMS **inbound configuration**.
2. Choose **Forward to HTTP**, and paste the Inbound URL to receive messages by HTTP POST in the `MO_JSON_2` format.
3. If the number routes by keyword, make sure STOP and START are forwarded too, then save.

You can instead send replies to Kirora through a subscription under **Developer Tools › Subscriptions Management**, which can sign them.

**This step matters more on Infobip than anywhere else.** Kirora only knows about a STOP that reaches it, so until the URL is in place, a STOP never opts anyone out in Kirora. Kirora plays it safe: a number shows **Waiting for a first reply** until Kirora receives one from it, and until then its marketing texts carry an opt-out link. Once a reply arrives, it shows **STOP works**.

If you want contacts to get a confirmation, and their carrier doesn't send one, set up an automatic reply in Infobip.

## Sign replies (optional)

**Forward to HTTP** doesn't sign what it sends, so leave the signing secret empty for numbers set up that way: with a secret saved, Kirora refuses every unsigned reply, STOP included.

If your replies come through a subscription, you can have Infobip sign them:

1. On **Integrations › Infobip** in Kirora, under **Settings**, choose **Add** beside **Signing secret**. Kirora generates a secret: copy it, or choose **Use your own** to type one.
2. Leave the dialog open. In Infobip, go to **Developer Tools › Subscriptions Management › Authentication settings** and create a setting of type **HMAC** with algorithm **HMAC_SHA_256**, pasting the secret as its **Secret key**.
3. Add that authentication setting to the subscription or notification profile that sends to Kirora.
4. Back in Kirora, save the secret.

To change it later, choose **Replace** or **Remove** on the same row. You never have to re-enter the API key.

## Check your senders

Kirora lists your **numbers** when the key has `numbers:manage`, and your registered **sender IDs** when the key can read them. They appear on the **Senders** tab of **Settings › Messaging › SMS**.

A sender Kirora can't list can be added by hand: on the **Senders** tab choose **Add**, pick the **Connection** if you have more than one, choose the **Kind** and enter it exactly as Infobip has it. Send a test from it to check it works.

Kirora syncs every day. To see a new sender straight away, choose **Sync senders** from the connection's menu on **Integrations › Infobip**.

## Send a test

1. As an owner or admin, open a sender's menu on the **Senders** tab and choose **Send a test**.
2. Pick a contact with a phone number and choose **Send test**.
3. If you send from a number, reply STOP from that phone, then START. Kirora records the opt-out, then lifts it, and the number changes to **STOP works**.

Tests aren't kept as messages, so look for delivery reports on your first campaign or transactional text.

## When a send fails

Kirora shows Infobip's reason with every failed message. The ones you're most likely to meet:

| Infobip status | What it means | What to do |
| --- | --- | --- |
| `REJECTED_NOT_ENOUGH_CREDITS`, `REJECTED_PREPAID_PACKAGE_EXPIRED` | The account is out of credit | Top up in Infobip. Marketing texts wait and resume on their own. |
| `REJECTED_SOURCE` | The sender isn't registered on the account | Register it with Infobip, or pick another sender |
| `REJECTED_SENDER` | The sender is blocked on the account | Ask Infobip why |
| `REJECTED_DESTINATION`, `REJECTED_PREFIX_MISSING` | The number is invalid, or has a wrong prefix or length | Correct the contact's number |
| `REJECTED_DND` | The number is on a do-not-disturb list | Nothing to do in Kirora: the contact chose this at their carrier |
| `EC_UNKNOWN_SUBSCRIBER`, `EC_DEST_ADDRESS_UNABLE_TO_RECEIVE_SMS` | The number doesn't exist, or can't receive SMS | Kirora stops texting that number |
| `EC_ABSENT_SUBSCRIBER` | The phone was off or out of reach | Nothing: it may arrive next time |
| `EXPIRED_EXPIRED` | The message expired before it was delivered | Nothing: try again later |

If Kirora can't check your key at all, the key was refused or lacks a scope: **Replace credentials** with one that has the scopes above. See also [Troubleshoot SMS](https://kirora.io/docs/guides/messaging/sms/troubleshoot-sms).

## Next steps

- [Choose and register your senders](https://kirora.io/docs/guides/messaging/sms/senders-and-registration)
- [Write and send an SMS](https://kirora.io/docs/guides/messaging/sms/send-sms)
- [Send each country from its own sender](https://kirora.io/docs/guides/messaging/sms/sender-groups)