All Classes Pages
ComposeAndSaveEmailExamples Class Reference

More...

Detailed Description

Examples for compose and save email activity

Example 1 - Compose a secure email for an existing case with required elements, using XML/JSON as content-type

Using XML/JSON as the content-type, this example demonstrates the following:

  • Composing an email for an existing case
  • Composing an email using required elements, subject and content.
  • Using macros in subject and content of the email, by using the following query parameters: "expandMacros".
  • Note that since "from email address" is not provided, this will create a secure email.

XML

Request

Method URL
POST /ws/v12/interaction/activity?expandMacros=yes

Request headers

Name Value
X-egain-session Valid session ID
Accept application/xml
Content-Type application/xml
Accept-Language en-US

Request body:

<?xml version="1.0" encoding="UTF-8"?>
   <activity xmlns="http://bindings.egain.com/ws/model/v12/gen/interaction/activity" 
                 xmlns:ns2="http://bindings.egain.com/ws/model/v12/gen/platform"
                 xmlns:ns3="http://bindings.egain.com/ws/model/v12/gen/common" >

      <department>
         <ns2:name>service</ns2:name>
      </department>
      <type>
         <value>email</value>
         <subtype>
            <ns3:value>compose</ns3:value>
         </subtype>
      </type>
     <case id='1061'/>
      <subject>Issue with mobile phone. Ref: ``external_case_id</subject>      
      <payload>
         <email>
          <contents>
		<content>
		   <ns3:type>text</ns3:type>
		   <ns3:value>Please update the driver by following these steps: ``update_display_driver</ns3:value>
		</content>
	       <content>
		   <ns3:type>html</ns3:type>
		   <ns3:value><![CDATA[<HTML><HEAD><TITLE></TITLE></HEAD><BODY><P>
 Please update the driver by following these steps: ``update_display_driver <BR> </P></BODY></HTML>]]></ns3:value>
		</content>
             </contents>
            <emailAddresses>
               <to>
                  <address>jhenry@customer.com</address>
               </to>             
              </emailAddresses>
         </email>
      </payload>      
   </activity>

Response:
HTTP/1.1 201 Created

Response headers

Name Value
X-egain-session current session ID
Content-Type application/xml
Location /system/ws/v12/interaction/activity/2795

     


JSON

Request

Method URL
POST /ws/v12/interaction/activity?expandMacros=yes

Request headers :

Name Value
X-egain-session Valid session ID
Content-Type application/json
Accept application/json
Accept-Language en-US

Request body:

{
  "department": {
    "name": "service"
  },
  "type": {
    "value": "email",
    "subtype": {
      "value": "compose"
    }
  },  
   "case" : {
   "id" : "1061"
  },
  "subject": "Issue with mobile phone. Ref: ``external_case_id",
  "payload": {
    "email": {
      "contents": {
              "content": [
                {
                  "type": "text",
                  "value": "Please update the driver by following these steps: ``update_display_driver"
                },
      		  {
                  "type": "html",
                  "value": "<HTML><HEAD><TITLE></TITLE></HEAD><BODY><P>
      Please update the driver by following these steps: ``update_display_driver <BR> </P></BODY></HTML>"
                }		  
              ]
      },
      "emailAddresses": {        
        "to": {
          "address": [
            "jhenry@customer.com"
          ]
        }
      }
    }
  }
}

Response:
HTTP/1.1 201 Created

Response headers

Name Value
X-egain-session current session ID
Content-Type application/json
Location /system/ws/v12/interaction/activity/2795

     



Example 2 - Compose a secure email for a new case with required elements, using Multipart/form-data as content-type

Using Multipart/form-data as content-type, this example demonstrates the following:

  • Composing an email for a new case
  • Composing an email with required elements, subject and content
  • Using macros in subject and content of the email, by using the following query parameters: "expandMacros".
  • Note that since "from email address" is not provided, this will create a secure email.

XML

Request

Method URL
POST /ws/v12/interaction/activity?expandMacros=yes

Request headers :

Name Value
X-egain-session Valid session ID
Content-Type multipart/form-data; boundary=----WebKitFormBoundaryLyRAYGiE5mFu3Ucv
Accept application/xml
Accept-Language en-US

Request body:

------WebKitFormBoundaryLyRAYGiE5mFu3Ucv
Content-Disposition: form-data; name="data"

<?xml version="1.0" encoding="UTF-8"?>
   <activity xmlns="http://bindings.egain.com/ws/model/v12/gen/interaction/activity" 
                 xmlns:ns2="http://bindings.egain.com/ws/model/v12/gen/platform"
                 xmlns:ns3="http://bindings.egain.com/ws/model/v12/gen/common" >

      <department>
         <ns2:name>Service</ns2:name>
      </department>
      <type>
         <value>email</value>
         <subtype>
            <ns3:value>compose</ns3:value>
         </subtype>
      </type>
      <subject>Issue with laptop. Ref: ``external_case_id</subject>
      <payload>
         <email>
            <contents>
               <content>
                  <ns3:type>text</ns3:type>
                  <ns3:value>Please update the driver by following these steps: ``update_display_driver</ns3:value>
               </content>
              <content>
                  <ns3:type>html</ns3:type>
                  <ns3:value><![CDATA[<HTML><HEAD><TITLE></TITLE></HEAD><BODY><P>Please update the driver by following these steps: ``update_display_driver <BR> </P></BODY></HTML>]]></ns3:value>
               </content>
            </contents>
            <emailAddresses>              
               <to>
                  <address>jhenry@customer.com</address>
               </to>             
              </emailAddresses>
         </email>
      </payload>      
   </activity>

