# Contact Center Smart Embed
The Contact Center Smart Embed (CCSE, or Smart Embed) is a fast and flexible solution that lets developers quickly embed a softphone for Contact Center in their third-party web application.
- Administrators can allow third-party applications to use the app when they install it and configure approved domains.
- End users can sign in to the Smart Embed in their third-party app by using their Zoom credentials.
Learn to add Smart Embed to your web applications that control the Smart Embed, such as click-to-call, receive calls, notifications for inbound and outbound calls, auto call logging, and support for custom notes pages.
## Prerequisites
- You must have a [Contact Center license](https://zoom.us/pricing/zoom-contact-center).
- Administrators must be able to access Zoom to configure an integration in Contact Center for Contact Center Smart Embed.
- Smart Embed is an iframe based web solution that communicates with the parent web application by exchanging `postMessage` events. The web application where Smart Embed is embedded must support this type of integration.
### Supported platforms
- Browser-based apps - Chrome, Edge
### Supported channels
- Voice
- Video
- Web chat
- SMS
- Work item
## Add Smart Embed to your web apps
Add Contact Center Smart Embed to third-party web apps with a code snippet.
1. Embed the Computer Telephony Integration (CTI) iframe into your web page or web application. For the origin parameter in the `src` attribute, include the domain where this iframe will be embedded.
If your company uses single sign-on (SSO) via SAML integration with your Zoom account, and requires your call center agents to authenticate to Zoom through your SSO system, streamline your agents' Smart Embed login process by editing the iframe's `src` attribute and inserting your company's vanity URL and `.` right after the `https://`. For example, if your company's vanity URL is `VanityURL`
`https://zoom.us/cci/callbar/crm/?origin=https://YOUR_DOMAIN`
becomes
`https://VanityURL.zoom.us/cci/callbar/crm/?origin=https://YOUR_DOMAIN`.
```html
```
```html
```
2. Set the initial size using CSS.
```html
```
## Control the Smart Embed
The Contact Center Smart Embed provides APIs that let you control the softphone. Use these APIs to add these features.
- Initialize the Smart Embed interface
- Resize softphone
- Contact search
- Click-to-call
- Receive a call
- Screen popup
- Inbound and outbound call notifications
- Support to add a custom notes page to a softphone
- Call recording
- Wrap-up done
- Get the value from global custom variables
Once you've initialized Smart Embed, your app is ready to start sending and receiving messages. The Contact Center Smart Embed provides some events based on the `postMessage` API.
```javascript
window.addEventListener("message", (e) => {
const data = e.data;
if (data) {
switch (data.type) {
case "zcc-contact-search-event": // listen to all the event types that you need
console.log(data.data);
break;
}
}
});
```
## Events
Contact Center Smart Embed provides these events.
- [`zcc-init-config-request`](#zcc-init-config-request)
- [`zcc-init-config-response`](#zcc-init-config-response)
- [`zcc-resize`](#zcc-resize)
- [`zcc-contact-search-event`](#zcc-contact-search-event)
- [`zcc-contact-search-response`](#zcc-contact-search-response)
- [`zcc-call-ringing`](#zcc-call-ringing)
- [`zcc-incomingPhone-request`](#zcc-incomingphone-request)
- [`zcc-incomingPhone-response`](#zcc-incomingphone-response)
- [`zcc-screen-pop`](#zcc-screen-pop)
- [`zcc-call-connected`](#zcc-call-connected)
- [`zcc-call-ended`](#zcc-call-ended)
- [`zcc-end-post-engagement` (Deprecated)](#zcc-end-post-engagement-deprecated)
- [`zcc-phone-call-log`](#zcc-phone-call-log)
- [`zcc-call-recording`](#zcc-call-recording)
- [Click to dial from a third-party app](#click-to-dial-from-a-third-party-app)
- [`zcc-incomingEmail-request`](#zcc-incomingemail-request)
- [`zcc-incomingEmail-response`](#zcc-incomingemail-response)
- [`zcc-chat-ringing`](#zcc-chat-ringing)
- [`zcc-chat-started`](#zcc-chat-started)
- [`zcc-chat-ended`](#zcc-chat-ended)
- [`zcc-video-ringing`](#zcc-video-ringing)
- [`zcc-video-started`](#zcc-video-started)
- [`zcc-video-ended`](#zcc-video-ended)
- [`zcc-add-note`](#zcc-add-note)
- [`zcc-sms-ringing`](#zcc-sms-ringing)
- [`zcc-sms-started`](#zcc-sms-started)
- [`zcc-sms-ended`](#zcc-sms-ended)
- [`zcc-outbound-call-started`](#zcc-outbound-call-started)
- [`zcc-inbound-not-connected`](#zcc-inbound-not-connected)
- [`zcc-outbound-not-connected`](#zcc-outbound-not-connected)
- [`zcc-reject-engagement`](#zcc-reject-engagement)
- [`zcc-accept-engagement`](#zcc-accept-engagement)
- [`zcc-terminate-engagement`](#zcc-terminate-engagement)
- [`zcc-set-engagement-disposition`](#zcc-set-engagement-disposition)
- [`zcc-close-engagement-wrapup`](#zcc-close-engagement-wrapup)
- [`zcc-engagement-status-request`](#zcc-engagement-status-request)
- [`zcc-engagement-status-response`](#zcc-engagement-status-response)
- [`zcc-engagement-log-url`](#zcc-engagement-log-url)
- [`zcc-set-mute`](#zcc-set-mute)
- [`zcc-set-hold`](#zcc-set-hold)
- [`zcc-send-dtmf`](#zcc-send-dtmf)
- [`zcc-set-recording`](#zcc-set-recording)
- [`zcc-transfer-engagement`](#zcc-transfer-engagement)
- [`zcc-add-call`](#zcc-add-call)
- [`zcc-cancel-consult`](#zcc-cancel-consult)
- [`zcc-complete-transfer`](#zcc-complete-transfer)
- [`zcc-merge-consult`](#zcc-merge-consult)
- [`zcc-upgrade-to-video`](#zcc-upgrade-to-video)
- [`zcc-get-disposition-codes`](#zcc-get-disposition-codes)
### zcc-init-config-request
This event fires when an agent loads a webpage with Smart Embed.
```javascript
{
type: "zcc-init-config-request",
}
```
In response to the `zcc-init-config-request` event, your application will need to respond to Smart Embed using the `zcc-init-config-response` message.
### zcc-init-config-response
When your application receives a `zcc-init-config-request`, your application responds back via `postMessage` with the `zcc-init-config-response` object, which contains your configuration's necessary implementation.
```javascript
{
type: "zcc-init-config-response",
data: {
phone: {
screenPopEvent: "RINGING",
},
},
}
```
### zcc-resize
This event fires when a user toggles the size buttons in Smart Embed. Use this to resize your web application.
```javascript
{
type: "zcc-resize",
data: {
widthInPixels,
heightInPixels,
},
};
```
### zcc-contact-search-event
The `zcc-contact-search-event` fires when Smart Embed needs to resolve phone numbers or email addresses against your web application. This can happen when the agent types in the Smart Embed dialpad's `Phone` or `User` field. This can also happen when Smart Embed loads and there are existing engagements that Smart Embed needs to link to your web application. This event allows Smart Embed to resolve or populate phone numbers and email addresses against user, contact, lead, or similar objects in your application.
```javascript
{
type: "zcc-contact-search-event",
data: {
query: "DATA_TO_SEARCH", // could be a phone number, first name, last name, email, etc.
},
}
```
In response to the `zcc-contact-search-event` event, your application should search for a matching user, contact, lead, or similar object based on the query field. Your application should respond to Smart Embed using the `zcc-contact-search-response` message. This information will be used by Smart Embed to display data to the agent within the Contact Center Smart Embed UI.
### zcc-contact-search-response
This is an example of the message that your application should send in response to receiving the `zcc-contact-search-event` event. This response allows Smart Embed to resolve or display your web application's user, contact, lead, or similar object within the Smart Embed UI.
```javascript
{
type: "zcc-contact-search-response",
data: {
id: "THIRD_PARTY_ID", // This is displayed visually to the Contact Center agent in the Smart Embed UI
name: "NAME", // This is displayed visually to the Contact Center agent in the Smart Embed UI
phone: "PHONE_NUMBER", // Phone number for the user, contact, lead, etc
email: "YOUR_STRING", // Email address for the user, contact, lead, etc
entity: "YOUR_STRING", // The type of entity used by your application, for example contact/lead/user/etc. Smart Embed uses this to display to the Contact Center agent, but does not use this for any other purpose.
},
}
```
### zcc-call-ringing
This event fires when an agent receives a call. Replace the YOUR_STRING segments with your data.
```javascript
{
type: "zcc-call-ringing",
data: {
channel: ,
createTs: ,
engagementId: YOUR_CALL_ENGAGEMENT_ID,
from: YOUR_CALLER_PHONE_NUMBER,
queueName: YOUR_QUEUE_NAME,
to: YOUR_CALLEE_PHONE_NUMBER,
isConference: ,
isTransfer: ,
},
}
```
### zcc-incomingPhone-request
This event fires when an agent gets an incoming call. It supports the voice channel, and the SMS channel.
```javascript
{
type: "zcc-incomingPhone-request",
data: {
incomingPhoneNumber: YOUR_CALLER_PHONE_NUMBER,
engagementId: YOUR_CALL_ENGAGEMENT_ID,
channel: "voice", // Possible values: 'voice', 'sms'
},
}
```
To process that message from Smart Embed, search for matching contact records in your application. After processing, your web application should send a response back to Smart Embed using the `zcc-incomingPhone-response` event. If there is no matching record in your application, respond using the `zcc-incomingPhone-response` event with an empty array.
### zcc-incomingPhone-response
This event allows Smart Embed to display matching contact information within the Smart Embed iframe. If there are multiple objects in the array, they will be displayed to the Contact Center agent for them to select the appropriate match.
```javascript
{
type: "zcc-incomingPhone-response",
data: [
{
id: YOUR_ID,
name: YOUR_NAME,
phone: YOUR_PHONE_NUMBER,
email: YOUR_EMAIL_ID,
entity: YOUR_ENTITY, // the type of entity used by your application, such as contact, lead, user, etc.
},
],
}
```
The data included in the above event is displayed to the agent within the Contact Center Smart Embed UI. Additionally, this data is included in the final `zcc-phone-call-log` event so that you can log the call data against the contact within your CRM. The `entity` field can be used to identify the type of contact within your application. For example, some web applications have the concept of "contacts" or "leads". There is no change in the Smart Embed functionality based on the entity field, however it is included in the phone call log event which you can use for logging purposes.
### zcc-screen-pop
The `zcc-screen-pop` event fires in the multiple match scenario. This happens when an incoming call comes into the agent, and the `zcc-incomingPhone-response` includes multiple contact, lead, or user objects in the array. When this happens, the Smart Embed UI presents the objects to the agent. When the agent identifies and selects the appropriate object, this event is then fired back to your application so that you can screen pop to the correct object.
```javascript
{
type: "zcc-screen-pop",
data: {
id: ID_NUMBER,
},
}
```
When your web application receives this event, search your web application for a matching record and perform a screen pop as needed.
### zcc-call-connected
This event fires when a call is accepted.
```javascript
{
type: "zcc-call-connected",
data: {
acceptTs: ACCEPT_TS_NUMBER,
direction: ,
engagementId: ENGAGEMENT_ID,
from: CALLER_PHONE_NUMBER,
queueId: THE_QUEUE_ID,
queueName: THE_QUEUE_NAME,
to: CALLEES_PHONE_NUMBER,
},
}
```
### zcc-call-ended
This event fires when a call ends.
```javascript
{
type: "zcc-call-ended",
data: {
completeTs: COMPLETE_TS_NUMBER,
engagementId: ENGAGEMENT_ID,
},
}
```
### zcc-end-post-engagement (Deprecated)
```javascript
{
type: "zcc-end-post-engagement",
data: {
name: YOUR_DISPOSITION,
engagementId: ENGAGEMENT_ID,
},
}
```
### zcc-phone-call-log
This event triggers when an agent completes an engagement. Use this event to create logs for all engagement types within your application.
```javascript
{
type: "zcc-phone-call-log",
data: {
objectRecord: {
callType: ,
from: ,
to: ,
callDuration: ,
callStartTime: ,
callEndTime: ,
callQueue: ,
agentExtension: ,
agentName: ,
wrapUpTimeDuration: