zalo page developers - …dl.developer.page.zaloapp.com/downloads/zalopagesdk_v4.9.5.pdf · zalo...

134
ZALO PAGE DEVELOPERS version 4.9.5 12/16/2015 VNG Corporation Tran Ngoc Huy Compatible with SDK version 3.9

Upload: vuongtu

Post on 05-Aug-2018

236 views

Category:

Documents


1 download

TRANSCRIPT

ZALO PAGE DEVELOPERS version 4.9.5

12/16/2015 VNG Corporation Tran Ngoc Huy

Compatible with SDK version 3.9

Table of Contents 1. Introduction ......................................................................................................................................... 6

1.1 Overview ........................................................................................................................................... 6

1.2 Definitions, Acronyms and Abbreviations ................................................................................. 6

2. Zalo Service Factory .......................................................................................................................... 7

3. ZaloOnBehalfServiceFactory ........................................................................................................... 8

3.1 How to obtain access token: ........................................................................................................ 8

3.2 How to use access token:.............................................................................................................. 9

4. Zalo Message Service API: .................................................................................................................... 10

4.1 sendTextMessage ......................................................................................................................... 10

4.2 sendTemplateTextMessage ........................................................................................................ 11

4.3 sendImageMessage ....................................................................................................................... 12

4.4 sendVoiceMessage ...................................................................................................................... 14

4.5 sendStickerMessage ......................................................................................................................... 15

4.6 sendContactMessage ................................................................................................................... 16

4.7 sendLinkMessage ......................................................................................................................... 17

4.8 sendMultiLinksMessage ............................................................................................................... 18

4.9 replyTextMessage ........................................................................................................................ 19

4.10 replyImageMessage ...................................................................................................................... 20

4.11 replyVoiceMessage ..................................................................................................................... 22

4.12 replyStickerMessage ........................................................................................................................ 23

4.13 replyContactMessage .................................................................................................................. 24

4.14 replyLinkMessage ........................................................................................................................ 25

4.15 replyMultiLinksMessage .............................................................................................................. 26

4.16 sendTextMessageByPhoneNum ...................................................................................................... 28

4.17 sendTemplateTextMessageByPhoneNum ....................................................................................... 29

4.18 sendImageMessageByPhoneNum ............................................................................................... 30

4.19 sendVoiceMessageByPhoneNum .................................................................................................... 32

4.20 sendStickerMessageByPhoneNum .................................................................................................. 33

4.21 sendContactMessageByPhoneNum ............................................................................................ 34

4.22 sendLinkMessageByPhoneNum ................................................................................................. 35

4.23 sendMultiLinksMessageByPhoneNum ...................................................................................... 36

4.24 replyTextMessageByPhoneNum ..................................................................................................... 37

2 | P a g e

4.25 replyVoiceMessageByPhoneNum ................................................................................................... 39

4.26 replyStickerMessageByPhoneNum ................................................................................................. 40

4.27 replyContactMessageByPhoneNum ........................................................................................... 41

4.28 replyLinkMessageByPhoneNum ................................................................................................ 42

4.29 replyMultiLinksMessageByPhoneNum ..................................................................................... 43

4.30 broadcastTextMessage ................................................................................................................ 45

4.31 broadcastImageMessage ............................................................................................................... 46

4.32 broadcastVoiceMessage ............................................................................................................. 47

4.33 broadcastStickerMessage ........................................................................................................... 47

4.34 broadcastContactMessage .......................................................................................................... 48

4.35 broadcastLinkMessage ................................................................................................................ 49

4.36 broadcastMultiLinksMessage .................................................................................................... 50

5. Zalo On Behalf Message Service API: ................................................................................................... 52

5.1 sendOnBehalfTextMessage ....................................................................................................... 52

5.2 sendOnBehalftImageMessage ..................................................................................................... 53

5.3 sendOnBehalfVoiceMessage ..................................................................................................... 55

5.4 sendOnBehalfStickerMessage ......................................................................................................... 56

5.5 sendOnBehalfContactMessage .................................................................................................. 57

5.6 sendOnBehalfLinkMessage ....................................................................................................... 58

5.7 sendOnBehalfMultiLinksMessage .............................................................................................. 59

5.8 sendOnBehalfTextMessageByPhoneNum .............................................................................. 60

5.9 sendOnBehalftImageMessageByPhoneNum ............................................................................. 62

5.10 sendOnBehalfVoiceMessageByPhoneNum ..................................................................................... 63

5.11 sendOnBehalfStickerMessageByPhoneNum ................................................................................... 65

5.12 sendOnBehalfContactMessageByPhoneNum ........................................................................... 66

5.13 sendOnBehalfLinkMessageByPhoneNum ................................................................................ 67

5.14 sendOnBehalfMultiLinksMessageByPhoneNum ..................................................................... 68

5.15 getPageInfoOnBehaft.................................................................................................................... 70

6. Zalo Query Service API ..................................................................................................................... 71

6.1 getMessageStatus .......................................................................................................................... 71

6.2 getProfile ........................................................................................................................................ 72

7. Zalo Social Service API ..................................................................................................................... 73

7.1 pushTextFeed ................................................................................................................................ 73

7.2 pushMultiImagesFeed ................................................................................................................... 73

7.3 pushVoiceFeed ............................................................................................................................. 75

7.4 pushStickerFeed ........................................................................................................................... 76

3 | P a g e

7.5 pushLinkFeed................................................................................................................................ 76

8. Zalo Upload Service API ................................................................................................................... 78

8.1 uploadImage ................................................................................................................................... 78

8.2 uploadVoice ................................................................................................................................... 78

9. Zalo Fan Service API ......................................................................................................................... 79

9.1 removeFanPage ............................................................................................................................. 79

9.2 removeFanPageByPhoneNum ..................................................................................................... 79

10. Zalo SDK Exception .......................................................................................................................... 81

11. RESTful API ....................................................................................................................................... 86

11.1 Zalo Message Service .................................................................................................................... 86

11.1.1 sendTextMessage ............................................................................................................. 86

11.1.2 sendTemplateTextMessage ............................................................................................ 87

11.1.3 sendImageMessage .......................................................................................................... 88

11.1.4 sendVoiceMessage .......................................................................................................... 88

11.1.5 sendStickerMessage......................................................................................................... 89

11.1.6 sendContactMessage ....................................................................................................... 89

11.1.7 sendLinkMessage ............................................................................................................. 89

11.1.8 sendMultiLinksMessage ................................................................................................. 90

11.1.9 replyTextMessage ............................................................................................................ 91

11.1.10 replyImageMessage ..................................................................................................... 91

11.1.11 replyVoiceMessage...................................................................................................... 91

11.1.12 replyStickerMessage.................................................................................................... 92

11.1.13 replyContactMessage .................................................................................................. 92

11.1.14 replyLinkMessage ........................................................................................................ 92

11.1.15 replyMultiLinksMessage ............................................................................................ 93

11.1.16 sendTextMessageByPhoneNum .................................................................................. 94

11.1.17 sendTemplateTextMessageByPhoneNum .............................................................. 94

11.1.18 sendImageMessageByPhoneNum ............................................................................... 95

11.1.19 sendVoiceMessageByPhoneNum ............................................................................. 95

11.1.20 sendStickerMessageByPhoneNum ........................................................................... 95

11.1.21 sendContactMessageByPhoneNum ............................................................................ 96

11.1.22 sendLinkMessageByPhoneNum ................................................................................. 96

11.1.23 sendMultiLinksMessageByPhoneNum ................................................................... 96

11.1.24 replyTextMessageByPhoneNum ................................................................................. 97

11.1.25 replyImageMessageByPhoneNum .............................................................................. 97

4 | P a g e

11.1.26 replyVoiceMessageByPhoneNum ............................................................................ 98

11.1.27 replyStickerMessageByPhoneNum .......................................................................... 98

11.1.28 replyContactMessageByPhoneNum ........................................................................... 98

11.1.29 replyLinkMessageByPhoneNum ................................................................................ 99

11.1.30 replyMultiLinksMessageByPhoneNum .................................................................. 99

11.1.31 broadcastTextMessage .............................................................................................. 100

11.1.32 broadcastImageMessage ............................................................................................. 100

11.1.33 broadcastVoiceMessage ........................................................................................... 100

11.1.34 broadcastStickerMessage ......................................................................................... 101

11.1.35 broadcastContactMessage ........................................................................................ 101

11.1.36 broadcastLinkMessage .............................................................................................. 101

11.1.37 broadcastMultiLinksMessage .................................................................................. 102

11.2 Zalo On Behalf Message Service ................................................................................................ 103

11.2.1 sendOnBehalfTextMessage ......................................................................................... 103

11.2.2 sendOnBehalfImageMessage ...................................................................................... 103

11.2.3 sendOnBehalfVoiceMessage ....................................................................................... 103

11.2.4 sendOnBehalfStickerMessage ..................................................................................... 105

11.2.5 sendOnBehalfContactMessage.................................................................................... 105

11.2.6 sendOnBehalfLinkMessage ......................................................................................... 105

11.2.7 sendOnBehalfMultiLinksMessage ............................................................................. 106

11.2.8 sendOnBehalfTextMessageByPhoneNum................................................................ 106

11.2.9 sendOnBehalfImageMessageByPhoneNum ................................................................ 107

11.2.10 sendOnBehalfVoiceMessageByPhoneNum ......................................................... 107

11.2.11 sendOnBehalfStickerMessageByPhoneNum ....................................................... 107

11.2.12 sendOnBehalfContactMessageByPhoneNum ......................................................... 107

11.2.13 sendOnBehalfLinkMessageByPhoneNum............................................................... 108

11.2.14 sendOnBehalfMultiLinksMessageByPhoneNum ............................................... 108

11.2.15 getPageInfoOnBehaft ................................................................................................ 109

11.3 Zalo Query Service ....................................................................................................................... 110

11.3.1 getMessageStatus ........................................................................................................... 110

11.3.2 getProfile .......................................................................................................................... 111

11.4 Zalo Social Service ....................................................................................................................... 111

11.4.1 pushTextFeed .................................................................................................................. 112

11.4.2 pushImageFeed ............................................................................................................... 112

11.4.3 pushVoiceFeed ............................................................................................................... 113

5 | P a g e

11.4.4 pushStickerFeed ............................................................................................................. 113

11.4.5 pushLinkFeed ................................................................................................................. 113

11.5 Zalo Fan Service ........................................................................................................................... 114

11.5.1 removeFanPage .............................................................................................................. 114

11.5.2 removeFanPageByPhoneNum .................................................................................... 114

11.6 Zalo Chat Service ......................................................................................................................... 115

11.6.1 getConversationOnBehaft ............................................................................................ 115

11.6.2 getConversationByPhoneNumOnBehaft .................................................................. 117

11.7 Zalo Page Info Service ................................................................................................................. 119

11.7.1 getPageProfile ................................................................................................................. 119

11.7.2 getUserProfile ................................................................................................................. 119

11.7.3 getListFans ...................................................................................................................... 120

11.7.4 getListUidsRecentChat ................................................................................................. 121

12. Notify events................................................................................................................................... 122

12.1 UserSendTextMessageEvent ................................................................................................... 122

12.2 UserSendImageMessageEvent ................................................................................................ 122

12.3 UserSendVoiceMessageEvent ................................................................................................. 122

12.4 UserSendLocationMessageEvent ........................................................................................... 123

12.5 FollowPageEvent ........................................................................................................................ 123

12.6 UnFollowPageEvent .................................................................................................................. 123

12.7 SubcribePageEvent .................................................................................................................... 124

12.8 UnSubcribePageEvent .............................................................................................................. 124

13. Message status event .................................................................................................................... 125

14. Appended ........................................................................................................................................... 127

14.1 Mapping RESTful hander.......................................................................................................... 127

14.2 Mapping event handler ............................................................................................................ 132

6 | P a g e

1. Introduction

1.1 Overview

This document describes in detail all APIs that Zalo Page opens for a third-party to

interact with their fans on Zalo Page.

With these APIs, a third-party can send, broadcast Zalo message to their fans, query

fan „s profile and also can post feed to share the social activities on Zalo page etc.

All the interaction of a fan on a Zalo page of the third-party will be notified to the

third-party via notify event system.

1.2 Definitions, Acronyms and Abbreviations

Definitions, Acronyms and

Abbreviations

Description

Mac

Mac is a Hex string which is

hashed by SHA- 256 and it is

used in authentication. This

algorithm is apply in all api of

this SDK. pageId

Page ‘s id. You will be received it when you register your page on zalo.

secretKey

Page ‘s secret key. You will be received it when you register

your page on zalo.

7 | P a g e

2. Zalo Service Factory

Zalo Service Factory is a core class to create all services provided by Zalo page

platform such as: Message Service, Social Service, Query Service or Upload Service.

These services contain all of APIs which you need for your page.

To init a factory you need to call getServiceFactory function inside

ZaloServiceConfigure class, example below:

Input parameters:

Parameter Name Data type Require Description

