# Embeddable Answers

EARLY ACCESS

Embeddable Answers enables you to deploy the full scope of Answers while simplifying the experience for your platform users. You can integrate the solution into your web application through an iFrame.

## Full experience of Answers

This option has the complete chatbot builder.

### Prerequisites

- Infobip account with Account management role.
- [Generate API key](https://portal.infobip.com/dev/api-keys)
with the following API scopes.

    - **account-management:manage** - to be able to initiate OAuth PAR flow.
    - **answers:manage** - to be able to manage Answers.
    - **voice-message:manage** - to be able to manage voicebots.

- [Create](https://portal.infobip.com/dev/application-entity) applicationId and entityId pairs as a part of using Answers with X.

### Compatibility with X [#compatibility-with-x-answers]

You can use Embeddable Answers [with or without X](https://www.infobip.com/docs/customer-engagement-with-x/answers-with-x).

### Process overview

To work with the Answers iFrame component, you need to provide a [_request URI_](#generate-request-uri-answers). This URI is used to access the Answers API. This URI is generated and injected by the backend as part of a more secure authentication flow called OAuth Pushed Authorization Requests (PAR).

You then need to add the Answers iFrame component to your webpage.

### Generate request URI [#generate-request-uri-answers]

Note
```application_id``` and ```entity_id``` are **optional** request parameters.

Follow these actions on your backend before rendering the frontend with Answers:

1. To initiate OAuth PAR flow, send a POST request to the following URL:
    ```POST https://api.infobip.com/embeddable/1/auth/par```

    Use the following headers:
    ```
    'Content-Type': 'application/json',
    'Authorization': 'App <api-key>'
    ```

    Use the following payload:
    ```
    {
    "scopes": ['answers:manage', 'voice-message:manage'],
    "application_id": "<application_id>",
    "entity_id": "<entity_id>",
    "embedding_id": "81d4b814-31ba-46aa-b842-8b07ee1221f6"
    }
    ```

    The cURL request would be as follows:
    ```
    curl --location 'https://api.infobip.com/embeddable/1/auth/par' \
    --header 'Authorization: App <api-key>' \
    --header 'Content-Type: application/json' \
    --data '{
    "scopes": [
      "answers:manage",
      "voice-message:manage"
    ],
    "application_id": "<application_id>",
    "entity_id": "<entity_id>",
    "embedding_id": "81d4b814-31ba-46aa-b842-8b07ee1221f6"
    }'
    ```

2. The response contains the object with ```request_uri``` parameter. Use this parameter in the iFrame component.

### Add the iFrame component to your web page [#add-iframe-component-answers]

Include the following iFrame component on your web page:

```
<iframe src="https://embeddings.infobip.com/authorize?request_uri={request_uri}"></iframe>
```

### Example

Refer to the [Oracle Responsys](https://www.infobip.com/docs/integrations/oracle-responsys-messaging) integration.