Customer Service Messages

Using Customer Service Messages on the Page

The developer needs to set the open-type value of the button component to contact. After tapping the button, the user will enter a customer service session. When tapping the Mini Program message in the session, the user will return to the Mini Program. The developer can get the path of the page on which the user taps the message and the corresponding parameter query via the bindcontact event callback.

Code sample

<button open-type="contact" bindcontact="handleContact"></button>
Page({
    handleContact (e) {
        console.log(e.path)
        console.log(e.query)
    }
})

Response parameters

Parameter Type Description
path String The path used to store Mini Program messages
query Object The query parameter specified for the Mini Program message

Integrating Messaging Service in Server

When a user sends messages to the Mini Program customer service or enter a session, messages and events are pushed from the Weixin server to the URL the developer entered in the server configurations (a cloud function is configured if Cloud Base is used), and the developer can respond according to the business logic. For information on how to integrate and use messaging service, refer to Message Push.