pageId

Long

R

page ‘s id

secretKey

String

R

page ‘s SecretKey

ZaloServiceFactory factory = new ZaloServiceConfigure(pageId, secretKey).getZaloServiceFactory();

8 | P a g e

3. ZaloOnBehalfServiceFactory

3.1 How to obtain access token:

To obtain an accesToken, you need to make an HTTP GET request to

URL https://oauth.zaloapp.com/page/login?app_id={1}&redirect_uri={2}

{1}: your application ID (received from Zalo Admin)

{2}: your callback url which is used by zalo to send accessToken.

Note: AppID is different with PageID in section 2, you only need appID in

sendOnbehalf api.

If user hasn‟t login zalo, a login page will be opened as follow.

After login, user can select a page to grant permissions to allow your app to send

message on behalf of the selected page to its fan:

If user click agree (Dong y), a accessToken will be sent to via you callback Url.

9 | P a g e

3.2 How to use access token:

ZaloOnBehalf ServiceFactory is a factory class which is used to create an instance

of ZaloOnbehalfMessageService.

Input parameters:

Parameter Name Data type Require Description

appId

Long

R

Your appid

accessToken

String

R

Access token: after

client grant permission,

an accessToken will be

passed to your app via

your app callback URL.

pageId

Long

R

pageId that allow your page to send on behalf of it.

callbackUrl?uid={1}&access_token={2}

{1}: your cooperative page ID

{2}: access token

ZaloOnBehalfServiceFactory factory = new ZaloOnBehalfServiceConfigure(appId, accessToken,

page Id).getZaloServiceFactory();

10 | P a g e

4. Zalo Message Service API:

ZaloPageMessageService is created by the ZaloServiceFactory. This service is used to

send many types of message to zalo user. It provides these methods: sendTextMessage,

sendImageMessage, sendVoiceMessage, sendStickerMessage, sendContactMessage,

sendLinkMessage, sendMultiLinksMessage.

4.1 sendTextMessage

This API is used to send a text message to a fan of a page.

Interface:

Input parameters:

Parameter Name Data type Require Description

toUid

Long

R

Id of User receive message.

message

String

R

The content of the message

sms

String

Content of SMS message

isNotify

Boolean

Effected only if this API is configured to notify outside (default is false)

ZaloPageResult sendTextMessage (long toUid, String message, String sms, Boolean

isNotify);

11 | P a g e

Output parameters: ZaloPageResult

Parameter Name Data type Require Description

Error

Integer

R

Error code (>= 0 success)

ID

String

Message ‘s id if send successfully

4.2 sendTemplateTextMessage

This API is used to send a text message which follows a predefined template.

This template is managed by Zalo page system management.

Interface:

Input parameters:

Parameter Name

Data type Require Description

toUid

Long

R

Id of User receive message.

templateId

String

R

Template id

ZaloPageResult sendTemplateTextMessage (long toUid, String templateId, Map<String,

String> data, String sms, Boolean isNotify);

12 | P a g e

data

Map<String,String>

R

Key and value to fill in the placeholder in message template

sms

String

Content of SMS message. This is use if send zalo fail and we want to send a SMS message instead

isNotify

Boolean

Effected only if this API is configured to notify outside (default is false)

Example message template:

Welcome <customerName> to <pageName>!

We glad to inform you have you have just successfully registered our

<serviceName>.

Thanks,

VNG.Cop

Note:

Text in bold are placeholders, the key must be putted between “<” and “>”.

Output parameters: ZaloPageResult

Parameter Name Data type Require Description

Error

Integer

R

Error code (>= 0 success)

ID

String

Message ‘s id if send successfully

4.3 sendImageMessage

This API is used to send an image message (only accept png or jpg) to a fan of

a page.

13 | P a g e

Interface:

Input parameters:

Parameter Name Data type Require Description

toUid Long R Id of User receive message.

message

String

R

The content of the message (only support for zalo 2.0 and later)

imageId

String

R

Id of image which is returned from upload api.

sms

String

Content of SMS message

isNotify

Boolean

Effected only if this API is configured to notify outside (default is false)

Output parameters: ZaloPageResult

ZaloPageResult sendImageMessage (long toUid, String message, String imageId, String sms,

Boolean isNotify);

14 | P a g e

Parameter Name Data type Require Description

Error Integer R Error code (>= 0 success)

ID String Message ‘s id if send successfully

4.4 sendVoiceMessage

This API is used to send a voice message (only accept .amr) to a fan.

Interface:

Input parameters:

Parameter Name Data type Require Description

toUid

Long

R

Id of User receive message.

voiceId

String

R

Id of voice which is returned after calling upload voice api.

sms

String

Content of SMS message

isNotify

Boolean

Effected only if this API is configured to notify outside (default is false)

Output parameters: ZaloPageResult

Parameter Name Data type Require Description

ZaloPageResult sendVoiceMessage(long toUid, String voiceId, String sms, Boolean

isNotify);

15 | P a g e

Error

Integer

R

Error code (>= 0 success)

ID

String

Message ‘s id if send successfully

4.5 sendStickerMessage

This API is used to send a sticker message to a fan.

Interface:

Input parameters:

Parameter Name Data type Require Description

toUid

Long

R

Id of User receive message.

stickerId

String

R

Id of sticker provided by Zalo

Sms

String

Content of SMS message

isNotify

Boolean

Effected only if this API is configured to notify outside (default is false)

Output parameters: ZaloPageResult

Parameter Name Data type Require Description

ZaloPageResult sendStickerMessage(long toUid, int stickerId, String sms, Boolean isNotify);

16 | P a g e

Error

Integer

R

Error code (>= 0 success)

ID

String

Message ‘s id if send successfully

4.6 sendContactMessage

This API is used to send a contact message to a fan.

Interface:

Input parameters:

Parameter Name Data type Require Description

toUid

Long

R

Id of User receive message.

contactUId

Long

R

Id of User

sms

String

Content of SMS message

isNotify

Boolean

Effected only if this API is configured to notify outside (default is false)

Output parameters: ZaloPageResult

Parameter Name Data type Require Description

Error

Integer

R

Error code (>= 0 success)

ZaloPageResult sendContactMessage(long toUid, long contactUid, String sms, Boolean

isNotify);

17 | P a g e

ID

String

Message ‘s id if send successfully

4.7 sendLinkMessage This API is used to send a link message to a fan.

Interface:

Input parameters:

Parameter Name Data type Require Description

toUid

Long

R

Id of User receive message.

link

String

R

URL need push feed.

linkTitle

String

R

Title of link need push feed.

linkDesc

String

R

Description of the

linkThumb

String

R

URL of thumbnail

sms

String

Content of SMS message

isNotify

Boolean

Effected only if this API is configured to notify outside (default is false)

Output parameters: ZaloPageResult

ZaloPageResult sendLinkMessage(long toUid, String link, String linkTitle, String

linkDesc, String linkThumb, String sms, Boolean isNotify);

18 | P a g e

Parameter Name Data type Require Description

Error

Integer

R

Error code (>= 0 success)

ID

String

Message ‘s id if send successfully

4.8 sendMultiLinksMessage

This API is used to send a multi links message to a fan.

Interface:

Input parameters:

Parameter Name Data type Require Description

toUid

Long

R

Id of User receive message.

linksInfo

List<LinkInfo>

R

List linkInfo object.

ZaloPageResult sendMultiLinksMessage(long toUid, List<LinkInfo> linksInfo, String sms,

Boolean isNotify);

19 | P a g e

sms

String

Content of SMS message

isNotify

Boolean

Effected only if this API is configured to notify outside (default is false)

Output parameters: ZaloPageResult

Parameter Name Data type Require Description

Error

Integer

R

Error code (>= 0 success)

ID

String

Message ‘s id if send successfully

4.9 replyTextMessage

This API is used to reply a text message to a fan page message.

Interface:

ZaloPageResult replyTextMessage (long toUid, String message, String messageId, String

sms, Boolean isNotify);

20 | P a g e

Input parameters:

Parameter Name Data type Require Description

toUid

Long

R

Id of User receive message.

message

String

R

The content of the message

messageId

String

R

Id of the replied message

sms

String

Content of SMS message

isNotify

Boolean

Effected only if this API is configured to notify outside (default is false)

Output parameters: ZaloPageResult

Parameter Name Data type Require Description

Error

Integer

R

Error code (>= 0 success)

ID

String

Message ‘s id if send successfully

4.10 replyImageMessage

This API is used to reply an image message (only accept png or jpg) to a fan

page message.

21 | P a g e

Interface:

Input parameters:

Parameter Name Data type Require Description

toUid Long R Id of User receive message.

message

String

R

The content of the message (only support for zalo 2.0 and later)

messageId

String

R

Id of the replied message

imageId

String

R

Id of image which is returned from upload api.

sms

String

Content of SMS message

ZaloPageResult replyImageMessage (long toUid, String message, String messageId, String

imageId, String sms, Boolean isNotify);

22 | P a g e

isNotify

Boolean

Effected only if this API is configured to notify outside (default is false)

Output parameters: ZaloPageResult

Parameter Name Data type Require Description

Error Integer R Error code (>= 0 success)

ID String Message ‘s id if send successfully

4.11 replyVoiceMessage

This API is used to reply a voice message (only accept .amr) to a fan.

Interface:

Input parameters:

Parameter Name Data type Require Description

toUid

Long

R

Id of User receive message.

messageId

String

R

Id of the replied message

voiceId

String

R

Id of voice which is returned after calling upload voice api.

sms

String

Content of SMS message

ZaloPageResult replyVoiceMessage(long toUid, String messageId, String voiceId, String

sms, Boolean isNotify);

23 | P a g e

isNotify

Boolean

Effected only if this API is configured to notify outside (default is false)

Output parameters: ZaloPageResult

Parameter Name Data type Require Description

Error

Integer

R

Error code (>= 0 success)

ID

String

Message ‘s id if send successfully

4.12 replyStickerMessage

This API is used to reply a sticker message to a fan.

Interface:

Input parameters:

Parameter Name Data type Require Description

toUid

Long

R

Id of User receive message.

messageId

String

R

Id of the replied message

stickerId

String

R

Id of sticker provided by Zalo

ZaloPageResult replyStickerMessage(long toUid, String messageId, int stickerId, String sms,

Boolean isNotify);

24 | P a g e

Sms

String

Content of SMS message

isNotify

Boolean

Effected only if this API is configured to notify outside (default is false)

Output parameters: ZaloPageResult

Parameter Name Data type Require Description

Error

Integer

R

Error code (>= 0 success)

ID

String

Message ‘s id if send successfully

4.13 replyContactMessage

This API is used to reply a contact message to a fan.

Interface:

Input parameters:

Parameter Name Data type Require Description

toUid

Long

R

Id of User receive message.

messageId

String

R

Id of the replied message

ZaloPageResult replyContactMessage(long toUid, String messageId, long contactUid, String

sms, Boolean isNotify);

25 | P a g e

contactUId

Long

R

Id of User

sms

String

Content of SMS message

isNotify

Boolean

Effected only if this API is configured to notify outside (default is false)

Output parameters: ZaloPageResult

Parameter Name Data type Require Description

Error

Integer

R

Error code (>= 0 success)

ID

String

Message ‘s id if send successfully

4.14 replyLinkMessage This API is used to reply a link message to a fan.

Interface:

Input parameters:

Parameter Name Data type Require Description

toUid

Long

R

Id of User receive message.

messageId

String

R

Id of the replied message

ZaloPageResult replyLinkMessage(long toUid, String messageId, String link, String

linkTitle, String linkDesc, String linkThumb, String sms, Boolean isNotify);

26 | P a g e

link

String

R

URL need push feed.

linkTitle

String

R

Title of link need push feed.

linkDesc

String

R

Description of the

linkThumb

String

R

URL of thumbnail

sms

String

Content of SMS message

isNotify

Boolean

Effected only if this API is configured to notify outside (default is false)

Output parameters: ZaloPageResult

Parameter Name Data type Require Description

Error

Integer

R

Error code (>= 0 success)

ID

String

Message ‘s id if send successfully

4.15 replyMultiLinksMessage

This API is used to reply a multi links message to a fan.

27 | P a g e

Interface:

Input parameters:

Parameter Name Data type Require Description

toUid

Long

R

Id of User receive message.

messageId

String

R

Id of the replied message

linksInfo

List<LinkInfo>

R

List linkInfo object.

sms

String

Content of SMS message

isNotify

Boolean

Effected only if this API is configured to notify outside (default is false)

Output parameters: ZaloPageResult

ZaloPageResult replyMultiLinksMessage(long toUid, String messageId, List<LinkInfo>

linksInfo, String sms, Boolean isNotify);

28 | P a g e

Parameter Name Data type Require Description

Error

Integer

R

Error code (>= 0 success)

ID

String

Message ‘s id if send successfully

4.16 sendTextMessageByPhoneNum

This API is used to send a text message to a fan via fan‟s phone number.

Interface:

Input parameters:

Parameter Name Data type Require Description

phone

Long

R

Phone number of target User

message

String

R

The content of the message

sms

String

Content of SMS message

ZaloPageResult sendTextMessageByPhoneNum (long phone, String message, String sms,

Boolean isNotify);

29 | P a g e

isNotify

Boolean

Effected only if this API is configured to notify outside (default is false)

Output parameters: ZaloPageResult

Parameter Name Data type Require Description

Error

Integer

R

Error code (>= 0 success)

ID

String

Message ‘s id if send successfully

4.17 sendTemplateTextMessageByPhoneNum

This API is used to send a text message which follows a predefined template.

This template is managed by Zalo page system management.

Interface:

Input parameters:

Parameter Name Data type Require Description

ZaloPageResult sendTemplateTextMessageByPhoneNum (long phone, String templateId,

Map<String, String> data, String sms, Boolean isNotify);

30 | P a g e

phone

Long

R

Phone number of target User

templateId

String

R

Id of template

data

String

R

Key and value to fill in the placeholder in message template

sms

String

Content of SMS message. This is use if send zalo fail and we want to send a SMS message instead

isNotify

Boolean

Effected only if this API is configured to notify outside (default is false)

Example message template:

Welcome <customerName> to <pageName>!

We glad to inform you have you have just successfully registered our

<serviceName>.

Thanks,

VNG.Cop

Note:

Text in bold are placeholders, the key must be putted between “<” and “>”.

Output parameters: ZaloPageResult

Parameter Name Data type Require Description

Error

Integer

R

Error code (>= 0 success)

ID

String

Message ‘s id if send successfully

4.18 sendImageMessageByPhoneNum

This API is used to send an image message (only accept png or jpg) to a fan of

a page.

31 | P a g e

Interface:

Input parameters:

Parameter Name Data type Require Description

phone

Long

R

Phone number of target User

message

String

R

The content of the message (only support for zalo 2.0 and later)

imageId

String

R

Id of image which is returned from upload api.

sms

String

Content of SMS message

isNotify

Boolean

Effected only if this API is configured to notify outside (default is false)

Output parameters: ZaloPageResult

ZaloPageResult sendImageMessageByPhoneNum (long phone, String message, String

imageId, String sms, Boolean isNotify);

32 | P a g e

Parameter Name Data type Require Description

Error Integer R Error code (>= 0 success)

ID String Message ‘s id if send successfully

4.19 sendVoiceMessageByPhoneNum

This API is used to send a voice (only accept .amr) message to a fan.

Interface:

Input parameters:

Parameter Name Data type Require Description

phone

Long

R

Phone number of target User

(84) voiceId

String

R

Id of voice which is returned after calling upload voice service api

sms

String

Content of SMS message

isNotify

Boolean

Effected only if this API is configured to notify outside (default is false)

ZaloPageResult sendVoiceMessageByPhoneNum(long phone, String voiceId, String sms,

Boolean isNotify);

33 | P a g e

Output parameters: ZaloPageResult

Parameter Name Data type Require Description

Error

Integer

R

Error code (>= 0 success)

ID

String

Message ‘s id if send successfully

4.20 sendStickerMessageByPhoneNum

This API is used to send a sticker message to a fan.

Interface:

Input parameters:

Parameter Name Data type Require Description

phone

Long

R

Phone number of target User

. (84)

stickerId

String

R

Id of sticker after uploading is completed.

sms

String

Content of SMS message

isNotify

Boolean

Effected only if this API is configured to notify outside (default is false)

ZaloPageResult sendStickerMessageByPhoneNum(long phone, int stickerId, String sms,

Boolean isNotify);

34 | P a g e

Output parameters: ZaloPageResult

Parameter Name Data type Require Description

Error

Integer

R

Error code (>= 0 success)

ID

String

Message ‘s id if send successfully

4.21 sendContactMessageByPhoneNum

This API is used to send an contact message to a page „s fan.

Interface:

Input parameters:

Parameter Name Data type Require Description

phone

Long

R

Phone number of target User

. (84)

contactUId

String

R

Id of User.

sms

String

Content of SMS message

isNotify

Boolean

Effected only if this API is configured to notify outside (default is false)

ZaloPageResult sendContactMessageByPhoneNum(long phone, int contactUid, String

sms, Boolean isNotify);

35 | P a g e

Output parameters: ZaloPageResult

Parameter Name Data type Require Description

Error

Integer

R

Error code (>= 0 success)

ID

String

Message ‘s id if send successfully

4.22 sendLinkMessageByPhoneNum

This API is used to send a link message to a fan.

Interface:

Input parameters:

Parameter Name Data type Require Description

phone

Long

R

Phone number of target User . (84)

link

String

R

URL need push feed.

linkTitle

String

R

Title of link need push feed.

linkDesc

String

R

Description of link need push

feed.

ZaloPageResult sendLinkMessageByPhoneNum(long phone, String link, String

linkTitle, String linkDesc, String linkThumb, String sms, Boolean isNotify);

36 | P a g e

linkThumb

String

R

URL of thumbnail.

sms

String

Content of SMS message

isNotify

Boolean

Effected only if this API is configured to notify outside (default is false)

Output parameters: ZaloPageResult

Parameter Name Data type Require Description

Error

Integer

R

Error code (>= 0 success)

ID

String

Message ‘s id if send successfully

4.23 sendMultiLinksMessageByPhoneNum

This API is used to send multi links message to a fan.

Interface:

37 | P a g e

Input parameters:

Parameter Name Data type Require Description

phone

Long

R

Phone number of the target user. (84)

linksInfo

List<LinkInfo>

R

List linkInfo object.

sms

String

Content of SMS message

isNotify

Boolean

Effected only if this API is configured to notify outside (default is false)

Output parameters: ZaloPageResult

Parameter Name Data type Require Description

Error

Integer

R

Error code (>= 0 success)

ID

String

Message ‘s id if send successfully

4.24 replyTextMessageByPhoneNum

This API is used to reply a text message to a page fan message via fan‟s

phone number.

ZaloPageResult sendMultiLinksMessageByPhoneNum(long phone, List<LinkInfo>

linksInfo, String sms, Boolean isNotify);

38 | P a g e

Interface:

Input parameters:

Parameter Name Data type Require Description

phone

Long

R

Phone number of target User

message

String

R

The content of the message

messageId

String

R

Id of the replied message.

sms

String

Content of SMS message

isNotify

Boolean

Effected only if this API is configured to notify outside (default is false)

Output parameters: ZaloPageResult

Parameter Name Data type Require Description

Error

Integer

R

Error code (>= 0 success)

ZaloPageResult sendTextMessageByPhoneNum (long phone, String message, String

messageId, String sms, Boolean isNotify);

39 | P a g e

ID

String

Message ‘s id if send successfully

4.25 replyVoiceMessageByPhoneNum

This API is used to reply a voice (only accept .amr) message to a fan.

Interface:

Input parameters:

Parameter Name Data type Require Description

phone

Long

R

Phone number of target User

(84) messageId

String

R

Id of the replied message.

voiceId

String

R

Id of voice which is returned after calling upload voice service api

sms

String

Content of SMS message

isNotify

Boolean

Effected only if this API is configured to notify outside (default is false)

ZaloPageResult replyVoiceMessageByPhoneNum(long phone, String messageId, String

voiceId, String sms, Boolean isNotify);

40 | P a g e

Output parameters: ZaloPageResult

Parameter Name Data type Require Description

Error

Integer

R

Error code (>= 0 success)

ID

String

Message ‘s id if send successfully

4.26 replyStickerMessageByPhoneNum

This API is used to reply a sticker message to a fan.

Interface:

Input parameters:

Parameter Name Data type Require Description

phone

Long

R

Phone number of target User

. (84)

messageId

String

R

Id of the replied message.

stickerId

String

R

Id of sticker after uploading is completed.

sms

String

Content of SMS message

ZaloPageResult replyStickerMessageByPhoneNum(long phone, String messageId, int

stickerId, String sms, Boolean isNotify);

41 | P a g e

isNotify

Boolean

Effected only if this API is configured to notify outside (default is false)

Output parameters: ZaloPageResult

Parameter Name Data type Require Description

Error

Integer

R

Error code (>= 0 success)

ID

String

Message ‘s id if send successfully

4.27 replyContactMessageByPhoneNum

This API is used to reply an contact message to a page „s fan.

Interface:

Input parameters:

Parameter Name Data type Require Description

phone

Long

R

Phone number of target User

. (84)

messageId

String

R

Id of the replied message.

ZaloPageResult replyContactMessageByPhoneNum(long phone, String messageId, int

contactUid, String sms, Boolean isNotify);

42 | P a g e

contactUId

String

R

Id of User.

sms

String

Content of SMS message

isNotify

Boolean

Effected only if this API is configured to notify outside (default is false)

Output parameters: ZaloPageResult

Parameter Name Data type Require Description

Error

Integer

R

Error code (>= 0 success)

ID

String

Message ‘s id if send successfully

4.28 replyLinkMessageByPhoneNum

This API is used to reply a link message to a fan.

Interface:

Input parameters:

Parameter Name Data type Require Description

phone

Long

R

Phone number of target User . (84)

ZaloPageResult replyLinkMessageByPhoneNum(long phone, String messageId, String

link, String linkTitle, String linkDesc, String linkThumb, String sms, Boolean

isNotify);

43 | P a g e

messageId

String

R

Id of the replied message.

link

String

R

URL need push feed.

linkTitle

String

R

Title of link need push feed.

linkDesc

String

R

Description of link need push

feed. linkThumb

String

R

URL of thumbnail.

sms

String

Content of SMS message

isNotify

Boolean

Effected only if this API is configured to notify outside (default is false)

Output parameters: ZaloPageResult

Parameter Name Data type Require Description

Error

Integer

R

Error code (>= 0 success)

ID

String

Message ‘s id if send successfully

4.29 replyMultiLinksMessageByPhoneNum

This API is used to send multi links message to a fan.

44 | P a g e

Interface:

Input parameters:

Parameter Name Data type Require Description

phone

Long

R

Phone number of the target user. (84)

messageId

String

R

Id of the replied message.

linksInfo

List<LinkInfo>

R

List linkInfo object.

sms

String

Content of SMS message

isNotify

Boolean

Effected only if this API is configured to notify outside (default is false)

Output parameters: ZaloPageResult

ZaloPageResult replyMultiLinksMessageByPhoneNum(long phone, String messageId,

List<LinkInfo> linksInfo, String sms, Boolean isNotify);

45 | P a g e

Parameter Name Data type Require Description

Error

Integer

R

Error code (>= 0 success)

ID

String

Message ‘s id if send successfully

4.30 broadcastTextMessage

This API is used to broadcast a text message to all fans of a page

Interface:

Input parameters:

Parameter Name Data type Require Description

message

String

R

The content of the message

Output parameters: ZaloPageResult

Parameter Name Data type Require Description

ZaloPageResult broadcastTextMessage (String message);

46 | P a g e

Error

Integer

R

Error code (>= 0 success)

ID

String

Message ‘s id if send successfully

4.31 broadcastImageMessage

This API is used to broadcast an image message to all fans of a page

Interface:

Input parameters:

Parameter Name Data type Require Description

imageId

String

R

Id of image which is returned from uploadImage api.

Output parameters: ZaloPageResult

Parameter Name Data type Require Description

ZaloPageResult broadcastImageMessage (String imageId);

47 | P a g e

Error

Integer

R

Error code (>= 0 success)

ID

String

Message ‘s id if send successfully

4.32 broadcastVoiceMessage

This API is used to broadcast a voice message (only accept .amr) to all fans of a

page

Interface:

Input parameters:

Parameter Name Data type Require Description

voiceId

String

R

voiceId which is returned after call upload voice api

Output parameters: ZaloPageResult

Parameter Name Data type Require Description

Error

Integer

R

Error code (>= 0 success)

ID

String

Message ‘s id if send successfully

4.33 broadcastStickerMessage

This API is used to broadcast a sticker message to all fans of a page.

ZaloPageResult broadcastVoiceMessage(String voiceId);

48 | P a g e

Interface:

Input parameters:

Parameter Name Data type Require Description

stickerId

String

R

Id of sticker which is provided by Zalo.

Output parameters: ZaloPageResult

Parameter Name Data type Require Description

Error

Integer

R

Error code (>= 0 success)

ID

String

Message ‘s id if send successfully

4.34 broadcastContactMessage

This API is used to broadcast a contact message to all fans of a page.

Interface:

Input parameters:

ZaloPageResult broadcastStickerMessage(int stickerId);

ZaloPageResult broadcastContactMessage(long contactUid);

49 | P a g e

Parameter Name Data type Require Description

contactUId

Long

R

Id of the contact.

Output parameters: ZaloPageResult

Parameter Name Data type Require Description

Error

Integer

R

Error code (>= 0 success)

ID

String

Message ‘s id if send successfully

4.35 broadcastLinkMessage