------WebKitFormBoundaryLyRAYGiE5mFu3Ucv
Content-Disposition: form-data; name="data-type"

application/xml
------WebKitFormBoundaryLyRAYGiE5mFu3Ucv--

Response:
HTTP/1.1 201 Created

Response headers

Name Value
X-egain-session Current session ID
Content-Type application/xml
Location /system/ws/v12/interaction/activity/2800

     

JSON

Request

Method URL
POST /ws/v12/interaction/activity?expandMacros=yes

Request headers :

Name Value
X-egain-session Valid session ID
Content-Type multipart/form-data; boundary=----WebKitFormBoundaryLyRAYGiE5mFu3Ucv
Accept application/json
Accept-Language en-US

Request body:

------WebKitFormBoundaryLyRAYGiE5mFu3Ucv
Content-Disposition: form-data; name="data"

{
  "department": {
    "name": "service"
  },
  "type": {
    "value": "email",
    "subtype": {
      "value": "compose"
    }
  },
  "subject": "Issue with laptop. Ref: ``external_case_id",  
  "payload": {
    "email": {
      "contents": {
        "content": [
          {
            "type": "text",
            "value": "Please update the driver by following these steps: ``update_display_driver"
          },
		  {
            "type": "html",
            "value": "<HTML><HEAD><TITLE></TITLE></HEAD><BODY><P>Please update the driver by following these steps: ``update_display_driver <BR> </P></BODY></HTML>"
          }		  
        ]
      },
      "emailAddresses": {
        "to": {
          "address": [
            "jhenry@customer.com"
          ]
        }        
      }
    }
  }  
}
------WebKitFormBoundaryLyRAYGiE5mFu3Ucv
Content-Disposition: form-data; name="data-type"

application/json
------WebKitFormBoundaryLyRAYGiE5mFu3Ucv--

Response:
HTTP/1.1 201 Created

Response headers

Name Value
X-egain-session Current session ID
Content-Type application/json
Location /system/ws/v12/interaction/activity/2800

     



Example 3 - Compose an email with required elements, from email address and attachments, using XML/JSON as content-type

Using XML/JSON as content-type, this example demonstrates the following:

  • Composing an email for a new case
  • Composing an email with required elements, from email address, subject and content
  • Using non-inline attachments

XML

Request

Method URL
POST /ws/v12/interaction/activity

Request headers

Name Value
X-egain-session Valid session ID
Accept application/xml
Content-Type application/xml
Accept-Language en-US

Request body:

<?xml version="1.0" encoding="UTF-8"?>
   <activity xmlns="http://bindings.egain.com/ws/model/v12/gen/interaction/activity" 
                 xmlns:ns2="http://bindings.egain.com/ws/model/v12/gen/platform"
                 xmlns:ns3="http://bindings.egain.com/ws/model/v12/gen/common"
                 xmlns:ns4="http://bindings.egain.com/ws/model/v12/gen/interaction/attachment" >

      <department>
         <ns2:name>Service</ns2:name>
      </department>
      <type>
         <value>email</value>
         <subtype>
            <ns3:value>compose</ns3:value>
         </subtype>
      </type>
      <subject>Issue with laptop</subject>
      <attachments>
            <ns4:attachment>
                <ns4:fileName>image.gif</ns4:fileName>
                <ns4:contentType>image/gif</ns4:contentType>
                <ns4:content><![CDATA[
R0lGODlhEAAQAIMAAAAAAP///7Tt/wCfz3fg/5vo/7Tu/1JSUv///wAAAAAAAAAAAAAAAAAAAAAAAAAAACH/C05FVFNDQVBFM
i4wAwEBAAAh+QQBAAAIACwAAAAAEAAQAAAIZgARCBxIEMGBAwUTCjwQIABChQQZOlx4sCJDixglNmyoceNBhxs5cpT4EaTHkw
41qgw5MiTJjCVRBhgwICLLkANmDtRIsyfNhjUNVhxgQICBo0gNBB3os2eBAkshIhhAIKpUmgQDAgA7
                ]]></ns4:content>
            </ns4:attachment>
      </attachments>
      <payload>
         <email>
            <contents>
               <content>
                  <ns3:type>text</ns3:type>
                  <ns3:value>This is the issue</ns3:value>
               </content>
              <content>
                  <ns3:type>html</ns3:type>
                  <ns3:value><![CDATA[<HTML><HEAD><TITLE></TITLE></HEAD><BODY><P>This is the issue <BR> </P></BODY></HTML>]]></ns3:value>
               </content>
            </contents>
            <emailAddresses>
               <from>support@business.com</from>
               <to>
                  <address>jhenry@customer.com</address>
               </to>              
              </emailAddresses>
         </email>
      </payload>      
   </activity>

Response:
HTTP/1.1 201 Created

Response headers

Name Value
X-egain-session current session ID
Content-Type application/xml
Location /system/ws/v12/interaction/activity/2795

     

JSON

Request

Method URL
POST /ws/v12/interaction/activity

Request headers :

Name Value
X-egain-session Valid session ID
Content-Type application/json
Accept application/json
Accept-Language en-US

Request body:

{
  "department": {
    "name": "service"
  },
  "type": {
    "value": "email",
    "subtype": {
      "value": "compose"
    }
  },
  "subject": "Issue with laptop",
  "attachments": {
    "attachment": [
      {
        "fileName": "image.gif",
        "contentType": "image/gif",
        "content": "R0lGODlhEAAQAIMAAAAAAP///7Tt/wCfz3fg/5vo/7Tu/1JSUv///wAAAAAAAAAAAAAAAAAAAAAAAAAAACH/C05FVFNDQVBFM
i4wAwEBAAAh+QQBAAAIACwAAAAAEAAQAAAIZgARCBxIEMGBAwUTCjwQIABChQQZOlx4sCJDixglNmyoceNBhxs5cpT4EaTHkw
41qgw5MiTJjCVRBhgwICLLkANmDtRIsyfNhjUNVhxgQICBo0gNBB3os2eBAkshIhhAIKpUmgQDAgA7"
      }
    ]
  },
  "payload": {
    "email": {
      "contents": {
        "content": [
          {
            "type": "text",
            "value": "This is the issue"
          },
		  {
            "type": "html",
            "value": "<HTML><HEAD><TITLE></TITLE></HEAD><BODY><P>This is the issue <BR> </P></BODY></HTML>"
          }		  
        ]
      },
      "emailAddresses": {
        "from": "support@business.com",
        "to": {
          "address": [
            "jhenry@customer.com"
          ]
        }        
      }
    }
  }
}

Response:
HTTP/1.1 201 Created

Response headers

Name Value
X-egain-session current session ID
Content-Type application/json
Location /system/ws/v12/interaction/activity/2795

     



Example 4 - Compose an email for a new case with required elements and from email address using Multipart/form-data as content-type

Using Multipart/form-data, this example demonstrates the following:

  • Composing an email for a new case
  • Composing an email with required elements, from email address, subject and content
  • Using non-inline attachments

XML

Request

Method URL
POST /ws/v12/interaction/activity

Request headers :

Name Value
X-egain-session Valid session ID
Content-Type multipart/form-data; boundary=----WebKitFormBoundaryLyRAYGiE5mFu3Ucv
Accept application/xml
Accept-Language en-US

Request body:

------WebKitFormBoundaryLyRAYGiE5mFu3Ucv
Content-Disposition: form-data; name="data"

<?xml version="1.0" encoding="UTF-8"?>
   <activity xmlns="http://bindings.egain.com/ws/model/v12/gen/interaction/activity" 
                 xmlns:ns2="http://bindings.egain.com/ws/model/v12/gen/platform"
                 xmlns:ns3="http://bindings.egain.com/ws/model/v12/gen/common"
                 xmlns:ns4="http://bindings.egain.com/ws/model/v12/gen/interaction/attachment" >

      <department>
         <ns2:name>Service</ns2:name>
      </department>
      <type>
         <value>email</value>
         <subtype>
            <ns3:value>compose</ns3:value>
         </subtype>
      </type>
      <subject>Issue with laptop</subject>      
      <payload>
         <email>
            <contents>
               <content>
                  <ns3:type>text</ns3:type>
                  <ns3:value>This is the issue</ns3:value>
               </content>
              <content>
                  <ns3:type>html</ns3:type>
                  <ns3:value><![CDATA[<HTML><HEAD><TITLE></TITLE></HEAD><BODY><P>This is the issue <BR> </P></BODY></HTML>]]></ns3:value>
               </content>
            </contents>
            <emailAddresses>
               <from>support@business.com</from>
               <to>
                  <address>jhenry@customer.com</address>
               </to>              
              </emailAddresses>
         </email>
      </payload>      
   </activity>
------WebKitFormBoundaryLyRAYGiE5mFu3Ucv
Content-Disposition: form-data; name="data-type"

application/xml
------WebKitFormBoundaryLyRAYGiE5mFu3Ucv
Content-Disposition: form-data; name="laptop_details"; filename="laptop_details.txt"
Content-Type: text/plain

System Dell Latitude E5400 Laptop Mobile Intel GS45 Express chipset
Processor 
Type: Intel Core 2 Duo P8600
------WebKitFormBoundaryLyRAYGiE5mFu3Ucv--

Response:
HTTP/1.1 201 Created

Response headers

Name Value
X-egain-session Current session ID
Content-Type application/xml
Location /system/ws/v12/interaction/activity/2800

     

JSON

Request

Method URL
POST /ws/v12/interaction/activity

Request headers :

Name Value
X-egain-session Valid session ID
Content-Type multipart/form-data; boundary=----WebKitFormBoundaryLyRAYGiE5mFu3Ucv
Accept application/json
Accept-Language en-US

Request body:

------WebKitFormBoundaryLyRAYGiE5mFu3Ucv
Content-Disposition: form-data; name="data"

{
  "department": {
    "name": "service"
  },
  "type": {
    "value": "email",
    "subtype": {
      "value": "compose"
    }
  },
  "subject": "Issue with laptop",  
  "payload": {
    "email": {
      "contents": {
        "content": [
          {
            "type": "text",
            "value": "This is the issue"
          },
		  {
            "type": "html",
            "value": "<HTML><HEAD><TITLE></TITLE></HEAD><BODY><P>This is the issue <BR> </P></BODY></HTML>"
          }		  
        ]
      },
      "emailAddresses": {
        "from": "support@business.com",
        "to": {
          "address": [
            "jhenry@customer.com"
          ]
        }        
      }
    }
  }
}
------WebKitFormBoundaryLyRAYGiE5mFu3Ucv
Content-Disposition: form-data; name="data-type"

