incesoft msn bot platform sdk development guide

Page 1

INCESOFT BOT PLATFORM SDK (Professional) Development Guide


Contents INCESOFT BOT PLATFORM SDK (PROFESSIONAL)··························································1 DEVELOPMENT GUIDE ·············································································································1 CONTENTS·····································································································································2 1

GETTING HELPS ··················································································································3 1.1 1.2 1.3

CUSTOMER SERVICE SUPPORT ·························································································3 FORUM SUPPORT ·············································································································3 OTHER DOCUMENTATION ································································································3

2

ARCHITECTURE OVERVIEW···························································································4

3

KEY FEATURES ····················································································································5 3.1 PROFESSIONAL ················································································································5 3.1.1 Robot Profile ·············································································································5 3.1.2 Custom Emoticon ······································································································5 3.1.3 Nudge ························································································································5 3.1.4 Activity (P4) Application···························································································6 3.1.5 Preface (P4Context)··································································································6 3.2 ENTERPRISE ····················································································································7

4

DEVELOPMENT PROCESS ································································································7 4.1 4.2

GO TO THE SERVICE PROVIDER WEBSITE(HTTP://SP.INCESOFT.COM)TO REGISTER········7 GO TO YOUR REGISTERED EMAIL BOX TO RECEIVE THE SPID ACTIVATED EMAIL SENT FROM INCESOFT ··························································································································8 4.3 ACTIVATE THE SPID ASSIGNED BY INCESOFT, DOWNLOAD SDK···································8 4.4 ADD ROBOT ACCOUNT ····································································································9 4.5 ADD SDK TO YOUR PROJECT (TAKE C# FOR EXAMPLE)·················································9 4.6 CODING ·························································································································10 4.7 DEBUG ··························································································································10 4.8 DEPLOY YOUR ROBOT SERVER ······················································································10 5

DEMO CODE························································································································ 11 5.1 5.2 5.3

C# DEMO ······················································································································11 C++ DEMO ····················································································································12 JAVA DEMO ····················································································································12


1

Getting Helps 1.1

Customer Service Support

Developers can contact our Customer Service Representative for products information or technical support. Phone

86-21-52162122

E-MAIL

xiaoisupport@incesoft.com

MSN

xiaoisupport@hotmail.com

Address

3F, No.799, West Tianshan Road, Shanghai, China

Zip Code

200335

1.2

Forum Support

Please post your enquiries on our developer forum, and we will give you feedback in a short time. Forum location is: http://forum.incesoft.com

1.3

Other Documentation

We provide C#, C++, Java APIs documentation, by which developers can get relevant helps.


2

Architecture Overview

Incesoft BOT Platform Servers

Microsoft MSN Servers

msn user

Service Provider Robot Servers (implements sdk)

Service Provider Robot Servers (implements sdk)

msn user

msn user

Figure 1 Please see Figure 1 for the web architecture of INCESOFT BOT Platform. The relationships among Service Provider, BOT Platform, MSN Servers and MSN user are very simple. When Service Provider Robot Servers connect with INCESOFT BOT Platform Servers, Service Provider can provide service for users. And when end-users who installed MSN software connect to MSN Server, they can enjoy the services provided by service provider via INCESOFT BOT Platform. Service provider can use our SDK to develop their own robot server. When there are large amount of users, the robot servers can be deployed in several machines, and INCESOFT will ensure load balance and other web cluster problems. Robot account is logging in to MSN servers via BOT PLATFROM. As the account is running on INCESOFT BOT PLATFORM, its stability will be ensured by INCESOFT, and service provider needs not to care about it.


3

Key features 3.1

Professional 3.1.1 Robot Profile

With INCESOFT BOT Management Platform, developer can control their own robot profile, such as customizing robot friendly name, robot personal message, robot display picture (user tile) etc..

Figure 2

Figure 3

3.1.2 Custom Emoticon Use INCESOFT Bot Management Platform to add custom emoticon.

Figure 4 3.1.3 Nudge Developers can use SDK to enable robot to send nudge to users.

Figure 5


3.1.4 Activity (P4) Application Developers can use SDK to enable robot to send an activity to users. This activity (P4) Application is just showing a simple URL, developers need not to know Microsoft Activity SDK knowledge. To use some additional functions, such as Microsoft Activity SDK interacting with robot, please see Enterprise Development Guide.

Figure 6 3.1.5 Preface (P4Context) Use SDK to set preface for each dialogue.

Figure 7


3.2

Enterprise SDK

Enterprise SDK has more features such as wink, ink, file transferring, background, voice clip, multi user conversation etc., Before you could use the Enterprise SDK, you must sign the agreement of Enterprise SDK. For more details, please see http://sp.incesoft.com/enterp.asp.

4

Development Process 4.1

Go to the Service Provider websiteďźˆhttp://sp.incesoft.comto register

Figure 8

Figure 9


4.2

Go to your registered email box to receive the SPID activated email sent from Incesoft

Figure 10

4.3

Activate the SPID assigned by INCESOFT, download SDK

Figure 11


4.4

Add Robot Account

Robot account is the MSN account applied for from Microsoft. In SP Info management, select Account management to add robot account, then you can see your robot in the list. You can click sign in to login your robot, and after login the robot is in AWAY status (your MSN Client has added the robot as your Buddy; if no SP Robot Server is connected, appearing AWAY, otherwise appearing online).

Figure 12

4.5

Add SDK to your Project (take C# for example

Figure 13


4.6

Coding

Please see demo code and API documentation for reference.

4.7

Debug

It requires that your developing environment must be connected to Internet. As robot account is controlled by INCESOFT BOT Platform, developer needs not to care about the robot account (MSN account) login and stability. Developer can use their own developing tool debugging system, once your RobotServer debugging, it will login to INCESOFT BOT Platform automatically. At this time your robot shall be shifted from AWAY status to ONLINE status. All the operations in your code will be displayed directly in your conversation with robot. When you stop debugging, robot shall be in AWAY status again.

4.8

Deploy your Robot Server

After finishing your robot server, it can be run on any servers. Robot servers can be run on one or several machines (depending on your users number and communication).


5

Demo Code

The minimum demo that robot server can run onďźˆHello World Demo.

5.1 C# Demo using Incesoft.BotPlatform.SDK; using Incesoft.BotPlatform.SDK.Interface; public class HelloWorldRobot { static void Main(string[] args) { IRobotServer server = RobotServerFactory.Instance .createRobotServer("msnbot.incesoft.com", 6602); server.addRobotHandler(new MyHandler()); try { server.login("spid", "sppwd"); } catch (RobotException e) { System.Console.Out.WriteLine("Failed to connect :" + e.Message); } } } class MyHandler : IRobotHandler { public void sessionOpened(IRobotSession session, int OpenMode){} public void sessionClosed(IRobotSession session){} public void messageReceived(IRobotSession session, IRobotMessage message) { session.send("Hello World!"); } public void nudgeReceived(IRobotSession session){} public void activityAccepted(IRobotSession session){} public void activityRejected(IRobotSession session){} }


5.2 C++ Demo

#include "MsnBotClient.h" class CDemoBotEvent: public CMsnBotEvent { public: CMsnBotCommand BotCommand; void WINAPI OnBuddyMsg(LPCSTR lpBuddyAccount, LPCSTR lpMsg, LPCSTR lpFontName, DWORD dwFontColor, DWORD dwFontStyle) { BotCommand.SendMsg(lpBuddyAccount, "Hello world!"); } void WINAPI OnBuddyNudge(LPCSTR lpBuddyAccount){} void WINAPI OnBuddyAcceptP4(LPCSTR lpBuddyAccount){} void WINAPI OnBuddyDeclineP4(LPCSTR lpBuddyAccount){} void WINAPI OnLogin(int errcode, LPCSTR lpErrString){} void WINAPI OnLogout(int errcode){} void WINAPI OnSessionStart(LPCSTR lpBuddyAccount, LPCSTR DWORD dwBuddyStatus, DWORD dwType, DWORD dwClientID){} void WINAPI OnSessionEnd(LPCSTR lpBuddyAccount){}

lpBuddyName,

};

5.3 Java Demo import import import import import import

com.incesoft.botplatform.sdk.RobotException; com.incesoft.botplatform.sdk.RobotHandler; com.incesoft.botplatform.sdk.RobotMessage; com.incesoft.botplatform.sdk.RobotServer; com.incesoft.botplatform.sdk.RobotServerFactory; com.incesoft.botplatform.sdk.RobotSession;

public class HelloWorldRobot implements RobotHandler{ public static void main(String[] args) throws Exception { RobotServer server = RobotServerFactory.getInstance() .createRobotServer("msnbot.incesoft.com",6602); server.setRobotHandler(new HelloWorldRobot()); try { server.login("spid","sppwd");


Thread.sleep(120000); server.logout(); } catch (RobotException e) { e.printStackTrace(); } } public void messageReceived(RobotSession session, RobotMessage message) { try { session.send("Hello World!"); } catch (Exception e){ e.printStackTrace(); } } public public public public public }

void void void void void

sessionOpened(RobotSession session) {} sessionClosed(RobotSession session) {} nudgeReceived(RobotSession session) {} activityAccepted(RobotSession session) {} activityRejected(RobotSession session) {}


Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.