This API is used to broadcast a link message to all fans of a page.

Interface:

Input parameters:

Parameter Name Data type Require Description

link

String

R

URL need push feed.

linkTitle

String

R

Title of link need push feed.

ZaloPageResult broadcastLinkMessage(String link, String linkTitle, String linkDesc,

String linkThumb);

50 | P a g e

linkDesc

String

R

Description of link need push feed.

linkThumb

String

R

URL of thumbnail need push

feed.

Output parameters: ZaloPageResult

Parameter Name Data type Require Description

Error

Integer

R

Error code (>= 0 success)

ID

String

Message ‘s id if send successfully

4.36 broadcastMultiLinksMessage

This API is used to broadcast an multi links message to all fans of a page.

Interface:

Input parameters:

ZaloPageResult broadcastMultiLinksMessage(List<LinkInfo> linksInfo);

51 | P a g e

Parameter Name Data type Require Description

linksInfo

List<LinkInfo>

R

List linkInfo object.

Output parameters: ZaloPageResult

Parameter Name Data type Require Description

Error

Integer

R

Error code (>= 0 success)

ID

String

Message ‘s id if send successfully

52 | P a g e

5. Zalo On Behalf Message Service API:

ZaloOnBehalfMessageService is created by the ZaloOnBehalfServiceFactory. This

service is used to send many types of message to zalo user. It provides these methods:

sendOnBehalfTextMessage, sendOnBehalfTextMessageByPhoneNum

5.1 sendOnBehalfTextMessage

This api allows a page A to on behalf of page B to send a text message to a

fan of page B. User will see the message as if it is sent by page B.

Interface:

Input parameters:

Parameter Name

Data type Require Description

toUid

Long

R

Id of User receive message.

templateId

String

R

Template id provided by page B.

data

Map<String,String>

R

Key and value to fill in the placeholder in message template

ZaloPageResult sendOnBehalfTextMessage (long toUid, String templateId, Map<String,

String> data, String sms, Boolean isNotify);

53 | P a g e

sms

String

Content of SMS message. This is use if send zalo fail and we want to send a SMS message instead(not support for now)

isNotify

Boolean

Effected only if this API is configured to notify outside (default is false)

Example message template:

Welcome <customerName> to <pageName>!

We glad to inform you have you have just successfully registered our

<serviceName>.

Thanks,

VNG.Corp

Note:

Text in bold are placeholders, the key must be putted between “<” and “>”.

Output parameters: ZaloPageResult

Parameter Name Data type Require Description

Error

Integer

R

Error code (>= 0 success)

ID

String

Message ‘s id if send successfully

5.2 sendOnBehalftImageMessage

This api allows a page A to on behalf of page B to send a image message to

a fan of page B. User will see the message as if it is sent by page B.

54 | P a g e

Interface:

Input parameters:

Parameter Name Data type Require Description

toUid Long R Id of User receive message.

message

String

R

The content of the message (only support for zalo 2.0 and later)

imageId

String

R

Id of image which is returned from upload api.

sms

String

Content of SMS message

isNotify

Boolean

Effected only if this API is configured to notify outside (default is false)

Output parameters: ZaloPageResult

ZaloPageResult sendOnBehalfImageMessage (long toUid, String message, String imageId,

String sms, Boolean isNotify);

55 | P a g e

Parameter Name Data type Require Description

Error Integer R Error code (>= 0 success)

ID String Message ‘s id if send successfully

5.3 sendOnBehalfVoiceMessage

This api allows a page A to on behalf of page B to send a voice message

(.amr only) to a fan of page B. User will see the message as if it is sent by

page B.

Interface:

Input parameters:

Parameter Name Data type Require Description

toUid

Long

R

Id of User receive message.

voiceId

String

R

Id of voice which is returned after calling upload voice api.

sms

String

Content of SMS message

isNotify

Boolean

Effected only if this API is configured to notify outside (default is false)

Output parameters: ZaloPageResult

Parameter Name Data type Require Description

ZaloPageResult sendOnBehalfVoiceMessage(long toUid, String voiceId, String sms,

Boolean isNotify);

56 | P a g e

Error

Integer

R

Error code (>= 0 success)

ID

String

Message ‘s id if send successfully

5.4 sendOnBehalfStickerMessage

This api allows a page A to on behalf of page B to send a stciker message to

a fan of page B. User will see the message as if it is sent by page B.

Interface:

Input parameters:

Parameter Name Data type Require Description

toUid

Long

R

Id of User receive message.

stickerId

String

R

Id of sticker provided by Zalo

Sms

String

Content of SMS message

isNotify

Boolean

Effected only if this API is configured to notify outside (default is false)

Output parameters: ZaloPageResult

ZaloPageResult sendOnBehalfStickerMessage(long toUid, int stickerId, String sms, Boolean

isNotify);

57 | P a g e

Parameter Name Data type Require Description

Error

Integer

R

Error code (>= 0 success)

ID

String

Message ‘s id if send successfully

5.5 sendOnBehalfContactMessage

This api allows a page A to on behalf of page B to send a contact message

to a fan of page B. User will see the message as if it is sent by page B.

Interface:

Input parameters:

Parameter Name Data type Require Description

toUid

Long

R

Id of User receive message.

contactUId

Long

R

Id of User

sms

String

Content of SMS message

isNotify

Boolean

Effected only if this API is configured to notify outside (default is false)

Output parameters: ZaloPageResult

ZaloPageResult sendOnBehalfContactMessage(long toUid, long contactUid, String sms,

Boolean isNotify);

58 | P a g e

Parameter Name Data type Require Description

Error

Integer

R

Error code (>= 0 success)

ID

String

Message ‘s id if send successfully

5.6 sendOnBehalfLinkMessage This api allows a page A to on behalf of page B to send a link message to a

fan of page B. User will see the message as if it is sent by page B.

Interface:

Input parameters:

Parameter Name Data type Require Description

toUid

Long

R

Id of User receive message.

link

String

R

URL need push feed.

linkTitle

String

R

Title of link need push feed.

linkDesc

String

R

Description of the

linkThumb

String

R

URL of thumbnail

sms

String

Content of SMS message

ZaloPageResult sendOnBehalfLinkMessage(long toUid, String link, String linkTitle,

String linkDesc, String linkThumb, String sms, Boolean isNotify);

59 | P a g e

isNotify

Boolean

Effected only if this API is configured to notify outside (default is false)

Output parameters: ZaloPageResult

Parameter Name Data type Require Description

Error

Integer

R

Error code (>= 0 success)

ID

String

Message ‘s id if send successfully

5.7 sendOnBehalfMultiLinksMessage

This api allows a page A to on behalf of page B to send a multi-links

message to a fan of page B. User will see the message as if it is sent by

page B.

Interface:

Input parameters:

ZaloPageResult sendOnBehalfMultiLinksMessage(long toUid, List<LinkInfo> linksInfo,

String sms, Boolean isNotify);

60 | P a g e

Parameter Name Data type Require Description

toUid

Long

R

Id of User receive message.

linksInfo

List<LinkInfo>

R

List linkInfo object.

sms

String

Content of SMS message

isNotify

Boolean

Effected only if this API is configured to notify outside (default is false)

Output parameters: ZaloPageResult

Parameter Name Data type Require Description

Error

Integer

R

Error code (>= 0 success)

ID

String

Message ‘s id if send successfully

5.8 sendOnBehalfTextMessageByPhoneNum

This api allows a page A to on behalf of page B to send a text message to a

fan of page B. User will see the message as if it is sent by page B.

61 | P a g e

Interface:

Input parameters:

Parameter Name

Data type Require Description

phoneNum

Long

R

Phone number of user receive message.

templateId

String

R

Template id

data

Map<String,String>

R

Key and value to fill in the placeholder in message template

sms

String

Content of SMS message. This is use if send zalo fail and we want to send a SMS message instead

isNotify

Boolean

Effected only if this API is configured to notify outside (default is false)

Example message template:

Welcome <customerName> to <pageName>!

ZaloPageResult sendOnBehalfTextMessageByPhoneNum (long phoneNum, String

templateId, Map<String, String> data, String sms, Boolean isNotify);

62 | P a g e

We glad to inform you have you have just successfully registered our

<serviceName>.

Thanks,

VNG.Corp

Note:

Text in bold are placeholders, the key must be putted between “<” and “>”.

Output parameters: ZaloPageResult

Parameter Name Data type Require Description

Error

Integer

R

Error code (>= 0 success)

ID

String

Message ‘s id if send successfully

5.9 sendOnBehalftImageMessageByPhoneNum

This api allows a page A to on behalf of page B to send a image message to

a fan of page B. User will see the message as if it is sent by page B.

Interface:

63 | P a g e

Input parameters:

Parameter Name Data type Require Description

phoneNum

Long

R

Phone number of user receive message.

message String

R

The content of the message (only support for zalo 2.0 and later)

imageId

String

R

Id of image which is returned from upload api.

sms

String

Content of SMS message

isNotify

Boolean

Effected only if this API is configured to notify outside (default is false)

Output parameters: ZaloPageResult

Parameter Name Data type Require Description

Error Integer R Error code (>= 0 success)

ID String Message ‘s id if send successfully

5.10 sendOnBehalfVoiceMessageByPhoneNum

This api allows a page A to on behalf of page B to send a voice message

(only .amr) to a fan of page B. User will see the message as if it is sent by

page B.

ZaloPageResult sendOnBehalfImageMessageByPhoneNum (long phoneNum, String

message, String imageId, String sms, Boolean isNotify);

64 | P a g e

Interface:

Input parameters:

Parameter Name Data type Require Description

phone

Long

R

Phone number of target User

(84) voiceId

String

R

Id of voice which is returned after calling upload voice service api

sms

String

Content of SMS message

isNotify

Boolean

Effected only if this API is configured to notify outside (default is false)

ZaloPageResult sendOnBehalfVoiceMessageByPhoneNum(long phone, String voiceId,

String sms, Boolean isNotify);

65

Output parameters: ZaloPageResult

Parameter Name Data type Require Description

Error

Integer

R

Error code (>= 0 success)

ID

String

Message ‘s id if send successfully

5.11 sendOnBehalfStickerMessageByPhoneNum

This api allows a page A to on behalf of page B to send a sticker message to

a fan of page B. User will see the message as if it is sent by page B.

Interface:

Input parameters:

Parameter Name Data type Require Description

phone

Long

R

Phone number of target User

. (84)

stickerId

String

R

Id of sticker after uploading is completed.

sms

String

Content of SMS message

isNotify

Boolean

Effected only if this API is configured to notify outside (default is false)

ZaloPageResult sendOnBehalfStickerMessageByPhoneNum(long phone, int stickerId,

String sms, Boolean isNotify);

66

Output parameters: ZaloPageResult

Parameter Name Data type Require Description

Error

Integer

R

Error code (>= 0 success)

ID

String

Message ‘s id if send successfully

5.12 sendOnBehalfContactMessageByPhoneNum

This api allows a page A to on behalf of page B to send a contact message

to a fan of page B. User will see the message as if it is sent by page B.

Interface:

Input parameters:

Parameter Name Data type Require Description

phone

Long

R

Phone number of target User

. (84)

contactUId

String

R

Id of User.

sms

String

Content of SMS message

ZaloPageResult sendOnBehalfContactMessageByPhoneNum(long phone, int contactUid,

String sms, Boolean isNotify);

67

isNotify

Boolean

Effected only if this API is configured to notify outside (default is false)

Output parameters: ZaloPageResult

Parameter Name Data type Require Description

Error

Integer

R

Error code (>= 0 success)

ID

String

Message ‘s id if send successfully

5.13 sendOnBehalfLinkMessageByPhoneNum

This api allows a page A to on behalf of page B to send a link message to a

fan of page B. User will see the message as if it is sent by page B.

Interface:

Input parameters:

Parameter Name Data type Require Description

phone

Long

R

Phone number of target User . (84)

link

String

R

URL need push feed.

linkTitle

String

R

Title of link need push feed.

ZaloPageResult sendOnBehalfLinkMessageByPhoneNum(long phone, String link,

String linkTitle, String linkDesc, String linkThumb, String sms, Boolean isNotify);

68

linkDesc

String

R

Description of link need push

feed. linkThumb

String

R

URL of thumbnail.

sms

String

Content of SMS message

isNotify

Boolean

Effected only if this API is configured to notify outside (default is false)

Output parameters: ZaloPageResult

Parameter Name Data type Require Description

Error

Integer

R

Error code (>= 0 success)

ID

String

Message ‘s id if send successfully

5.14 sendOnBehalfMultiLinksMessageByPhoneNum

This api allows a page A to on behalf of page B to send a multi-links

message to a fan of page B. User will see the message as if it is sent by page

B.

69

Interface:

Input parameters:

Parameter Name Data type Require Description

phone

Long

R

Phone number of the target user. (84)

linksInfo

List<LinkInfo>

R

List linkInfo object.

sms

String

Content of SMS message

isNotify

Boolean