application/json
------WebKitFormBoundaryLyRAYGiE5mFu3Ucv
Content-Disposition: form-data; name="laptop_details"; filename="laptop_details.txt"
Content-Type: text/plain

System Dell Latitude E5400 Laptop Mobile Intel GS45 Express chipset
Processor 
Type: Intel Core 2 Duo P8600
------WebKitFormBoundaryLyRAYGiE5mFu3Ucv--

Response:
HTTP/1.1 201 Created

Response headers

Name Value
X-egain-session Current session ID
Content-Type application/json
Location /system/ws/v12/interaction/activity/2800

     



Example 5 - Composing an email for a new customer with all elements, using XML/JSON as content-type

Using XML/JSON as content-type, this example demonstrates the following:

  • Composing an email for an existing case.
  • Composing an email using all elements (required and optional).
  • Customer representation in the request, to be used for creating a new Customer as part of composing an email.

XML

Request

Method URL
POST /ws/v12/interaction/activity

Request headers

Name Value
X-egain-session Valid session ID
Accept application/xml
Content-Type application/xml
Accept-Language en-US

Request body:

<?xml version="1.0" encoding="UTF-8"?>
<activity
    xmlns="http://bindings.egain.com/ws/model/v12/gen/interaction/activity"
    xmlns:ns2="http://bindings.egain.com/ws/model/v12/gen/platform"
    xmlns:ns3="http://bindings.egain.com/ws/model/v12/gen/common"
    xmlns:ns4="http://bindings.egain.com/ws/model/v12/gen/interaction/attachment"
    xmlns:ns5="http://bindings.egain.com/ws/model/v12/gen/interaction/customer"
    xmlns:ns6="http://bindings.egain.com/ws/model/v12/gen/interaction/contactperson"
    xmlns:ns7="http://bindings.egain.com/ws/model/v12/gen/interaction/contactpoint">
    <department>
        <ns2:name>Service</ns2:name>
    </department>
    <type>
        <value>email</value>
        <subtype>
            <ns3:value>compose</ns3:value>
        </subtype>
    </type>
    <case id='1061'/>
    <priority>4</priority>
    <dueDate>2016-12-26T19:00:00.000Z</dueDate>
    <subject>Issue with laptop</subject>
    <queue>
    	<ns2:name>Email queue</ns2:name>
	</queue>
    <payload>
        <email>
            <contents>
                <content>
                    <ns3:type>text</ns3:type>
                    <ns3:value>This is the issue</ns3:value>
                </content>
                <content>
                    <ns3:type>html</ns3:type>
                    <ns3:value>
                        <![CDATA[<HTML><HEAD><TITLE></TITLE></HEAD><BODY><P>This is the issue <BR></P></BODY></HTML>]]>
                    </ns3:value>
                </content>
            </contents>
            <emailAddresses>
                <from>support@business.com</from>
                <to>
                    <address>jhenry@customer.com</address>
                </to>
                <cc>
                    <address>khenry@customer.com</address>
                </cc>
                <bcc>
                    <address>dhenry@customer.com</address>
                </bcc>
            </emailAddresses>
        </email>
    </payload>
    <customer>
        <ns5:type>
            <ns5:value>group</ns5:value>
            <ns5:group>
                <ns5:type>
                    <ns3:value>Association</ns3:value>
                </ns5:type>
                <ns5:region>Europe</ns5:region>
                <ns5:numberOfMembers>12</ns5:numberOfMembers>
                <ns5:income>$90,000</ns5:income>
                <ns5:currency>USD</ns5:currency>
                <ns5:registrationNumber>K56743</ns5:registrationNumber>
                <ns5:affiliation>FCMA</ns5:affiliation>
            </ns5:group>
        </ns5:type>
        <ns5:customerName>Unichem Laboratories Limited</ns5:customerName>
        <ns5:pin>25345</ns5:pin>
        <ns5:level>
            <ns3:value>Premium</ns3:value>
        </ns5:level>
        <ns5:role>
            <ns3:value>Partner</ns3:value>
        </ns5:role>
        <ns5:pin>0121</ns5:pin>
        <ns5:howReferred>
            <ns3:value>Customer</ns3:value>
        </ns5:howReferred>
        <ns5:industry>
            <ns3:value>Health care</ns3:value>
        </ns5:industry>
        <ns5:marketSegment>Medical Products</ns5:marketSegment>
        <ns5:entitlements>Free service</ns5:entitlements>
        <ns5:contactPersons>
            <ns6:contactPerson>
                <ns6:salutation>Mr.</ns6:salutation>
                <ns6:firstName>Kriag</ns6:firstName>
                <ns6:middleName>Goldman</ns6:middleName>
                <ns6:lastName>Francis</ns6:lastName>
                <ns6:loginId>kriag</ns6:loginId>
                <ns6:gender>
                    <ns3:value>Male</ns3:value>
                </ns6:gender>
                <ns6:identification>
                    <ns6:type>SSN</ns6:type>
                    <ns6:value>111-22-8765</ns6:value>
                </ns6:identification>
                <ns6:suffix>
                    <ns3:value>I</ns3:value>
                </ns6:suffix>
                <ns6:initials>A.</ns6:initials>
                <ns6:secretQuestion>Place of Birth</ns6:secretQuestion>
                <ns6:secretAnswer>Sunnyvale</ns6:secretAnswer>
                <ns6:hasDirectMailingConsent>true</ns6:hasDirectMailingConsent>
                <ns6:hasDirectCallingConsent>true</ns6:hasDirectCallingConsent>
                <ns6:hasHoldingDataConsent>true</ns6:hasHoldingDataConsent>
                <ns6:jobTitle>Assistant</ns6:jobTitle>
                <ns6:employmentStatus>
                    <ns3:value>Intern</ns3:value>
                </ns6:employmentStatus>
                <ns6:priority>High</ns6:priority>
                <ns6:dateOfBirth>1965-12-09T00:00:00.000Z</ns6:dateOfBirth>
                <ns6:maritalStatus>
                    <ns3:value>Married</ns3:value>
                </ns6:maritalStatus>
                <ns6:type>
                    <ns3:value>Legal</ns3:value>
                </ns6:type>
                <ns6:firstNameFurigana>Kriag</ns6:firstNameFurigana>
                <ns6:middleNameFurigana>Goldman</ns6:middleNameFurigana>
                <ns6:lastNameFurigana>Francis</ns6:lastNameFurigana>
                <ns6:startGreeting>Hey, Welcome</ns6:startGreeting>
                <ns6:endGreeting>Have a Nice Day!</ns6:endGreeting>
                <ns6:spouseName>Kethel</ns6:spouseName>
                <ns6:emergencyContact>0987654321</ns6:emergencyContact>
                <ns6:occupation>Medical Assistance</ns6:occupation>
                <ns6:incomeLevel>40000-50000</ns6:incomeLevel>
                <ns6:educationLevel>
                    <ns3:value>Graduate</ns3:value>
                </ns6:educationLevel>
                <ns6:race>African</ns6:race>
                <ns6:dependents>4</ns6:dependents>
                <ns6:isSmoker>true</ns6:isSmoker>
                <ns6:hobbies>Farming</ns6:hobbies>
                <ns6:interests>Painting</ns6:interests>
                <ns6:contactOrder>1985</ns6:contactOrder>
                <ns6:contactPoints>
                    <ns7:contactPoint>
                        <ns7:type>
                            <ns7:value>postal</ns7:value>
                            <ns7:postal>
                                <ns7:type>
                                    <ns3:value>Office address</ns3:value>
                                </ns7:type>
                                <ns7:address_1>345</ns7:address_1>
                                <ns7:address_2>E Midfield Rd</ns7:address_2>
                                <ns7:city>Mountain View</ns7:city>
                                <ns7:state>Ca</ns7:state>
                                <ns7:zip>98704</ns7:zip>
                                <ns7:country>USA</ns7:country>
                                <ns7:region>United States</ns7:region>
                            </ns7:postal>
                        </ns7:type>
                        <ns7:priority>
                            <ns3:value>Low</ns3:value>
                        </ns7:priority>
                    </ns7:contactPoint>
                </ns6:contactPoints>
            </ns6:contactPerson>
        </ns5:contactPersons>
    </customer>
