Instant Messaging
Server
Getting Started
Limits
Platform Service
Webhooks
Overview
Message-related Callback
Related Callbacks of User Information
Related Callbacks of Advanced Team
Related Callbacks of Super Team
Related Callbacks of Audio and Video
Callback related to Log in
Data Sync
Data Sync Overview
Activate Data Sync
IM Session Message Delivery
Other IM Message Delivery
Audio/video/whiteboard Duration Message Delivery
Content Moderation
Overview
Best Practice
API Reference
Overview
Status Code
Account Management
Register Accounts
Refresh Token
Ban Accounts
Mute Accounts
Push Notification
Login Authentication
Messaging
Send Messages
Unsend Messages
Send Broadcast Messages
Upload Files
Delete a message
Delete a roaming message
Message history
History
Custom system notification
User Profile
User Relationship
Host User Relationship
Group
Advanced group
Supergroup
Chat room
Create a chat room
Get the URL of a chat room
Update chat room info
Edit chat room states
Set a timer to close a chat room
Manage roles
Get the member list
Manage chatbots
Manage tags
Message queues
Online Status

Interface Overview

Update time: 2021/08/18 14:50:56

API call description

In this document, all requests of calling the NetEase YunXin server interface should be verified by this rule.

API checksum verification

The following parameters should be placed in the Http Request Header

Parameter Parameter Description
AppKey Appkey assigned by the developer platform
Nonce Random number (maximum length 128 characters)
CurTime Current UTC timestamp, in seconds, since 0:0:0 a.m. on January 1, 1970 (String)
CheckSum SHA1(AppSecret + Nonce + CurTime), string concatenated by three parameters, SHA1 hash calculation, converted to hexadecimal characters (String, lowercase)

CheckSum validity: for security reasons, the validity of each checkSum is 5 minutes (calculated by CurTime), and we recommend to generate a new checkSum for each request. Please make sure that the server initiating the request is synchronized with the standard time, such as NTP service.

CheckSum will return a 414 error code if the verification fails. See details for the code status table.

Important tip: All interfaces provided in this document are developer server calls, and AppSecret used to calculate CheckSum should be kept by the developer, stored and used on the application server, but should not be stored or transferred to the client, nor should it be embedded in front-end code such as webpages.

An example of java code for calculating CheckSum is as follows ( see interface example below for examples in other languages).

import java.security.MessageDigest;

public class CheckSumBuilder {
    // Calculate and get CheckSum
    public static String getCheckSum(String appSecret, String nonce, String curTime) {
        return encode("sha1", appSecret + nonce + curTime);
    }
    
    // Calculate and get md5 value
    public static String getMD5(String requestBody) {
        return encode("md5", requestBody);
    }

    private static String encode(String algorithm, String value) {
        if (value == null) {
            return null;
        }
        try {
            MessageDigest messageDigest
                    = MessageDigest.getInstance(algorithm);
            messageDigest.update(value.getBytes());
            return getFormattedText(messageDigest.digest());
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
    private static String getFormattedText(byte[] bytes) {
        int len = bytes.length;
        StringBuilder buf = new StringBuilder(len * 2);
        for (int j = 0; j < len; j++) {
            buf.append(HEX_DIGITS[(bytes[j] >> 4) & 0x0f]);
            buf.append(HEX_DIGITS[bytes[j] & 0x0f]);
        }
        return buf.toString();
    }
    private static final char[] HEX_DIGITS = { '0', '1', '2', '3', '4', '5',
            '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
}

Interface description

  1. All interfaces of the IM server only support POST requests.
  2. All interfaces request Content-Type: application/x-www-form-urlencoded;charset=utf-8.
  3. All interfaces are returned by JSON, while UTF-8 encoding is performed.

Interface example

The NetEase YunXin server interface is a simple http interface, and supports various languages. We also provide some simple examples to the development for reference. Interface example of NetEase YunXin Server

Was this topic helpful?
Yes
No
  • API call description
  • API checksum verification
  • Interface description
  • Interface example