Effected only if this API is configured to notify outside (default is false)

Output parameters: ZaloPageResult

Parameter Name Data type Require Description

Error

Integer

R

Error code (>= 0 success)

ZaloPageResult sendOnBehalfMultiLinksMessageByPhoneNum(long phone,

List<LinkInfo> linksInfo, String sms, Boolean isNotify);

70

ID

String

Message ‘s id if send successfully

5.15 getPageInfoOnBehaft

This API is used to get basic information of page.

Interface:

Output parameters: ZaloProfileResult object contain errorcode and ZaloProfile (if

has no problem in processing request, otherwise it will throw out a

ZaloSdkException)

ZaloProfile has follow fields:

ZaloProfileResult getPageInfoOnBehaft ();

{

- User ID long,

- Avatar String,

- Display Name String,

}

71

6. Zalo Query Service API

ZaloQueryService is created by the ZaloServiceFactory. This service provides apis

to query profile information and query status of a message.

6.1 getMessageStatus

This API is used to get status of a message.

Interface:

Input parameters:

Parameter Name Data type Require Description

msgId

String

R

Message ‘s id

Output parameters: ZaloMsgSttResult

Parameter Name Data type Description

Error

Integer

Error code (>= 0 success)

Status

Enum

Message ‘s status:

- UNDEF: Status message is undefined.

- DELIVERED: Message is delivered to

user ‘s zalo.

- SENT_ZALO: Message is sending to user

‘s zalo.

- SENT_SMS: SMS message is sent to user

‘s phone.

- NOT_DELIVERED: Message is sent

unsuccessfully.

- SENT_SMS_FAIL: SMS message is sent

failed. Check error code for details. - SEEN: Message is seen by user

ZaloMsgSttResult getMessageStatus (String msgId);

72

6.2 getProfile

This API is used to get basic information of an user.

Interface:

Input parameters:

Parameter Name Data type Require Description

userId

Long

R

User ‘s ID

Output parameters: ZaloProfile object (if has no problem in processing request,

otherwise it will throw out a ZaloSdkException)

ZaloProfile has follow fields:

ZPUserGender enum has these information below:

ZaloProfile getProfile (long userId);

{

- User ID long,

- Avatar String,

- Gender ZPUserGender enum,

- Display Name String,

}

{

- UGEN_Undef : Undefined

- UGEN_Male : Male,

- UGEN_Female : Female,

- UGEN_Other : Other gender,

}

73

7. Zalo Social Service API

ZaloSocialService is created by the ZaloServiceFactory. It includes these APIs:

pushTextFeed, pushMultiImagesFeed, pushVoiceFeed, pushSticker, pushLinkFeed.

7.1 pushTextFeed

This API is used to push text feed on your Zalo page‟s profile.

Interface:

Input parameters:

Parameter Name Data type Require Description

Message

String

R

Content of the message.

Output parameters: ZaloPageResult

Parameter Name Data type Require Description

Error

Integer

R

Error code (>= 0 success)

ID

String

Feed ‘s id if push successfully

7.2 pushMultiImagesFeed

ZaloPageResult pushTextFeed(String message);

74

This API is used to push multi images (only accept png or jpg, maximum 9 photos)

feed on your page‟s profile.

Interface:

Input parameters:

Parameter Name Data type Require Description

Message

String

R

Content of the message.

Images

List<String>

R

List image ‘s ID

Output parameters: ZaloPageResult

Parameter Name Data type Require Description

Error

Integer

R

Error code (>= 0 success)

ID

String

Feed ‘s id if push successfully

ZaloPageResult pushMultiImagesFeed(String message, List<String> images);

75

7.3 pushVoiceFeed

This API is used to push voice feed (only accept .amr) on your page‟s profile.

Interface:

Input parameters:

Parameter Name Data type Require Description

message

String

R

Content of the message.

voiceId

String

R

Id of voice which is returned from uploadVoice api

ZaloPageResult pushVoiceFeed(String message, String voiceId);

76

Output parameters: ZaloPageResult

Parameter Name Data type Require Description

Error

Integer

R

Error code (>= 0 success)

ID

String

R

Feed ‘s id if push successfully

7.4 pushStickerFeed

This API is used to push sticker feed on your page‟s profile.

Interface:

Input parameters:

Parameter Name Data type Require Description

message

String

R

Content of the message.

stickerId

String

R

Id of sticker.

7.5 pushLinkFeed

This API is used to push link feed on your page‟s profile.

ZaloPageResult pushStickerFeed(String message, int stickerId);

77

Interface:

Input parameters:

Parameter Name Data type Require Description

message

String

R

Content of the message.

link

String

R

URL need push feed.

linkTitle

String

R

Title of link need push feed.

linkDesc

String

R

Description of link need push feed.

linkThumb

String

R

URL of thumbnail need push feed.

Output parameters: ZaloPageResult

Parameter Name Data type Require Description

Error

Integer

R

Error code (>= 0 success)

ID

String

Feed id if push successfully.

ZaloPageResult pushLinkFeed(String message, String link, String linkTitle, String

linkDesc, String linkThumb);

78

8. Zalo Upload Service API

ZaloUploadService is created by the ZaloServiceFactory. It includes these APIs:

upload Image and uploadVoice. This service is used to upload image, voice to zalo

page server and this service will return an id which is used in all APIs related to

image and voice, for example: sendImageMessage, sendVoiceMessage,

broadcastImageMessage etc.

8.1 uploadImage

This API is used to upload image (only accept .png or .jpg).

Interface:

Input parameters:

Parameter Name Data type Require Description

path

String

R

path of the image is saved on

local hard disk.

Output parameters: string – id of the image

8.2 uploadVoice

This API is used to upload voice (only accept .amr).

Interface:

Input parameters:

Parameter Name Data type Require Description

path

String

R

path of the Voice file saved on local

device.

string uploadImage(String path);

string uploadVoice(String path);

79

Output parameters: string – id of the voice on Zalo server

9. Zalo Fan Service API

ZaloFanService is created by the ZaloServiceFactory. It includes these APIs:

removeFanPage and removeFanPageByPhoneNum. This service is used to remove

fan from zalo page.

9.1 removeFanPage

This API is used to remove fans from a zalo page.

Interface:

Input parameters:

Parameter Name Data type Requir

e Description

Uids

List<Long>

R

List user IDs

Output parameters: ZaloMapErrorResult

9.2 removeFanPageByPhoneNum

This API is used to remove fans from a zalo page.

Interface:

ZaloMapErrorResult removeFanPage(List<Long> uids);

{

- Error Integer, (>= 0 have at least one successful)

- MapError Map<Long, Integer>

(Key: userID, Value: errorCode)

}

ZaloMapErrorResult removeFanPageByPhoneNum(List<Long> phoneNums);

80

Input parameters:

Parameter Name Data type Requi

re Description

phoneNums

List<Long>

R

List user ‘s phone

numbers

Output parameters: ZaloMapErrorResult

{

- Error Integer, (>= 0 have at least one successful)

- MapError Map<Long, Integer>

(Key: phoneNumber, Value: errorCode)

}

81

10. Zalo SDK Exception

This exception is thrown if any issue happens during process a request.

ZaloSDK Exception Object:

Errorcode:

Code Message

>= 0 Successful.

-200 Server internal exception.

-201 User permission denied.

-202 Api is not exist.

-203 Out of quota.

-204 Application is not valid.

-205 Out of quota per day.

-206 Out of quota per week.

-207 Out of quota per month.

-210 Invalid file type. Only support PNG or JPG files

-211 Invalid file type. Only support AMR files

-212 Invalid file size. Only support file size smaller than 1 MB

-209 Quota for this API is not exist

-213 Mac is not valid

{ ← "message": string,

← "errorCode": integer

}

82

-214 Params are not valid

-215 Page not register Api

-216 Page out of quota

-217 Page out of quota day

-218 Page out of quota week

-219 Page out of quota month

-220 Page quota error

-221 Page is disabled

-222 Page secret key is not exist

-225 Page not register SMS

-226 Page SMS out of quota

-227 Page SMS out of quota day

-228 Page SMS out of quota week

-229 Page SMS out of quota month

-230 Page SMS quota error

-231, -232 Page SMS error

-233 Page group api out of quota

-234 Page group api out of quota day

-235 Page group api out of quota week

-236 Page group api out of quota month

-237 Page group api quota error

-238 Page user api out of quota

-239 Page user api out of quota day

-240 Page user api out of quota week

-241 Page user api out of quota month

-242 Page user api quota error

-243 Page user reply out of quota

-244 Page user reply quota error

-245 Timestamp existed, make sure timestamp is unique. -246 Phone number is not exist

83

-247 SMS message is not valid. No empty and maxlength is 160 chars.

-248 Message id is not valid

-249 User id is not exist

-250 Contact id is not exist

-251 User don’t follow your page

-252 Feed Id doesn’t belong to your page

-253 Feed Id is not exist

-254 Comment Id is not exist

-255 Comment Id doesn’t belong to your page

-256 User don’t subscribe your page

-261 Page is blocked broadcast all time in day

-270 Until now unsupport this API

-271 Page ID is not valid

-274 Template ID is not exist

-275 Missing key to generate message from template

-10100 Params are not valid

-10101 Server internal exception.

-10105 Access token is not valid.

-10109 Access token is not exist.

-10129 Access token is expired

-10111 API quota is not exist

-10112 API is not exist

-10106 App info is not exist

-10107 App secretKey is not exist

-10122 Removing access token is failed

-20001 Sorry! Now I don't want to receive message.

-20002 You currently banned message to stranger.

-20003 Message contains dirty word. Please check again!

-20004 This person don't allow message from stranger.

84

-20005 You and this person are not friend yet.

-20100 Params are not valid.

-20102 User profile is not exist.

-20103 User friend does not exist.

-20104 Photo does not exist.

-20105 Voice does not exist.

-20106 Upload media failed.

-20109 Params are not valid

-20111 Phone number is not exist

-20112 Album ‘s id is not exist

-20107 Message is builded fail

-20108 Get vip subscribe failed

-20113 Server is overloading

-20110 Your api is reached max

-30001 Sent SMS fail

-30002 SMS invalid input params

-30003 SMS permission denied

-30004 SMS not a test account

85

86

Parameter Name Data type

pageid Long

mac String

message String

touid Long

contactUid Long

stickered Integer

voice String

image String

phone (84) Long

message ID String

link String

linkthumb String

linkdesc String

linktitle String

feeId String

sms String

timestamp Long

11. RESTful API

If SDK is not suitable for you, you can call directly to zalo open apis services via RESTFUL apis.

To use Restful interface, you need to generate a timestamp which is a unique number for each request.

Besides that, SHA-256 is used to hash all parameters in the http request and the hashed value is passed to

server via a parameter named mac. A mac is used to authenticate all requests.

Note: the orders of parameters in http request must be the same with the order of parameters in the mac.

Data Type:

11.1 Zalo Message Service

All of apis below have the same json response:

11.1.1 sendTextMessage

Order string:

{

← "error": int,

← "id": string,

← "message": string (null if error >= 0)

}

87

URL:

11.1.2 sendTemplateTextMessage

Order string:

URL:

Data is json object contains these members. Example:

Mac = pageid + touid + message + sms + isNotify + timeStamp +

secretkey

http://openapi.zaloapp.com/page/message?

act=text&pageid={1}&mac={2}&touid={3}&message={4}&sms={5}&isnotify={6}&ti

mestamp={7}

Mac = pageid + touid + templateId + data + sms + isNotify +

timeStamp + secretkey

http://openapi.zaloapp.com/page/message?

act=templatetext&pageid={1}&mac={2}&touid={3}&templateid={4}&data={5}&sms={

6}&isnotify={7}&timestamp={8}

{

"key1": value1,

"key2": value2,

"key3": value3

….

}

88

11.1.3 sendImageMessage

Order string:

URL:

11.1.4 sendVoiceMessage

Order string:

URL:

Mac = pageid + touid + message + image + sms + isNotify + timeStamp + secretkey

http://openapi.zaloapp.com/page/message?

act=image&pageid={1}&mac={2}&touid={3}&message={4}&image={5}&sms={6}&is

notify={7}&timestamp={8}

Mac = pageid + touid + message + voice + sms + isNotify + timeStamp + secretkey

http://openapi.zaloapp.com/page/message?

act=voice&pageid={1}&mac={2}&touid={3}&message={4}&voice={5}&sms={6}&isn

otify={7}&timestamp={8}

89

11.1.5 sendStickerMessage

Order string:

URL:

11.1.6 sendContactMessage

Order string:

URL:

11.1.7 sendLinkMessage

Order string:

URL:

Mac = pageid + touid + message + sticker + sms + isNotify + timeStamp + secretkey

http://openapi.zaloapp.com/page/message?

act=sticker&pageid={1}&mac={2}&touid={3}&message={4}&stickerid={5}&sms={6}

&isnotify={7}&timestamp={8}

Mac = pageid + touid + message + contactuid + sms + isNotify + timeStamp +