</activity>

Response:
HTTP/1.1 201 Created

Response headers

Name Value
X-egain-session current session ID
Content-Type application/xml
Location /system/ws/v12/interaction/activity/2795

     

JSON

Request

Method URL
POST /ws/v12/interaction/activity

Request headers :

Name Value
X-egain-session Valid session ID
Content-Type application/json
Accept application/json
Accept-Language en-US

Request body:

{
    "department": {
        "name": "service"
    },
    "type": {
        "value": "email",
        "subtype": {
            "value": "compose"
        }
    },
    "case": {
        "id": "1061"
    },
    "priority": 1,
    "dueDate": "2016-12-26T19:00:00.000Z",
    "subject": "Issue with laptop",
	"queue":{
		"name": "Email queue"
	},
    "payload": {
        "email": {
            "contents": {
                "content": [
                    {
                        "type": "text",
                        "value": "This is the issue"
                    },
                    {
                        "type": "html",
                        "value": "<HTML><HEAD><TITLE></TITLE></HEAD><BODY><P>This is the issue <BR> </P></BODY></HTML>"
                    }
                ]
            },
            "emailAddresses": {
                "from": "support@business.com",
                "to": {
                    "address": [
                        "jhenry@customer.com"
                    ]
                },
                "cc": {
                    "address": [
                        "khenry@customer.com"
                    ]
                },
                "bcc": {
                    "address": [
                        "dhenry@customer.com"
                    ]
                }
            }
        }
    },
    "customer": {
        "type": {
            "value": "group",
            "group": {
                "type": {
                    "value": "Association"
                },
                "region": "Europe",
                "numberOfMembers": "12",
                "income": "1000000",
                "currency": "USD",
                "registrationNumber": "324",
                "affiliation": "FCMA"
            }
        },
        "customerName": "Unichem Laboratories Limited",
        "level": {
            "value": "Platinum"
        },
        "role": {
            "value": "Partner"
        },
        "pin": "0121",
        "howReferred": {
            "value": "Customer"
        },
        "industry": {
            "value": "Health care"
        },
        "marketSegment": "Medical Products",
        "entitlements": "Free service",
        "contactPersons": {
            "contactPerson": [
                {
                    "salutation": "Mr.",
                    "firstName": "Kriag",
                    "middleName": "Goldman",
                    "lastName": "Francis",
                    "loginId": "kfrancis",
                    "gender": {
                        "value": "Male"
                    },
                    "identification": {
                        "type": "SSN",
                        "value": "111-22-8765"
                    },
                    "suffix": {
                        "value": "Jr."
                    },
                    "initials": "A.",
                    "secretQuestion": "Place of Birth",
                    "secretAnswer": "Sunnyvale",
                    "hasDirectMailingConsent": "true",
                    "hasDirectCallingConsent": "true",
                    "hasHoldingDataConsent": "true",
                    "jobTitle": "Manager",
                    "employmentStatus": {
                        "value": "Intern"
                    },
                    "priority": "High",
                    "dateOfBirth": "1965-12-09T00:00:00.000Z",
                    "maritalStatus": {
                        "value": "Married"
                    },
                    "type": {
                        "value": "Billing"
                    },
                    "firstNameFurigana": "Kriag",
                    "middleNameFurigana": "Goldman",
                    "lastNameFurigana": "Francis",
                    "startGreeting": "Hello",
                    "endGreeting": "Byee",
                    "spouseName": "Sara",
                    "emergencyContact": "998-765-4321",
                    "occupation": "Branch Manager",
                    "incomeLevel": "40000-50000",
                    "educationLevel": {
                        "value": "Graduate"
                    },
                    "race": "African",
                    "dependents": "4",
                    "isSmoker": "true",
                    "hobbies": "Farming",
                    "interests": "Painting",
                    "contactOrder": "1984",
                    "contactPoints": {
                        "contactPoint": [
                            {
                                "type": {
                                    "value": "postal",
                                    "postal": {
                                        "type": {
                                            "value": "Office address"
                                        },
                                        "address_1": "345",
                                        "address_2": "E Midfield Rd",
                                        "city": "Mountain View",
                                        "state": "Ca",
                                        "zip": "98704",
                                        "country": "USA",
                                        "region": "United States"
                                    }
                                },
                                "priority": {
                                    "value": "Low"
                                }
                            }
                        ]
                    }
                }
            ]
        }
    },
    "customAttributes": {
        "customAttribute": [
            {
                "attribName": "laptop_identification_no",
                "attribValues": {
                    "attribValue": [
                        {
                            "value": "CE1222212GKAHDHFUJUUUEMMJDJ27SDJD"
                        }
                    ]
                }
            },
            {
                "attribName": "previousattempts",
                "attribValues": {
                    "attribValue": [
                        {
                            "value": "2"
                        }
                    ]
                }
            },
            {
                "attribName": "domain",
                "attribValues": {
                    "attribValue": [
                        {
                            "value": "laptop"
                        },
                        {
                            "value": "display"
                        }
                    ]
                }
            }
        ]
    }
}

