Provisioning API
The SnapEngage Provisioning REST API provides a method for 3rd parties to perform the following:
Users
- Create a new user account
- Get existing user account details
- Update an existing user account or find out if a user account exists
- Delete an existing user account
Widgets
Authentication for Provisioning API
A valid API key is required to use the Provisioning REST API. This key must be obtained by emailing [email protected].
Users
The Provisioning API allows you to create a SnapEngage user, get user account details, update, and delete users.
Create a new user account
To create a new user account, PUT to the endpoint with your API key as a parameter and the request payload below. You can also create account from existing account template.
PUT /api/v1/user.json?api_key={api_key}
Request Parameters
To view sample request JSON, see the JSON tab to the right.
{
"email": "[email protected]",
"name": "Jimbo Something",
"password": "12345",
"phone": "555-617-8980",
"accountType": "enterprise"
}
Data | Type | Description |
---|---|---|
String | Required. A valid email address less than 100 characters. All characters will be converted to lowercase which is how the user will need to log in. | |
name | String | Required. A valid name less than 100 characters. |
accountType | String | Required. Requires specific values that are case-sensitive, see the table below of "accountType values". |
password | String | Required. A valid password that is 5-99 characters. |
phone | String | A valid phone number. |
templateId | String | You can create a new account from existing account. If you pass the template id then accountType won't be considered and account type from the template account will be used. |
accountType values
To learn more about account types, see our pricing page.
accountType | Value |
---|---|
Free Trial | 'trial' |
Business | 'biz' |
Plus | 'entr' |
Premier | 'prem' |
Enterprise | 'enterprise' |
Sample Request
To view an example request, click one of the language tabs on the right.
curl -X PUT \
'https://www.snapengage.com/api/v1/user.json?api_key={api_key}' \
-H 'Content-Type: application/json' \
-d '{
"email" : "{user_email}",
"name" : "Jimbo Something",
"password" : "12345",
"phone" : "555-617-8980",
"accountType" : "enterprise"
}'
package com.snapengage.samples;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.Entity;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
public class Example {
private static final String apiKey = "{api_key}";
public static void main(String[] args) {
SnapEngageUser snapEngageUser = new SnapEngageUser("{user_email}", "Jimbo Something",
"enterprise", "12345", "555-617-8980");
WebTarget webTarget = ClientBuilder.newBuilder().build()
.target("https://www.snapengage.com/api/v1/user.json?api_key=" + apiKey);
Response response =
webTarget.request().put(Entity.entity(snapEngageUser, MediaType.APPLICATION_JSON));
SnapEngageUser responseUser = response.readEntity(SnapEngageUser.class);
System.out.println(responseUser.toJson());
}
}
// Note: This object is used in all of the Java code samples for the (User) Provisioning API.
package com.snapengage.samples;
import com.google.gson.Gson;
public class SnapEngageUser {
private String email;
private String name;
private String accountType;
private String password;
private String phone;
public SnapEngageUser() {
// no-args constructor required for json serialization/de-serialization
}
public SnapEngageUser(String email, String name, String accountType, String password,
String phone) {
this.email = email;
this.name = name;
this.accountType = accountType;
this.password = password;
this.phone = phone;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAccountType() {
return accountType;
}
public void setAccountType(String accountType) {
this.accountType = accountType;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String toJson() {
return new Gson().toJson(this);
}
}
import requests
url = "https://www.snapengage.com/api/v1/user.json"
querystring = {"api_key": "{api_key}"}
payload = '{"email" : "{user_email}", "name" : "Jimbo Something", "password" : "12345",' \
'"phone" : "555-617-8980", "accountType" : "enterprise"}'
response = requests.request("PUT", url, data=payload, params=querystring)
print(response.text)
Response Parameters
To view sample response JSON, see the JSON tab to the right.
{
"email": "[email protected]",
"name": "Jimbo Something",
"phone": "555-617-8980",
"accountType": "enterprise"
}
Data | Type | Description |
---|---|---|
String | The user's email address. All characters will be converted to lowercase. | |
name | String | The user's name. |
phone | String | The user's telephone number. |
accountType | String | The user's accountType. See "accountType values" table above. |
Success Response
201 Created
Get user account details or check if user exists
To get a new user account or check if it exists, GET to the endpoint with your API key and the user email address as parameters.
GET /api/v1/user.json?api_key={api_key}&email={user_email}
Request Parameters
Data | Type | Description |
---|---|---|
String | Required. A valid email address of an existing user. All characters will be converted to lowercase which is how the user will need to log in. |
Sample Request
To view an example request, click one of the language tabs on the right.
curl -X GET 'https://www.snapengage.com/api/v1/user.json?api_key={api_key}&email={user_email}'
package com.snapengage.samples;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.Entity;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
public class Example {
private static final String apiKey = "{api_key}";
public static void main(String[] args) {
String email = "{user_email}";
WebTarget webTarget = ClientBuilder.newBuilder().build().target(
"https://www.snapengage.com/api/v1/user.json?api_key=" + apiKey + "&email=" + email);
Response response = webTarget.request().get();
SnapEngageUser responseUser = response.readEntity(SnapEngageUser.class);
System.out.println(responseUser.toJson());
}
}
import requests
url = "https://www.snapengage.com/api/v1/user.json"
querystring = {"api_key": "{api_key}", "email": "{user_email}"}
response = requests.request("GET", url, params=querystring)
print(response.text)
Response Parameters
To view sample response JSON, see the JSON tab to the right.
{
"email": "[email protected]",
"name": "Jimbo Something",
"phone": "555-617-8980",
"accountType": "enterprise"
}
Data | Type | Description |
---|---|---|
String | The user's email address. All characters will be converted to lowercase. | |
name | String | The user's name. |
phone | String | The user's phone number. |
accountType | String | The user's accountType. See "accountType values" table above. |
Success Response
200 OK
Update an existing user account
To update an existing user account, POST to the endpoint with your API key as a parameter and the request payload below.
POST /api/v1/user.json?api_key={api_key}
Request Parameters
To view sample request JSON, see the JSON tab to the right.
{
"email": "[email protected]",
"name": "Jimbo Something",
"password": "12345",
"phone": "555-617-8980",
"accountType": "enterprise"
}
Data | Type | Description |
---|---|---|
String | Required. A valid email address of an existing user. All characters will be converted to lowercase which is how the user will need to log in. | |
name | String | Required. A valid name less than 100 characters. |
accountType | String | Requires specific values that are case-sensitive, see the table above of "accountType values". |
password | String | A valid password that is 5-99 characters. |
phone | String | A valid phone number. |
Sample Request
To view an example request, click one of the language tabs on the right.
curl -X POST \
'https://www.snapengage.com/api/v1/user.json?api_key={api_key}' \
-H 'Content-Type: application/json' \
-d '{
"email" : "{user_email}",
"name" : "Jimbo Something",
"password" : "12345",
"phone" : "555-617-8980",
"accountType" : "enterprise"
}'
package com.snapengage.samples;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.Entity;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
public class Example {
private static final String apiKey = "{api_key}";
public static void main(String[] args) {
SnapEngageUser snapEngageUser = new SnapEngageUser("{user_email}", "Jimbo Something",
"prem", "12345", "555-617-8980");
WebTarget webTarget = ClientBuilder.newBuilder().build()
.target("https://www.snapengage.com/api/v1/user.json?api_key=" + apiKey);
Response response =
webTarget.request().post(Entity.entity(snapEngageUser, MediaType.APPLICATION_JSON));
SnapEngageUser responseUser = response.readEntity(SnapEngageUser.class);
System.out.println(responseUser.toJson());
}
}
import requests
url = "https://www.snapengage.com/api/v1/user.json"
querystring = {"api_key": "{api_key}"}
payload = '{"email" : "{user_email}", "name" : "Jimbo Something", "password" : "12345", "phone" : "555-617-8980", ' \
'"accountType" : "prem"}'
response = requests.request("POST", url, data=payload, params=querystring)
print(response.text)
Response Parameters
To view sample response JSON, see the JSON tab to the right.
{
"email": "[email protected]",
"name": "Jimbo Something",
"phone": "555-617-8980",
"accountType": "enterprise"
}
Data | Type | Description |
---|---|---|
String | The user's email address. All characters will be converted to lowercase which is how the user will need to log in. | |
name | String | The user's name. |
accountType | String | The user's accountType. See "accountType values" table above. |
phone | String | The user's phone number. |
Success Response
200 OK
Delete an existing user account
To delete a user account, DELETE to the endpoint with your API key and the user email as parameters.
DELETE /api/v1/user.json?api_key={api_key}&email={user_email}
Request Parameters
Data | Type | Description |
---|---|---|
String | Required. A valid email address of an existing user (less than 100 characters). All characters will be converted to lowercase. |
Sample Request
To view an example request, click one of the language tabs on the right.
curl -X DELETE 'https://www.snapengage.com/api/v1/user.json?api_key={api_key}&email={user_email}'
package com.snapengage.samples;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.Entity;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
public class Example {
private static final String apiKey = "{api_key}";
public static void main(String[] args) {
WebTarget webTarget = ClientBuilder.newBuilder().build().target(
"https://www.snapengage.com/api/v1/user.json?api_key=" + apiKey + "&email={user_email}");
webTarget.request().delete();
}
}
import requests
url = "https://www.snapengage.com/api/v1/user.json"
querystring = {"api_key": "{api_key}", "email": "{user_email}"}
response = requests.request("DELETE", url, params=querystring)
print(response.text)
Response Parameters
No response payload is returned.
Success Response
200 OK
Widgets
The Provisioning REST API allows you to create a SnapEngage widget, get widget details, update, and delete widgets.
Create a new widget
PUT /api/v1/widget.json?api_key={api_key}
Request Parameters
To view sample request JSON, see the JSON tab to the right.
{
"email": "[email protected]",
"destinationEmail": "[email protected]",
"name": "Widget #1",
"agents": [
{
"agentId": "[email protected]",
"agentAlias": "An Agent",
"agentAvatar": "https://www.website.com/charlie.png",
"agentType": "webclient"
}
],
"enableProactiveChat": "true",
"enableConversations": true,
"conversationSchedule": {
"timeZone": "US/Mountain",
"schedules": [
{
"dayOfWeek": "MONDAY",
"enabled": true,
"scheduleList": ["8:00 AM","5:00 PM"]
},
{
"dayOfWeek": "TUESDAY",
"enabled": true,
"scheduleList": ["8:00 AM","5:00 PM"]
}
]
}
}
Data | Type | Description |
---|---|---|
String | Required. An existing user account email address. All characters will be converted to lowercase. | |
name | String | A valid widget name less than 100 characters. |
destinationEmail | String | The email where transcripts are sent. |
agents | List | Required. At least one agent is required. Each agent must contain the below fields (agentId , agentAlias , agentAvatar , agentType ). |
↳ agentId | String | Required. The agent ID. All characters will be converted to lowercase which is how the user will need to log in. |
↳ agentAlias | String | Required. The agent displayed name. |
↳ agentAvatar | String | Required. Link to an agent image. |
↳ agentType | String | Required. See table of "agentType values" below. |
onlineButtonUrl | String | Deprecated Link to an online button image. This field has been deprecated due to it being part of the now-deprecated legacy chat design. Any value passed will be ignored and this field will remain null on the widget. |
offlineButtonUrl | String | Deprecated Link to an offline button image. This field has been deprecated due to it being part of the now-deprecated legacy chat design. Any value passed will be ignored and this field will remain null on the widget. |
enableProactiveChat | String | If true proactive chat is enabled for the widget. If false it is not. |
enableConversations | boolean | If true chat is enabled for the widget. If false it is not. |
proactiveSettings | String | Deprecated May contain the below fields (delayInSec , message ). This field has been deprecated due to it being part of the now-deprecated Proactive Chat V1 settings. Any value passed will be ignored and this field will be null on the widget. All widgets created using this endpoint will be given default Proactive Chat V2 settings. |
↳ delayInSec | String | Deprecated The time in seconds to delay a proactive invitation. Default is 45 . This field has been deprecated for the same reason as stated above (see 'proactiveSettings'). Any value passed will be ignored and this field will be null on the widget. |
↳ message | String | Deprecated The proactive message to display. This field has been deprecated for the same reason as stated above (see 'proactiveSettings'). Any value passed will be ignored and this field will be null on the widget. |
conversationSchedule | Json | This will contain the schedule for the conversations. |
↳ timeZone | String | Time zone for the hours of operation. example ("Europe/Berlin", "UTC", "Asia/Kolkata") |
↳ schedules | List | List of schedule(s). This will contain the properties (dayOfWeek , enabled , scheduleList ). Note that there can be multiple entries for a given day to accomodate for things like lunch hours, day and evening shifts, etc. |
↳↳ dayOfWeek | String | Represents the days of the schedule. Available values for are MONDAY , TUESDAY , WEDNESDAY , THURSDAY , FRIDAY , SATURDAY , SUNDAY . |
↳↳ enabled | boolean | If true this time period will be evalulated. |
↳↳ scheduleList | List | Start and end time using h:mm AM/PM format |
agentType values
accountType | Value |
---|---|
Hub User | 'webclient' |
GChat User (Deprecated) | 'google' |
Skype User (Deprecated) | 'skype' |
Sample Request
To view an example request, click one of the language tabs on the right.
curl -X PUT \
'https://www.snapengage.com/api/v1/widget.json?api_key={api_key}' \
-H 'Content-Type: application/json' \
-d '{
"email": "[email protected]",
"destinationEmail": "[email protected]",
"name": "Widget #1",
"agents":[
{
"agentId": "[email protected]",
"agentAlias": "A New Agent",
"agentAvatar": "https://www.website.com/a_new_agent_avatar.png",
"agentType": "webclient"
}
],
"enableProactiveChat": "true",
"enableConversations": true,
"conversationSchedule": {
"timeZone": "US/Mountain",
"schedules": [
{
"dayOfWeek": "MONDAY",
"enabled": true,
"scheduleList": ["9:00 AM","12:00 PM"]
},
{
"dayOfWeek": "MONDAY",
"enabled": true,
"scheduleList": ["1:00 PM","5:00 PM"]
}
]
}
}'
package com.snapengage.samples.widget;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.Entity;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
public class WidgetExample {
private static final String apiKey = "{api_key}";
public static void main(String[] args) {
List<SnapEngageAgent> agentList = new ArrayList<>();
agentList.addAll(Arrays.asList(
new SnapEngageAgent("12345", "Jimbo", "https://www.website.com/jimbo.png", "webclient")));
SnapEngageWidget snapEngageWidget =
new SnapEngageWidget("{user_email}", "Jimbo's Widget", "{user_email}", agentList, true);
WebTarget webTarget = ClientBuilder.newBuilder().build()
.target("https://www.snapengage.com/api/v1/widget.json?api_key=" + apiKey);
Response response =
webTarget.request().put(Entity.entity(snapEngageWidget, MediaType.APPLICATION_JSON));
SnapEngageWidget responseWidget = response.readEntity(SnapEngageWidget.class);
System.out.println(responseWidget.toJson());
}
}
// Note: This object is used in all of the Java code samples for the (Widget) Provisioning API.
package com.snapengage.samples.widget;
import java.util.List;
import com.google.gson.Gson;
public class SnapEngageWidget {
private String email;
private String name;
private String destinationEmail;
private List<SnapEngageAgent> agents;
private String uuid;
private boolean enableProactiveChat;
public SnapEngageWidget() {
// no-args constructor required for json serialization/de-serialization
}
public SnapEngageWidget(String email, String name, String destinationEmail, List<SnapEngageAgent> agents,
boolean enableProactiveChat) {
this.email = email;
this.name = name;
this.destinationEmail = destinationEmail;
this.agents = agents;
this.enableProactiveChat = enableProactiveChat;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDestinationEmail() {
return destinationEmail;
}
public void setDestinationEmail(String destinationEmail) {
this.destinationEmail = destinationEmail;
}
public List<SnapEngageAgent> getAgents() {
return agents;
}
public void setAgents(List<SnapEngageAgent> agents) {
this.agents = agents;
}
public boolean getEnableProactiveChat() {
return enableProactiveChat;
}
public void setEnableProactiveChat(boolean enableProactiveChat) {
this.enableProactiveChat = enableProactiveChat;
}
public String getUuid() {
return uuid;
}
public void setUuid(String uuid) {
this.uuid = uuid;
}
public String toJson() {
return new Gson().toJson(this);
}
}
import requests
url = "https://www.snapengage.com/api/v1/widget.json"
querystring = {"api_key": "{api_key}"}
payload = '{ "email" : "[email protected]", "destinationEmail" : "[email protected]", "name" : "A New Widget!",' \
'"agents" : [{ "agentId" : "[email protected]", "agentAlias" : "A New Agent",' \
'"agentAvatar" : "https://www.website.com/a_new_agent_avatar.png", "agentType" : "webclient" }],' \
'"enableProactiveChat" : "true"}'
response = requests.request("PUT", url, data=payload, params=querystring)
print(response.text)
Response Parameters
To view sample response JSON, see the JSON tab to the right.
{
"name": "Widget #1",
"email": "[email protected]",
"destinationEmail": "[email protected]",
"uuid": "31a11b98-ffd2-425d-aa69-2c6ff8a40a16",
"agents": [
{
"agentId": "wc:[email protected]",
"agentAlias": "A New Agent",
"agentAvatar": "https://www.website.com/a_new_agent_avatar.png",
"agentType": "webclient"
}
],
"enableProactiveChat": "true",
"enableConversations": true
}
Data | Type | Description |
---|---|---|
name | String | The widget name. |
String | The user account email address. All characters will be converted to lowercase. | |
destinationEmail | String | The email where transcripts are sent. |
uuid | String | The widget id. |
agents | List | The list of agent(s) on this widget. Each agent includes the below fields (agentId , agentAlias , agentAvatar , agentType ). |
↳ agentId | String | The agent ID. All characters will be converted to lowercase. |
↳ agentAlias | String | The agent displayed name. |
↳ agentAvatar | String | Link to an agent image. |
↳ agentType | String | See table of "agentType values" below. |
enableProactiveChat | String | If true proactive chat is enabled for the widget. If false it is not. |
Success Response
201 Created
Get widget details
To get widget's details, GET to the endpoint with your API key, the widget id, and the user email address as parameters.
GET /api/v1/widget.json?api_key={api_key}&uuid={widget_id}&email={user_email}
Request Parameters
Data | Type | Description |
---|---|---|
uuid | String | Required. The widget public Id. |
String | Required. The user email associated with this widget. All characters will be converted to lowercase. |
Sample Request
To view an example request, click one of the language tabs on the right.
curl -X GET \
'https://www.snapengage.com/api/v1/widget.json?api_key={api_key}&uuid=31a11b98-ffd2-425d-aa69-2c6ff8a40a16&[email protected]'
package com.snapengage.samples.widget;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.Entity;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
public class WidgetExample {
private static final String apiKey = "{api_key}";
public static void main(String[] args) {
WebTarget webTarget = ClientBuilder.newBuilder().build()
.target("https://www.snapengage.com/api/v1/widget.json?api_key=" + apiKey +
"&uuid={widget_id}&email={user_email}");
Response response = webTarget.request().get();
SnapEngageWidget responseWidget = response.readEntity(SnapEngageWidget.class);
System.out.println(responseWidget.toJson());
}
}
import requests
url = "https://www.snapengage.com/api/v1/widget.json"
querystring = {"api_key" : "{api_key}", "uuid" : "31a11b98-ffd2-425d-aa69-2c6ff8a40a16", "email" : "[email protected]"}
response = requests.request("GET", url, params=querystring)
print(response.text)
Response Parameters
To view sample response JSON, see the JSON tab to the right.
{
"name": "Widget #1",
"email": "[email protected]",
"destinationEmail": "[email protected]",
"uuid": "31a11b98-ffd2-425d-aa69-2c6ff8a40a16",
"agents": [
{
"agentId": "wc:[email protected]",
"agentAlias": "A New Agent",
"agentAvatar": "https://www.website.com/a_new_agent_avatar.png",
"agentType": "webclient"
}
],
"enableProactiveChat": "true"
}
Data | Type | Description |
---|---|---|
name | String | The widget name. |
String | The user account email address. All characters will be converted to lowercase. | |
destinationEmail | String | The email where transcripts are sent. |
uuid | String | The widget id. |
agents | List | The list of agent(s) on this widget. Each agent includes the below fields (agentId , agentAlias , agentAvatar , agentType ). |
↳ agentId | String | The agent ID. All characters will be converted to lowercase. |
↳ agentAlias | String | The agent displayed name. |
↳ agentAvatar | String | Link to an agent image. |
↳ agentType | String | See table of "agentType values" below. |
enableProactiveChat | String | If true proactive chat is enabled for the widget. If false it is not. |
Success Response
200 OK
Update an existing widget
To update an existing widget, POST to the endpoint with your API key as a parameter and the request payload below.
POST /api/v1/widget.json?api_key={api_key}
Request Parameters
To view sample request JSON, see the JSON tab to the right.
{
"email": "[email protected]",
"destinationEmail": "[email protected]",
"name": "Widget #1 - Sales Widget",
"uuid": "31a11b98-ffd2-425d-aa69-2c6ff8a40a16",
"agents": [
{
"agentId": "[email protected]",
"agentAlias": "A New Agent",
"agentAvatar": "https://www.website.com/a_new_agent_avatar.png",
"agentType": "webclient"
}
],
"enableProactiveChat": "false",
"enableConversations": true,
"conversationSchedule": {
"timeZone": "US/Mountain",
"schedules": [
{
"dayOfWeek": "MONDAY",
"enabled": true,
"scheduleList": ["9:00 AM","12:00 PM"]
},
{
"dayOfWeek": "MONDAY",
"enabled": true,
"scheduleList": ["1:00 PM","5:00 PM"]
}
]
}
}
Data | Type | Description |
---|---|---|
String | Required. An existing user account email address. All characters will be converted to lowercase. | |
uuid | String | Required. The id of the widget to be updated. |
name | String | A valid widget name less than 100 characters. |
destinationEmail | String | The email where transcripts are sent |
agents | List | Required. At least one agent is required. Each agent must contain the below fields (agentId , agentAlias , agentAvatar , agentType ). |
↳ agentId | String | Required. The agent ID. All characters will be converted to lowercase. |
↳ agentAlias | String | Required. The agent displayed name. |
↳ agentAvatar | String | Required. Link to an agent image. |
↳ agentType | String | Required. See table of "agentType values" below. |
onlineButtonUrl | String | Deprecated Link to an online button image. This field has been deprecated due to it being part of the now-deprecated legacy chat design. Any value passed will be ignored and this field will remain null on the widget. |
offlineButtonUrl | String | Deprecated Link to an offline button image. This field has been deprecated due to it being part of the now-deprecated legacy chat design. Any value passed will be ignored and this field will remain null on the widget. |
enableProactiveChat | String | If true proactive chat is enabled for the widget. If false it is not. |
enableConversations | boolean | If true chat is enabled for the widget. If false it is not. |
proactiveSettings | String | Deprecated May contain the below fields (delayInSec , message ). This field has been deprecated due to it being part of the now-deprecated Proactive Chat V1 settings. Any value passed will be ignored and this field will be null on the widget. All widgets updated using this endpoint will be given default Proactive Chat V2 settings. |
↳ delayInSec | String | Deprecated The time in seconds to delay a proactive invitation. Default is 45 . This field has been deprecated for the same reason as stated above (see 'proactiveSettings'). Any value passed will be ignored and this field will be null on the widget. |
↳ message | String | Deprecated The proactive message to display. This field has been deprecated for the same reason as stated above (see 'proactiveSettings'). Any value passed will be ignored and this field will be null on the widget. |
conversationSchedule | Json | This will contain the schedule for the conversations. |
↳ timeZone | String | Time zone for the hours of operation. example ("Europe/Berlin", "UTC", "Asia/Kolkata") |
↳ schedules | List | List of schedule(s). This will contain the properties (dayOfWeek , enabled , scheduleList ). Note that there can be multiple entries for a given day to accomodate for things like lunch hours, day and evening shifts, etc. |
↳↳ dayOfWeek | String | Represents the days of the schedule. Available values for are MONDAY , TUESDAY , WEDNESDAY , THURSDAY , FRIDAY , SATURDAY , SUNDAY . |
↳↳ enabled | boolean | If true this time period will be evalulated. |
↳↳ scheduleList | List | Start and end time using h:mm AM/PM format |
Sample Request
To view an example request, click one of the language tabs on the right.
curl -X POST \
'https://www.snapengage.com/api/v1/widget.json?api_key={api_key}' \
-H 'Content-Type: application/json' \
-d '{
"email": "[email protected]",
"destinationEmail": "[email protected]",
"name": "Widget #1 - Sales Widget",
"uuid": "31a11b98-ffd2-425d-aa69-2c6ff8a40a16",
"agents":[
{
"agentId": "[email protected]",
"agentAlias": "A New Agent",
"agentAvatar": "https://www.website.com/a_new_agent_avatar.png",
"agentType": "webclient"
}
],
"enableProactiveChat": "false",
"enableConversations": true
}'
package com.snapengage.samples.widget;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.Entity;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
public class WidgetExample {
private static final String apiKey = "{api_key}";
public static void main(String[] args) {
List<SnapEngageAgent> agentList = new ArrayList<>();
agentList.addAll(Arrays.asList(
new SnapEngageAgent("12345", "Jimbo", "https://www.website.com/jimbo.png", "webclient")));
SnapEngageWidget snapEngageWidget =
new SnapEngageWidget("{user_email}", "Jimbo's US Widget", "{user_email}", agentList, true);
snapEngageWidget.setUuid("{widget_id}");
WebTarget webTarget = ClientBuilder.newBuilder().build()
.target("https://www.snapengage.com/api/v1/widget.json?api_key=" + apiKey);
Response response =
webTarget.request().post(Entity.entity(snapEngageWidget, MediaType.APPLICATION_JSON));
SnapEngageWidget responseWidget = response.readEntity(SnapEngageWidget.class);
System.out.println(responseWidget.toJson());
}
}
Response Parameters
To view sample response JSON, see the JSON tab to the right.
{
"name": "Widget #1 - Sales Widget",
"email": "[email protected]",
"destinationEmail": "[email protected]",
"uuid": "31a11b98-ffd2-425d-aa69-2c6ff8a40a16",
"agents": [
{
"agentId": "wc:[email protected]",
"agentAlias": "A New Agent",
"agentAvatar": "https://www.website.com/a_new_agent_avatar.png",
"agentType": "webclient"
}
],
"enableProactiveChat": "false",
"enableConversations": true
}
import requests
url = "https://www.snapengage.com/api/v1/widget.json"
querystring = {"api_key":"{api_key}"}
payload = '{ "email" : "[email protected]", "destinationEmail" : "[email protected]",' \
'"name" : "A new name for this widget", "uuid" : "31a11b98-ffd2-425d-aa69-2c6ff8a40a16",' \
'"agents" : [{ "agentId": "[email protected]", "agentAlias" : "A New Agent",' \
'"agentAvatar" : "https://www.website.com/a_new_agent_avatar.png", "agentType" : "webclient" }],' \
'"enableProactiveChat" : "true"}'
response = requests.request("POST", url, data=payload, params=querystring)
print(response.text)
Data | Type | Description |
---|---|---|
name | String | The widget name. |
String | The user account email address. All characters will be converted to lowercase. | |
destinationEmail | String | The email where transcripts are sent. |
uuid | String | The widget id. |
agents | List | The list of agent(s) on this widget. Each agent includes the below fields (agentId , agentAlias , agentAvatar , agentType ). |
↳ agentId | String | The agent ID. All characters will be converted to lowercase. |
↳ agentAlias | String | The agent displayed name. |
↳ agentAvatar | String | Link to an agent image. |
↳ agentType | String | See table of "agentType values" below. |
enableProactiveChat | String | If true proactive chat is enabled for the widget. If false it is not. |
Success Response
200 OK
Delete an existing widget
To delete a widget, DELETE to the endpoint with your API key, the uuid (widget id), and the user email as parameters.
DELETE /api/v1/user.json?api_key={api_key}&uuid={widget_id}&email={user_email}
Request Parameters
Data | Type | Description |
---|---|---|
uuid | String | Required. The widget public Id. |
String | Required. The user email associated with this widget. All characters will be converted to lowercase. |
Sample Request
To view an example request, click one of the language tabs on the right.
curl -X DELETE 'https://www.snapengage.com/api/v1/widget.json?api_key={api_key}&uuid=31a11b98-ffd2-425d-aa69-2c6ff8a40a16&[email protected]'
package com.snapengage.samples.widget;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.WebTarget;
public class WidgetExample {
private static final String apiKey = "{api_key}";
public static void main(String[] args) {
WebTarget webTarget = ClientBuilder.newBuilder().build()
.target("https://www.snapengage.com/api/v1/widget.json?api_key=" + apiKey
+ "&uuid={widget_id}&email={user_email}");
webTarget.request().delete();
}
}
import requests
url = "https://www.snapengage.com/api/v1/widget.json"
querystring = { "api_key" : "{api_key}", "uuid" : "31a11b98-ffd2-425d-aa69-2c6ff8a40a16", "email" : "[email protected]" }
response = requests.request("DELETE", url, params=querystring)
print(response.text)
Response Parameters
No response payload is returned.
Success Response
200 OK