secretkey

http://openapi.zaloapp.com/page/message?

act=contact&pageid={1}&mac={2}&touid={3}&message={4}&contactuid={5}&sms={

6}&isnotify={7}&timestamp={8}

Mac = pageid + touid + link + linktitle + linkdes + linkthumb + sms + i sNoti f y+

timeStamp + secretkey

http://openapi.zaloapp.com/page/message?

act=link&pageid={1}&mac={2}&touid={3}&link={4}&linktitle={5}&linkdes={

6}&linkthumb={7}&sms={8}&isnotify={9}&timestamp={10}

91

11.1.9 replyTextMessage

Order string:

URL:

11.1.10 replyImageMessage

Order string:

URL:

11.1.11 replyVoiceMessage

Order string:

URL:

Mac = pageid + touid + message + messageId + sms + isNotify +

timeStamp + secretkey

http://openapi.zaloapp.com/page/message?

act=reply&pageid={1}&mac={2}&touid={3}&message={4}&msgid={5}&sms={6}&isn

otify={7}&timestamp={8}

Mac = pageid + touid + message + messageId + image + sms + isNotify +

timeStamp + secretkey

http://openapi.zaloapp.com/page/message?

act=replyimage&pageid={1}&mac={2}&touid={3}&message={4}&msgid={5}&image=

{6}&sms={7}&isnotify={8}&timestamp={9}

Mac = pageid + touid + messageId + voice + sms + isNotify + timeStamp +

secretkey

92

11.1.12 replyStickerMessage

Order string:

URL:

11.1.13 replyContactMessage

Order string:

URL:

11.1.14 replyLinkMessage

Order string:

URL:

http://openapi.zaloapp.com/page/message?

act=replyvoice&pageid={1}&mac={2}&touid={3}&msgid={4}&voice={5}&sms={6}&i

snotify={7}&timestamp={8}

Mac = pageid + touid + messageId+ sticker + sms + isNotify + timeStamp + secretkey

http://openapi.zaloapp.com/page/message?

act=replysticker&pageid={1}&mac={2}&touid={3}&msgid={4}&stickerid={5}&sms={

6}&isnotify={7}&timestamp={8}

Mac = pageid + touid + messageId + contactuid + sms + isNotify + timeStamp +

secretkey

http://openapi.zaloapp.com/page/message?

act=replycontact&pageid={1}&mac={2}&touid={3}&msgid={4}&contactuid={5}&sms

={6}&isnotify={7}&timestamp={8}

Mac = pageid + touid + messageId + link + linktitle + linkdes + linkthumb + sms +

i sNot i fy+ timeStamp + secretkey

93

11.1.15 replyMultiLinksMessage

Order string:

URL:

Links is json array which contains linkinfo json object members. Example:

http://openapi.zaloapp.com/page/message?

act=replylink&pageid={1}&mac={2}&touid={3}&msgid={4}&link={5}&linktitle={6}&

linkdes={7}&linkthumb={8}&sms={9}&isnotify={10}&timestamp={11}

Mac = pageid + touid + messageId + links + sms + isNotify + timeStamp +

secretkey

http://openapi.zaloapp.com/page/message?

act=replylinks&pageid={1}&mac={2}&touid={3}&msgid={4}&links={5}&sms={6}&is

notify={7}&timestamp={8}

[

"{

"linkthumb":string,

"linktitle": string,

"link": string,

"linkdes": string

}",

"{

"linkthumb":string,

"linktitle": string,

"link": string,

"linkdes": string

}"

]

94

11.1.16 sendTextMessageByPhoneNum

Order string:

URL:

11.1.17 sendTemplateTextMessageByPhoneNum

Order string:

URL:

Data is json object contains these members. Example:

Mac = pageid + phone + message + sms + isNotify + timeStamp + secretkey

http://openapi.zaloapp.com/page/message/phone?

act=text&pageid={1}&mac={2}&phone={3}&message={4}&sms={5}&isnotify={6}&ti

mestamp={7}

Mac = pageid + phone + templateId + data + sms + isNotify +

timeStamp + secretkey

http://openapi.zaloapp.com/page/message/phone?

act=templatetext&pageid={1}&mac={2}&phone={3}&templateid={4}&data={5}&sms=

{6}&isnotify={7}&timestamp={8}

{

"key1": value1,

"key2": value2,

"key3": value3

….

}

95

11.1.18 sendImageMessageByPhoneNum

Order string:

URL:

11.1.19 sendVoiceMessageByPhoneNum

Order string:

URL:

11.1.20 sendStickerMessageByPhoneNum

Order string:

URL:

Mac = pageid + phone + message + image + sms + isNotify + timeStamp +

secretkey

http://openapi.zaloapp.com/page/message/phone?

act=image&pageid={1}&mac={2}&phone={3}&message={4}&image={5}&sms={6}&i

snotify={7}&timestamp={8}

Mac = pageid + phone + message + voice + sms + isNotify + timeStamp + secretkey

http://openapi.zaloapp.com/page/message/phone?

act=voice&pageid={1}&mac={2}&phone={3}&message={4}&voice={5}&sms={6}&is

notify={7}&timestamp={8}

Mac = pageid + phone + message + stickerid + sms + isNotify + timeStamp + secretkey

http://openapi.zaloapp.com/page/message/phone?

act=sticker&pageid={1}&mac={2}&phone={3}&message={4}&stickerid={5}&sms={6}

&isnotify={7}&timestamp={8}

96

11.1.21 sendContactMessageByPhoneNum

Order string:

URL:

11.1.22 sendLinkMessageByPhoneNum

Order string:

URL:

11.1.23 sendMultiLinksMessageByPhoneNum

Order string:

URL:

Links is json array which contains linkinfo json object members. Example:

Mac = pageid + phone + message + contactuid + sms + isNotify + timeStamp +

secretkey

http://openapi.zaloapp.com/page/message/phone?

act=contact&pageid={1}&mac={2}&phone={3}&message={4}&contactuid={5}&sms={

6}&isnotify={7}&timestamp={8}

Mac = pageid + phone + link + linktitle + linkdes + linkthumb + sms + i sNot i f y+

timeStamp + secretkey

http://openapi.zaloapp.com/page/message/phone?

act=link&pageid={1}&mac={2}&phone={3}&link={4}&linktitle={5}&linkdes={6}&link

thumb={7}&sms={8}&isnotify={9}&timestamp={10}

Mac = pageid + phone + links + sms + isNotify + timeStamp + secretkey

http://openapi.zaloapp.com/page/message/phone?

act=links&pageid={1}&mac={2}&phone={3}&links={4}&sms={5}&isnotify={6}&time

stamp={7}

97

11.1.24 replyTextMessageByPhoneNum

Order string:

URL:

11.1.25 replyImageMessageByPhoneNum

Order string:

URL:

[

"{

"linkthumb":string,

"linktitle": string,

"link": string,

"linkdes": string

}",

"{

"linkthumb":string,

"linktitle": string,

"link": string,

"linkdes": string

}"

]

Mac = pageid + phone + message + messageId + sms + isNotify + timeStamp +

secretkey

http://openapi.zaloapp.com/page/message/phone?

act=reply&pageid={1}&mac={2}&phone={3}&message={4}&msgid={5}&sms={6}&is

notify={7}&timestamp={8}

Mac = pageid + phone + message + messageId + image + sms + isNotify +

timeStamp + secretkey

98

11.1.26 replyVoiceMessageByPhoneNum

Order string:

URL:

11.1.27 replyStickerMessageByPhoneNum

Order string:

URL:

11.1.28 replyContactMessageByPhoneNum

Order string:

URL:

http://openapi.zaloapp.com/page/message/phone?

act=replyimage&pageid={1}&mac={2}&phone={3}&message={4}&msgid={5}&image

={6}&sms={7}&isnotify={8}&timestamp={9}

Mac = pageid + phone + messageId + voice + sms + isNotify + timeStamp +

secretkey

http://openapi.zaloapp.com/page/message/phone?

act=replyvoice&pageid={1}&mac={2}&phone={3}&msgid={4}&voice={5}&sms={6}

&isnotify={7}&timestamp={8}

Mac = pageid + phone + messageId + stickerid + sms + isNotify + timeStamp +

secretkey

http://openapi.zaloapp.com/page/message/phone?

act=replysticker&pageid={1}&mac={2}&phone={3}&msgid={4}&stickerid={5}&sms=

{6}&isnotify={7}&timestamp={8}

Mac = pageid + phone + messageId + contactuid + sms + isNotify + timeStamp +

secretkey

99

11.1.29 replyLinkMessageByPhoneNum

Order string:

URL:

11.1.30 replyMultiLinksMessageByPhoneNum

Order string:

URL:

Links is json array which contains linkinfo json object members. Example:

http://openapi.zaloapp.com/page/message/phone?

act=replycontact&pageid={1}&mac={2}&phone={3}&msgid={4}&contactuid={5}&sms

={6}&isnotify={7}&timestamp={8}

Mac = pageid + phone + messageId + link + linktitle + linkdes + linkthumb + sms +

i sNot i fy+ timeStamp + secretkey

http://openapi.zaloapp.com/page/message/phone?

act=replylink&pageid={1}&mac={2}&phone={3}&msgid={4}&link={5}&linktitle={6}&

linkdes={7}&linkthumb={8}&sms={9}&isnotify={10}&timestamp={11}

Mac = pageid + phone + messageId + links + sms + isNotify + timeStamp +

secretkey

http://openapi.zaloapp.com/page/message/phone?

act=replylinks&pageid={1}&mac={2}&phone={3}&msgid={4}&links={5}&sms={6}&i

snotify={7}&timestamp={8}

100

11.1.31 broadcastTextMessage

Order string:

URL:

11.1.32 broadcastImageMessage

Order string:

URL:

11.1.33 broadcastVoiceMessage

[

"{

"linkthumb":string,

"linktitle": string,

"link": string,

"linkdes": string

}",

"{

"linkthumb":string,

"linktitle": string,

"link": string,

"linkdes": string

}"

]

Mac = pageid + message + timeStamp + secretkey

http://openapi.zaloapp.com/page/broadcast?

act=text&pageid={1}&mac={2}&message={3}&timestamp={4}

Mac = pageid + message + image + timeStamp + secretkey

http://openapi.zaloapp.com/page/broadcast?

act=image&pageid={1}&mac={2}&message={3}&image={4}&timestamp={5}

101

Order string:

URL:

11.1.34 broadcastStickerMessage

Order string:

URL:

11.1.35 broadcastContactMessage

Order string:

URL:

11.1.36 broadcastLinkMessage

Order string:

Mac = pageid + message + voice + timeStamp + secretkey

http://openapi.zaloapp.com/page/broadcast?

act=voice&pageid={1}&mac={2}&message={3}&voice={4}&timestamp={5}

Mac = pageid + message + stickerid + timeStamp + secretkey

http://openapi.zaloapp.com/page/broadcast?

act=sticker&pageid={1}&mac={2}&message={3}&stickerid={4}&timestamp={5}

Mac = pageid + message + contactuid + timeStamp + secretkey

http://openapi.zaloapp.com/page/broadcast?

act=contact&pageid={1}&mac={2}&message={3}&contactuid={4}&timestamp={5}

102

URL:

11.1.37 broadcastMultiLinksMessage

Order string:

URL:

Links is json array which contains linkinfo json object members. Example:

Mac = pageid + link + linktitle + linkdes + linkthumb + timeStamp + secretkey

http://openapi.zaloapp.com/page/broadcast?

act=link&pageid={1}&mac={2}&link={3}&linktitle={4}&linkdes={5}&linkthu

mb={6}&timestamp={7}

Mac = pageid + links + timeStamp + secretkey

http://openapi.zaloapp.com/page/broadcast?

act=links&pageid={1}&mac={2}&links={3}&timestamp={4}

[

"{

"linkthumb":string,

"linktitle": string,

"link": string,

"linkdes": string

}",

"{

"linkthumb":string,

"linktitle": string,

"link": string,

"linkdes": string

}"

]

103

11.2 Zalo On Behalf Message Service

All of apis below have the same json response:

11.2.1 sendOnBehalfTextMessage

URL:

Data is json object contains these members. Example:

11.2.2 sendOnBehalfImageMessage

URL:

11.2.3 sendOnBehalfVoiceMessage

{

← "error": int,

← "id": string,

← "message": string (null if error >= 0)

}

http://openapi.zaloapp.com/page/behalf?

act=templatetext&appid={1}&accessTok={2}&pageid={3}&touid={4}&templateid={5}

&data={6}&sms={7}&isnotify={8}&timestamp={9}

{

"key1": value1,

"key2": value2,

"key3": value3

….

}

http://openapi.zaloapp.com/page/behalf?

act=image&appid={1}&accessTok={2}&pageid={3}&touid={4}&message={5}&image

={6}&sms={7}&isnotify={8}&timestamp={9}

105

11.2.4 sendOnBehalfStickerMessage

URL:

11.2.5 sendOnBehalfContactMessage

URL:

11.2.6 sendOnBehalfLinkMessage

URL:

http://openapi.zaloapp.com/page/behalf?

act=sticker&appid={1}&accessTok={2}&pageid={3}&touid={4}&message={5}&sticker

id={6}&sms={7}&isnotify={8}&timestamp={9}

http://openapi.zaloapp.com/page/behalf?

act=contact&appid={1}&accessTok={2}&pageid={3}&touid={4}&message={5}&conta

ctuid={6}&sms={7}&isnotify={8}&timestamp={9}

http://openapi.zaloapp.com/page/behalf?

act=link&appid={1}&accessTok={2}&pageid={3}&touid={4}&link={5}&linktitle={6}

&linkdes={ 7}&linkthumb={8}&sms={9}&isnotify={10}&timestamp={11}

106

11.2.7 sendOnBehalfMultiLinksMessage

URL:

Links is json array which contains linkinfo json object members. Example:

11.2.8 sendOnBehalfTextMessageByPhoneNum

URL:

Data is json object contains these members. Example:

http://openapi.zaloapp.com/page/behalf?

act=links&appid={1}&accessTok={2}&pageid={3}&touid={4}&links={5}&sms={6}&i

snotify={7}&timestamp={8}

[

"{

"linkthumb":string,

"linktitle": string,

"link": string,

"linkdes": string

}",

"{

"linkthumb":string,

"linktitle": string,

"link": string,

"linkdes": string

}"

]

http://openapi.zaloapp.com/page/behalf/phone?

act=templatetext&appid={1}&accessTok={2}&pageid={3}&phone={4}&templateid={5}

&data={6}&sms={7}&isnotify={8}&timestamp={9}

107

11.2.9 sendOnBehalfImageMessageByPhoneNum

URL:

11.2.10 sendOnBehalfVoiceMessageByPhoneNum

URL:

11.2.11 sendOnBehalfStickerMessageByPhoneNum

URL:

11.2.12 sendOnBehalfContactMessageByPhoneNum

URL:

{

"key1": value1,

"key2": value2,

"key3": value3

….

}

http://openapi.zaloapp.com/page/behalf/phone?

act=image&appid={1}&accessTok={2}&pageid={3}&phone={4}&message={5}&image

={6}&sms={7}&isnotify={8}&timestamp={9}

http://openapi.zaloapp.com/page/behalf/phone?

act=voice&appid={1}&accessTok={2}&pageid={3}&phone={4}&message={5}&voice=

{6}&sms={7}&isnotify={8}&timestamp={9}

http://openapi.zaloapp.com/page/behalf/phone?

act=sticker&appid={1}&accessTok={2}&pageid={3}&phone={4}&message={5}&sticke

rid={6}&sms={7}&isnotify={8}&timestamp={9}

http://openapi.zaloapp.com/page/behalf/phone?

act=contact&appid={1}&accessTok={2}&pageid={3}&phone={4}&message={5}&cont

actuid={6}&sms={7}&isnotify={8}&timestamp={9}

108

11.2.13 sendOnBehalfLinkMessageByPhoneNum

URL:

11.2.14 sendOnBehalfMultiLinksMessageByPhoneNum

URL:

Links is json array which contains linkinfo json object members. Example:

http://openapi.zaloapp.com/page/behalf/phone?

act=link&appid={1}&accessTok={2}&pageid={3}&phone={4}&link={5}&linktitle={6}

&linkdes={7}&linkthumb={8}&sms={9}&isnotify={10}&timestamp={11}

http://openapi.zaloapp.com/page/behalf/phone?

act=links&appid={1}&accessTok={2}&pageid={3}&phone={4}&links={5}&sms={6}&

isnotify={7}&timestamp={8}

[

"{

"linkthumb":string,

"linktitle": string,

"link": string,

"linkdes": string

}",

"{

"linkthumb":string,

"linktitle": string,

"link": string,

"linkdes": string

}"

]

109

11.2.15 getPageInfoOnBehaft

URL:

Response JSON:

http://openapi.zaloapp.com/page/behaft?act=profile&appid={1}&accessTok={2}&pageid

={3}&timestamp={4}

{ ← "error": int,

← "result":

{ ← "userId": long,

← "displayName": string,

← "avatar": string,

}

← "message": string (null if error >= 0)

}

110

11.3 Zalo Query Service

11.3.1 getMessageStatus

Order string:

URL:

Response JSON:

Mapping:

Error code Message status

0 Delivered

1 Sent_zalo

2 Sent_sms

3 Not_delivered

4 Sent_sms_fail

5 Seen

>= 6 UnDef

Mac = pageid + messageId + timeStamp + secretkey

http://openapi.zaloapp.com/page/query?act=stt&pageid={1}&mac={2}&msgid={3}&tim

estamp={4}

{ ← "error": int, (mapping with message status enum)

← "message": string (null if error >= 0),

}

111

11.3.2 getProfile

Order string:

URL:

Response JSON:

Mapping User gender:

11.4 Zalo Social Service

All of apis below have the same json response:

Mac = pageid + userId + timeStamp + secretkey

http://openapi.zaloapp.com/page/query?act=profile&pageid={1}&mac={2}&uid={3}&ti

mestamp={4}

{ ← "error": int,

← "result":

{ ← "userId": long,

← "displayName": string, ← "userGender": int,

← "avatar": string,

}

← "message": string (null if error >= 0)

}

{ ← "0": Undefined,

← "1": Male, ← "2": Female,

}

112

11.4.1 pushTextFeed

Order string:

URL:

11.4.2 pushImageFeed

Order string:

URL:

{

← "error": int,

← "id": string,

← "message": string (null if error >= 0)

}

Mac = pageid + message + timeStamp + secretkey

http://openapi.zaloapp.com/page/social?act=text&pageid={1}&mac={2}&message={3}&ti

mestamp={4}

Mac = pageid + message + image + timeStamp + secretkey

http://openapi.zaloapp.com/page/social?act=image&pageid={1}&mac={2}&message={3}

&image={4}&timestamp={5}

113

11.4.3 pushVoiceFeed

Order string:

URL:

11.4.4 pushStickerFeed

Order string:

URL:

11.4.5 pushLinkFeed

Order string:

URL:

Mac = pageid + message + voice + timeStamp + secretkey

http://openapi.zaloapp.com/page/social?act=voice&pageid={1}&mac={2}&message={3}

&voice={4}&timestamp={5}

Mac = pageid + message + stickerid + timeStamp + secretkey

http://openapi.zaloapp.com/page/social?act=sticker&pageid={1}&mac={2}&message={3

}&stickerid={4}&timestamp={5}

Mac = pageid + message + link + linktitle + linkdes + linkthumb + timeStamp +

secretkey

http://openapi.zaloapp.com/page/social?act=link&pageid={1}&mac={2}&message={3}&

link={4}&linktitle={5}&linkdes={6}&linkthumb={7}&timestamp={8}

114

11.5 Zalo Fan Service

All of apis below have the same json response:

11.5.1 removeFanPage

Order string:

URL:

Note: lstUids is a string which two user ID are split by char “;”.

11.5.2 removeFanPageByPhoneNum

Order string:

URL:

{

← "error": int,

← "result": JSONObject,

{

← userId 1 (phone1): long ← errorCode: integer

← userId 2 (phone2): long ← errorCode: integer

}

← "message": string (null if error >= 0)

}

Mac = pageid + lstUids + timeStamp + secretkey

http://openapi.zaloapp.com/page/fan?act=remove&pageid={1}&mac={2}&uids={3}&time

stamp={4}

Mac = pageid + lstPhoneNums + timeStamp + secretkey

http://openapi.zaloapp.com/page/fan?act=remove_phone&pageid={1}&mac={2}&uids={

3}&timestamp={4}

115

Note: lstPhoneNums is a string which two phone numbers are split by char “;”.

11.6 Zalo Chat Service

11.6.1 getConversationOnBehaft

URL:

Response JSON:

Example:

http://openapi.zaloapp.com/page/behalf?

act=chat&appid={1}&accessTok={2}&pageid={3}&uid={4}&from={5}&count={6}&ti

mestamp={7}

{ "display_name": Display Name (String), "userid":User ID (long), "avatar": URL avatar (String), "pageid": Page ID, "data":[ { "message": Message (String), "time": timestamp (long), "touid": Received User ID (long), "type": text/photo/voice/link (String), "fromuid":Sent User ID (long), "title":Link title [only link type](String), "description": Description [only photo/link type] (String), "thumb": Thumbnail [only photo/link type] (String), "url": URL [only photo/voice/link type] (String), }, { … } ], }

116

Request: http://openapi.zaloapp.com/page/behalf?act=chat&pageid=3519320819250886582&appid=4058571477379344972&uid=4790065253768535687&from=0&count=10&accessTok=-cP6l9OKnZhnOqh_hZt6rfDbOp2RAVHXmdnatPO5undCIdAed3JyKB5-VUsm6jGEha5mxDO2mXItOdpY-nRSRxbJOtt6Ph3KzJeWlC7pcMsDXXwmdRRtPBJb1SI2_U0Nkhyiji3Ax32-wM-arixD35vP9gD6iak_4VXB&timestamp=3312817812348 Response: { "display_name":"Trần Ngọc Huy", "userid":"4790065253768535687", "avatar":"http:\/\/avatar.talk.zdn.vn\/a\/d\/9\/f\/3\/75\/db16f16a1349f99f03415f5da4207454.jpg", "pageid":"3519320819250886582", "data":[ { "message":"BQT Zalo page đã từ chối yêu cầu thay đổi thông tin trang Merge Live 5 của bạn với lý do: Nội dung không phù hợp", "time":1447404592711, "touid":"4790065253768535687", "type":"text", "fromuid":"3519320819250886582" }, { "time":1448954293052, "touid":"3519320819250886582", "description":"", "type":"photo", "thumb":"http:\/\/t.f1.photo.talk.zdn.vn\/7237460991003844932\/d9d67c17ed6b05355c7a.jpg", "fromuid":"4790065253768535687", "url":"http:\/\/f1.photo.talk.zdn.vn\/7237460991003844932\/d9d67c17ed6b05355c7a.jpg" }, { "time":1448954317313, "touid":"3519320819250886582", "type":"voice", "fromuid":"4790065253768535687", "url":"http:\/\/f1.voice.talk.zdn.vn\/4264632681854921316\/34188c61e6710f2f5660.amr" }, { "time":1448954352642, "title":"http:\/\/news.zing.vn\/Putin-Tho-Nhi-Ky-ban-may-bay-Nga-vi-dau-cua-IS-post606023.html", "touid":"3519320819250886582", "description":"Khi thảo luận với các nhà lãnh đạo tại Paris, Tổng thống Nga khẳng định có bằng chứng rằng máy bay", "type":"link", "thumb":"http:\/\/link.photo.talk.zdn.vn\/photolink\/160\/http%3A%2F%2Fimg.v3.news.zdn.vn%2Fw660%2FUploaded%2Fzugtwi%2F2015_12_01%2FUntitled1.jpg", "fromuid":"4790065253768535687", "url":"http:\/\/news.zing.vn\/Putin-Tho-Nhi-Ky-ban-may-bay-Nga-vi-dau-cua-IS-post606023.html" }, { "message":"Tại sao ko", "time":1448954367504, "touid":"3519320819250886582", "type":"text", "fromuid":"4790065253768535687" } ] }

117

11.6.2 getConversationByPhoneNumOnBehaft

URL:

Response JSON:

Example:

http://openapi.zaloapp.com/page/behalf/phone?

act=chat&appid={1}&accessTok={2}&pageid={3}&phone={4}&from={5}&count={6}

&timestamp={7}

{ "display_name": Display Name (String), "userid":Phone Number (long), "avatar": URL avatar (String), "pageid": Page ID, "data":[ { "message": Message (String), "time": timestamp (long), "touid": Received User ID (long), "type": text/photo/voice/link (String), "fromuid":Sent User ID (long), "title":Link title [only link type](String), "description": Description [only photo/link type] (String), "thumb": Thumbnail [only photo/link type] (String), "url": URL [only photo/voice/link type] (String), }, { … } ], }

118