Response:
HTTP/1.1 201 Created

Response headers

Name Value
X-egain-session current session ID
Content-Type application/json
Location /system/ws/v12/interaction/activity/2795

     



Example 6 - Composing an email for a new customer with all elements, using Multipart/form-data as content-type

Using Multipart/form-data as content-type, this example demonstrates the following:

  • Composing an email for an existing case.
  • Composing an email using all elements (required and optional).
  • Customer representation in the request, to be used for creating a new Customer as part of composing an email.

XML

Request

Method URL
POST /ws/v12/interaction/activity

Request headers :

Name Value
X-egain-session Valid session ID
Content-Type multipart/form-data; boundary=----WebKitFormBoundaryAXn851qjukQsnRxT
Accept application/xml
Accept-Language en-US

Request body:

------WebKitFormBoundaryAXn851qjukQsnRxT
Content-Disposition: form-data; name="data"

<?xml version="1.0" encoding="UTF-8"?>
<activity
    xmlns="http://bindings.egain.com/ws/model/v12/gen/interaction/activity"
    xmlns:ns2="http://bindings.egain.com/ws/model/v12/gen/platform"
    xmlns:ns3="http://bindings.egain.com/ws/model/v12/gen/common"
    xmlns:ns4="http://bindings.egain.com/ws/model/v12/gen/interaction/attachment"
    xmlns:ns5="http://bindings.egain.com/ws/model/v12/gen/interaction/customer"
    xmlns:ns6="http://bindings.egain.com/ws/model/v12/gen/interaction/contactperson"
    xmlns:ns7="http://bindings.egain.com/ws/model/v12/gen/interaction/contactpoint">
    <department>
        <ns2:name>Service</ns2:name>
    </department>
    <type>
        <value>email</value>
        <subtype>
            <ns3:value>compose</ns3:value>
        </subtype>
    </type>
    <priority>4</priority>
    <dueDate>2016-12-26T19:00:00.000Z</dueDate>
    <subject>Issue with laptop</subject>
    <queue>
		<ns2:name>Email queue</ns2:name>
	</queue>
    <payload>
        <email>
            <contents>
                <content>
                    <ns3:type>text</ns3:type>
                    <ns3:value>this is the issue</ns3:value>
                </content>
                <content>
                    <ns3:type>html</ns3:type>
                    <ns3:value>
                        <![CDATA[<HTML><HEAD><TITLE></TITLE></HEAD><BODY><P>This is the issue <BR></P></BODY></HTML>]]>
                    </ns3:value>
                </content>
            </contents>
            <emailAddresses>
                <from>support@business.com</from>
                <to>
                    <address>jhenry@customer.com</address>
                </to>
                <cc>
                    <address>khenry@customer.com</address>
                </cc>
                <bcc>
                    <address>dhenry@customer.com</address>
                </bcc>
            </emailAddresses>
        </email>
    </payload>
    <customer>
        <ns5:type>
            <ns5:value>group</ns5:value>
            <ns5:group>
                <ns5:type>
                    <ns3:value>Association</ns3:value>
                </ns5:type>
                <ns5:region>Europe</ns5:region>
                <ns5:numberOfMembers>12</ns5:numberOfMembers>
                <ns5:income>$90,000</ns5:income>
                <ns5:currency>USD</ns5:currency>
                <ns5:registrationNumber>K56743</ns5:registrationNumber>
                <ns5:affiliation>FCMA</ns5:affiliation>
            </ns5:group>
        </ns5:type>
        <ns5:customerName>Unichem Laboratories Limited</ns5:customerName>
        <ns5:pin>25345</ns5:pin>
        <ns5:level>
            <ns3:value>Premium</ns3:value>
        </ns5:level>
        <ns5:role>
            <ns3:value>Partner</ns3:value>
        </ns5:role>
        <ns5:pin>0121</ns5:pin>
        <ns5:howReferred>
            <ns3:value>Customer</ns3:value>
        </ns5:howReferred>
        <ns5:industry>
            <ns3:value>Health care</ns3:value>
        </ns5:industry>
        <ns5:marketSegment>Medical Products</ns5:marketSegment>
        <ns5:entitlements>Free service</ns5:entitlements>
        <ns5:contactPersons>
            <ns6:contactPerson>
                <ns6:salutation>Mr.</ns6:salutation>
                <ns6:firstName>Kriag</ns6:firstName>
                <ns6:middleName>Goldman</ns6:middleName>
                <ns6:lastName>Francis</ns6:lastName>
                <ns6:loginId>kriag</ns6:loginId>
                <ns6:gender>
                    <ns3:value>Male</ns3:value>
                </ns6:gender>
                <ns6:identification>
                    <ns6:type>SSN</ns6:type>
                    <ns6:value>111-22-8765</ns6:value>
                </ns6:identification>
                <ns6:suffix>
                    <ns3:value>I</ns3:value>
                </ns6:suffix>
                <ns6:initials>A.</ns6:initials>
                <ns6:secretQuestion>Place of Birth</ns6:secretQuestion>
                <ns6:secretAnswer>Sunnyvale</ns6:secretAnswer>
                <ns6:hasDirectMailingConsent>true</ns6:hasDirectMailingConsent>
                <ns6:hasDirectCallingConsent>true</ns6:hasDirectCallingConsent>
                <ns6:hasHoldingDataConsent>true</ns6:hasHoldingDataConsent>
                <ns6:jobTitle>Assistant</ns6:jobTitle>
                <ns6:employmentStatus>
                    <ns3:value>Intern</ns3:value>
                </ns6:employmentStatus>
                <ns6:priority>High</ns6:priority>
                <ns6:dateOfBirth>1965-12-09T00:00:00.000Z</ns6:dateOfBirth>
                <ns6:maritalStatus>
                    <ns3:value>Married</ns3:value>
                </ns6:maritalStatus>
                <ns6:type>
                    <ns3:value>Legal</ns3:value>
                </ns6:type>
                <ns6:firstNameFurigana>Kriag</ns6:firstNameFurigana>
                <ns6:middleNameFurigana>Goldman</ns6:middleNameFurigana>
                <ns6:lastNameFurigana>Francis</ns6:lastNameFurigana>
                <ns6:startGreeting>Hey, Welcome</ns6:startGreeting>
                <ns6:endGreeting>Have a Nice Day!</ns6:endGreeting>
                <ns6:spouseName>Kethel</ns6:spouseName>
                <ns6:emergencyContact>0987654321</ns6:emergencyContact>
                <ns6:occupation>Medical Assistance</ns6:occupation>
                <ns6:incomeLevel>40000-50000</ns6:incomeLevel>
                <ns6:educationLevel>
                    <ns3:value>Graduate</ns3:value>
                </ns6:educationLevel>
                <ns6:race>African</ns6:race>
                <ns6:dependents>4</ns6:dependents>
                <ns6:isSmoker>true</ns6:isSmoker>
                <ns6:hobbies>Farming</ns6:hobbies>
                <ns6:interests>Painting</ns6:interests>
                <ns6:contactOrder>1985</ns6:contactOrder>
                <ns6:contactPoints>
                    <ns7:contactPoint>
                        <ns7:type>
                            <ns7:value>postal</ns7:value>
                            <ns7:postal>
                                <ns7:type>
                                    <ns3:value>Office address</ns3:value>
                                </ns7:type>
                                <ns7:address_1>345</ns7:address_1>
                                <ns7:address_2>E Midfield Rd</ns7:address_2>
                                <ns7:city>Mountain View</ns7:city>
                                <ns7:state>Ca</ns7:state>
                                <ns7:zip>98704</ns7:zip>
                                <ns7:country>USA</ns7:country>
                                <ns7:region>United States</ns7:region>
                            </ns7:postal>
                        </ns7:type>
                        <ns7:priority>
                            <ns3:value>Low</ns3:value>
                        </ns7:priority>
                    </ns7:contactPoint>
                </ns6:contactPoints>
            </ns6:contactPerson>
        </ns5:contactPersons>
    </customer>
     
</activity>
------WebKitFormBoundaryAXn851qjukQsnRxT
Content-Disposition: form-data; name="data-type"

application/xml
------WebKitFormBoundaryAXn851qjukQsnRxT--

Response:
HTTP/1.1 201 Created

Response headers

Name Value
X-egain-session Current session ID
Content-Type application/xml
Location /system/ws/v12/interaction/activity/2800

     

JSON

Request

Method URL
POST /ws/v12/interaction/activity

Request headers :

Name Value
X-egain-session Valid session ID
Content-Type multipart/form-data; boundary=----WebKitFormBoundaryAXn851qjukQsnRxT
Accept application/json
Accept-Language en-US

Request body:

------WebKitFormBoundaryAXn851qjukQsnRxT
Content-Disposition: form-data; name="data"

{
  "department": {
    "name": "service"
  },
  "type": {
    "value": "email",
    "subtype": {
      "value": "compose"
    }
  },
  "priority": 1,
  "dueDate": "2016-12-26T19:00:00.000Z",
  "subject": "Issue with laptop", 
  "queue":{
	  "name": "Email queue"
  },
  "payload": {
    "email": {
      "contents": {
        "content": [
          {
            "type": "text",
            "value": "this is the issue"
          },
          {
            "type": "html",
            "value": "<HTML><HEAD><TITLE></TITLE></HEAD><BODY><P>This is the issue <BR> </P></BODY></HTML>"
          }      
        ]
      },
      "emailAddresses": {
        "from": "support@business.com",
        "to": {
          "address": [
            "jhenry@customer.com"
          ]
        },
        "cc": {
          "address": [
            "khenry@customer.com"
          ]
        },
        "bcc": {
          "address": [
            "dhenry@customer.com"
          ]
        }
      }
    }
  },
  "customer": {
        "type": {
            "value": "group",
            "group": {
                "type": {
                    "value": "Association"
                },
                "region": "Europe",
                "numberOfMembers": "12",
                "income": "1000000",
                "currency": "USD",
                "registrationNumber": "324",
                "affiliation": "FCMA"
            }
        },
        "customerName": "Unichem Laboratories Limited",
        "level": {
            "value": "Platinum"
        },
        "role": {
            "value": "Partner"
        },
        "pin": "0121",
        "howReferred": {
            "value": "Customer"
        },
        "industry": {
            "value": "Health care"
        },
        "marketSegment": "Medical Products",
        "entitlements": "Free service",
        "contactPersons": {
            "contactPerson": [
                {
                    "salutation": "Mr.",
                    "firstName": "Kriag",
                    "middleName": "Goldman",
                    "lastName": "Francis",
                    "loginId": "kfrancis",
                    "gender": {
                        "value": "Male"
                    },
                    "identification": {
                        "type": "SSN",
                        "value": "111-22-8765"
                    },
                    "suffix": {
                        "value": "Jr."
                    },
                    "initials": "A.",
                    "secretQuestion": "Place of Birth",
                    "secretAnswer": "Sunnyvale",
                    "hasDirectMailingConsent": "true",
                    "hasDirectCallingConsent": "true",
                    "hasHoldingDataConsent": "true",
                    "jobTitle": "Manager",
                    "employmentStatus": {
                        "value": "Intern"
                    },
                    "priority": "High",
                    "dateOfBirth": "1965-12-09T00:00:00.000Z",
                    "maritalStatus": {
                        "value": "Married"
                    },
                    "type": {
                        "value": "Billing"
                    },
                    "firstNameFurigana": "Kriag",
                    "middleNameFurigana": "Goldman",
                    "lastNameFurigana": "Francis",
                    "startGreeting": "Hello",
                    "endGreeting": "Byee",
                    "spouseName": "Sara",
                    "emergencyContact": "998-765-4321",
                    "occupation": "Branch Manager",
                    "incomeLevel": "40000-50000",
                    "educationLevel": {
                        "value": "Graduate"
                    },
                    "race": "African",
                    "dependents": "4",
                    "isSmoker": "true",
                    "hobbies": "Farming",
                    "interests": "Painting",
                    "contactOrder": "1984",
                    "contactPoints": {
                        "contactPoint": [
                            {
                                "type": {
                                    "value": "postal",
                                    "postal": {
                                        "type": {
                                            "value": "Office address"
                                        },
                                        "address_1": "345",
                                        "address_2": "E Midfield Rd",
                                        "city": "Mountain View",
                                        "state": "Ca",
                                        "zip": "98704",
                                        "country": "USA",
                                        "region": "United States"
                                    }
                                },
                                "priority": {
                                    "value": "Low"
                                }
                            }
                        ]
                    }
                }
            ]
        }
    },
  "customAttributes": {
    "customAttribute": [
      {
        "attribName": "laptop_identification_no",
        "attribValues": {
          "attribValue": [
            {
              "value": "CE1222212GKAHDHFUJUUUEMMJDJ27SDJD"
            }
          ]
        }
      },
      {
        "attribName": "previousattempts",
        "attribValues": {
          "attribValue": [
            {
              "value": "2"
            }
          ]
        }
      },     
      {
        "attribName": "domain",
        "attribValues": {
          "attribValue": [
            {
              "value": "laptop"
            },
            {
              "value": "display"
            }
          ]
        }     
      }
    ]
  }
}
------WebKitFormBoundaryAXn851qjukQsnRxT
Content-Disposition: form-data; name="data-type"

application/json
------WebKitFormBoundaryAXn851qjukQsnRxT--

Response:
HTTP/1.1 201 Created

Response headers

Name Value
X-egain-session Current session ID
Content-Type application/json
Location /system/ws/v12/interaction/activity/2800