Request: http://openapi.zaloapp.com/page/behalf/phone?act=chat&pageid=3519320819250886582&appid=4058571477379344972&phone=841219686699&from=0&count=10&accessTok=-cP6l9OKnZhnOqh_hZt6rfDbOp2RAVHXmdnatPO5undCIdAed3JyKB5-VUsm6jGEha5mxDO2mXItOdpY-nRSRxbJOtt6Ph3KzJeWlC7pcMsDXXwmdRRtPBJb1SI2_U0Nkhyiji3Ax32-wM-arixD35vP9gD6iak_4VXB&timestamp=3312817812348 Response: { "display_name":"Trần Ngọc Huy", "userid":"841219686699", "avatar":"http:\/\/avatar.talk.zdn.vn\/a\/d\/9\/f\/3\/75\/db16f16a1349f99f03415f5da4207454.jpg", "pageid":"3519320819250886582", "data":[ { "message":"BQT Zalo page đã từ chối yêu cầu thay đổi thông tin trang Merge Live 5 của bạn với lý do: Nội dung không phù hợp", "time":1447404592711, "touid":"841219686699", "type":"text", "fromuid":"3519320819250886582" }, { "time":1448954293052, "touid":"3519320819250886582", "description":"", "type":"photo", "thumb":"http:\/\/t.f1.photo.talk.zdn.vn\/7237460991003844932\/d9d67c17ed6b05355c7a.jpg", "fromuid":"841219686699", "url":"http:\/\/f1.photo.talk.zdn.vn\/7237460991003844932\/d9d67c17ed6b05355c7a.jpg" }, { "time":1448954317313, "touid":"3519320819250886582", "type":"voice", "fromuid":"841219686699", "url":"http:\/\/f1.voice.talk.zdn.vn\/4264632681854921316\/34188c61e6710f2f5660.amr" }, { "time":1448954352642, "title":"http:\/\/news.zing.vn\/Putin-Tho-Nhi-Ky-ban-may-bay-Nga-vi-dau-cua-IS-post606023.html", "touid":"3519320819250886582", "description":"Khi thảo luận với các nhà lãnh đạo tại Paris, Tổng thống Nga khẳng định có bằng chứng rằng máy bay", "type":"link", "thumb":"http:\/\/link.photo.talk.zdn.vn\/photolink\/160\/http%3A%2F%2Fimg.v3.news.zdn.vn%2Fw660%2FUploaded%2Fzugtwi%2F2015_12_01%2FUntitled1.jpg", "fromuid":"841219686699", "url":"http:\/\/news.zing.vn\/Putin-Tho-Nhi-Ky-ban-may-bay-Nga-vi-dau-cua-IS-post606023.html" }, { "message":"Tại sao ko", "time":1448954367504, "touid":"3519320819250886582", "type":"text", "fromuid":"841219686699" } ] }

119

11.7 Zalo Page Info Service

11.7.1 getPageProfile

HTTP GET

Response JSON:

11.7.2 getUserProfile

HTTP GET

Response JSON:

URL: http://openapi.zaloapp.com/page/info

?act=getpage&appid={1}&accessTok={2}&pageid={3}&timestamp={4}

{ "error": Error Code (Integer) "result": ":{ "pageid": Page ID (Long), "name": Page Name (String), "description": Page Description(String), "avatar": Link avatar photo (String) }

}

URL: http://openapi.zaloapp.com/page/info

?act=getuser&appid={1}&accessTok={2}&pageid={3}&uid={4}&timestamp={5}

120

11.7.3 getListFans

HTTP GET

Response JSON:

{ "error": Error Code (Integer) "result": ":{ "userid": User ID (Long), "name": User Name (String), "description": Page Description(String), "gender": Gender (male|female|other) (String), "avatar": Link avatar photo (String) }

}

URL: http://openapi.zaloapp.com/page/info

?act=getfans&appid={1}&accessTok={2}&pageid={3}&from={4}&count={5}&timesta

mp={6}

{ "error": Error Code (Integer) "result": ":{ "pageid": Page ID (Long), "from": from index (Integer), "count": quantity (Integer), "fans":[{ "userid": User ID (Long), "name": User Name (String), "description": Page Description(String), "gender": Gender (male|female|other) (String), "avatar": Link avatar photo (String) },

{ ...

}] }

}

121

11.7.4 getListUidsRecentChat

URL:

Response JSON:

http://openapi.zaloapp.com/page/behalf?

act=recentchat&appid={1}&accessTok={2}&pageid={3}&from={4}&count={5}&timest

amp={6}

{ "error": Error Code (Integer), "result": { "pageid": Page ID, "from": from, "count": count, "data":[{ userid Long, lasttime Long,

}, { ... }

], }

}

122

12. Notify events

Zalo platform Open API supports a list of message events as following. In order to

receive these events, your page needs to register the events. Zalo platform Open API

supports 6 events below:

12.1 UserSendTextMessageEvent

This event is triggered when user sends a query message to a page.

Order string:

URI:

12.2 UserSendImageMessageEvent

This event is triggered when user sends a image message to a page.

Order string:

URI:

12.3 UserSendVoiceMessageEvent

This event is triggered when user sends a voice message to a page.

Order string:

Mac = pageid + fromuid + msgId + message + timeStamp + secretkey

?event=sendmsg&pageid={1}&mac={2}&fromuid={3}&msgid={4}&message={5}&timestamp={6}

Mac = pageid + fromuid + msgId + message + href + thumb + timeStamp +

secretkey

?event=sendimagemsg&pageid={1}&mac={2}&fromuid={3}&msgid={4}&message={5}&href={6}&thumb={7}&timestamp={8}

Mac = pageid + fromuid + msgId + message + href + timeStamp + secretkey

123

URI:

12.4 UserSendLocationMessageEvent

This event is triggered when user sends a voice message to a page.

Order string:

URI:

12.5 FollowPageEvent This event is trigger when user follows a page.

Order string:

URI:

12.6 UnFollowPageEvent This event is trigger when user un-follow a page.

Order string:

?event=sendvoicemsg&pageid={1}&mac={2}&fromuid={3}&msgid={4}&message={5}&href={6}& timestamp={7}

Mac = pageid + fromuid + msgId + message + params + timeStamp + secretkey

?event=sendlocationmsg&pageid={1}&mac={2}&fromuid={3}&msgid={4}&message={5}&params={6}& timestamp={7}

Mac = pageid + fromuid + timeStamp + secretkey

?event=follow&pageid={1}&mac={2}&fromuid={3}&timestamp={4}

Mac = pageid + fromuid + timeStamp + secretkey

124

URI:

12.7 SubcribePageEvent This event is trigger when user subscribes a page.

Order string:

URI:

12.8 UnSubcribePageEvent This event is trigger when user unsubscribes a page.

Order string:

URI:

?event=unfollow&pageid={1}&mac={2}&fromuid={3}&timestamp={4}

Mac = pageid + fromuid + timeStamp + secretkey

?event=subscribe&pageid={1}&mac={2}&fromuid={3}&timestamp={4}

Mac = pageid + fromuid + timeStamp + secretkey

?event=unsubscribe&pageid={1}&mac={2}&fromuid={3}&timestamp={4}

125

13. Message status event

The status a message is notified to third party app via its callback url.

There are four statuses: delivered, notdelivered, sendsms and failsms.

If your callback handler receive a notification successfully, your handler need to return

receivedCode=200 in the response header.

The notification will be retried three times if:

- The callback url is not reachable.

- The receivedCode in response header is not set or its value is other than 200

- Seen: is triggered when a message is seen by user (on mobile phone or web).

URI:

mac = pageid + status + msgid + timestamp + secretkey

- Delivered: is triggered when a message is successfully sent to the mobile of the user.

URI:

mac = pageid + status + msgid + timestamp + secretkey

- Notdelivered: is triggered when a message is not sent to the mobile of the user after a

configuration time.

URI:

mac = pageid + status + msgid + timestamp + secretkey

- SentSMS: is triggered when a SMS message is successfully sent to the mobile of the

user.

URI:

?event=msgstt&status=seen&msgid={1}&timestamp={2}&mac={3}

?event=msgstt&status=delivered&msgid={1}&timestamp={2}&mac={3}

?event=msgstt&status=notdelivered&msgid={1}&timestamp={2}&mac={3}

126

mac = pageid + status + msgid + timestamp + secretkey

- FailSMS: is triggered when a SMS message is failed to send to the mobile of the user.

URI:

mac = pageid + status + msgid + timestamp + secretkey

Workflow to process a message and notify message events:

?event=msgstt&status=sentsms&msgid={1}&timestamp={2}&mac={3}

?event=msgstt&status=failsms&msgid={1}&timestamp={2}&mac={3}

127

14. Appended

14.1 Mapping RESTful hander

SEND MESSAGE

Method Name

Hander

sendTextMessage

/page/message?act=text

sendTemplateTextMessage

/page/message?act=templatetext

sendImageMessage

/page/message?act=image

sendVoiceMessage

/page/message?act=voice

sendLinkMessage

/page/message?act=link

sendMultiLinksMessage

/page/message?act=links

sendContactMessage

/page/message?act=contact

sendStickerMessage

/page/message?act=sticker

replyTextMessage

/page/message?act=reply

replyImageMessage

/page/message?act=replyimage

replyVoiceMessage

/page/message?act=replyvoice

replyLinkMessage

/page/message?act=replylink

128

replyMultiLinksMessage

/page/message?act=replylinks

replyContactMessage

/page/message?act=replycontact

replyStickerMessage

/page/message?act=replysticker

SEND ON BEHALF MESSAGE

Method Name

Hander

sendOnBehalfTextMessage

/page/behalf?act= templatetext

sendOnBehalfImageMessage

/page/behalf?act=image

sendOnBehalfVoiceMessage

/page/behalf?act=voice

sendOnBehalfLinkMessage

/page/behalf?act=link

sendOnBehalfMultiLinksMessage

/page/behalf?act=links

sendOnBehalfContactMessage

/page/behalf?act=contact

sendOnBehalfStickerMessage

/page/behalf?act=sticker

getPageInfoOnBehaft

/page/behaft?act=profile

sendOnBehalfTextMessageByPhoneNum

/page/behalf/phone?act= templatetext

sendOnBehalfImageMessageByPhoneNum

/page/behalf/phone?act=image

sendOnBehalfVoiceMessageByPhoneNum

/page/behalf/phone?act=voice

sendOnBehalfLinkMessageByPhoneNum

/page/behalf/phone?act=link

129

sendOnBehalfMultiLinksMessageByPhoneNum

/page/behalf/phone?act=links

sendOnBehalfContactMessageByPhoneNum

/page/behalf/phone?act=contact

sendOnBehalfStickerMessageByPhoneNum

/page/behalf/phone?act=sticker

BROADCAST MESSAGE

Method Name

Hander

broadcastTextMessage

/page/broadcast?act=text

broadcastImageMessage

/page/broadcast?act=image

broadcastVoiceMessage

/page/broadcast?act=voice

broadcastLinkMessage

/page/broadcast?act=link

broadcastMultiLinksMessage

/page/broadcast?act=links

broadcastContactMessage

/page/broadcast?act=contact

broadcastStickerMessage

/page/broadcast?act=sticker

SEND MESSAGE BY PHONE NUMBER

Method Name

Hander

sendTextMessageByPhoneNum

/page/message/phone?act=text

sendTemplateTextMessageByPhoneNum

/page/message/phone?act=templatetext

sendImageMessageByPhoneNum

/page/message/phone?act=image

130

sendVoiceMessageByPhoneNum

/page/message/phone?act=voice

sendLinkMessageByPhoneNum

/page/message/phone?act=link

sendMultiLinksMessageByPhoneNum

/page/message/phone?act=links

sendContactMessageByPhoneNum

/page/message/phone?act=contact

sendStickerMessageByPhoneNum

/page/message/phone?act=sticker

replyTextMessageByPhoneNum

/page/message/phone?act=reply

replyImageMessageByPhoneNum

/page/message/phone?act=replyimage

replyVoiceMessageByPhoneNum

/page/message/phone?act=replyvoice

replyLinkMessageByPhoneNum

/page/message/phone?act=replylink

replyMultiLinksMessageByPhoneNum

/page/message/phone?act=replylinks

replyContactMessageByPhoneNum

/page/message/phone?act=replycontact

replyStickerMessageByPhoneNum

/page/message/phone?act=replysticker

PUSH FEED

Method Name

Hander

pushTextFeed

/page/social?act=text

pushImageFeed

/page/social?act=image

pushVoiceFeed

/page/social?act=voice

131

pushLinkFeed

/page/social?act=link

pushContactFeed

/page/social?act=contact

pushStickerFeed

/page/social?act=sticker

QUERY

Method Name

Hander

getMessageStatus

/page/query?act=stt

getProfile

/page/query?act=profile

UPLOAD

Method Name

Hander

uploadPhoto

/page/upload?act=image

uploadVoice

/page/upload?act=voice

FAN

Method Name

Hander

removeFanPage

/page/fan?act=remove

removeFanByPhoneNum

/page/fan?act=remove_phone

CHAT

Method Name

Hander

132

getConversation

/page/behaft?act=chat

getConversationPhoneNum

/page/behaft/phone?act=chat

getListUidsRecentChat

/page/behaft?act=recentchat

PAGE INFO

Method Name

Hander

getPageProfile

/page/info?act=getpage

getUserProfile

/page/info?act=getuser

getListFans

/page/info?act=getfans

14.2 Mapping event handler

Event Name

Hander

userSendMessage

callback?event=sendmsg

followPage

callback?event=follow

unfollowPage

callback?event=unfollow

subcribePage

callback?event=subcribe

unsubcribePage

callback?event=unsubscribe

changeMessageStatus

callback?event=msgstt

133