sample/src/main/java/com/larksuite/oapi/sample/api/ApiSample.java
private static void sendIsvMessage() throws Exception {
        Config config = Config.getTestISVConf("staging");
        config.getStore().put(Keys.appTicketKey(config.getAppSettings().getAppID()), "[app ticket from event]", 12, TimeUnit.HOURS);
        Map<String, Object> message = new HashMap<>();
        message.put("user_id", "[user id]");
        message.put("msg_type", "text");
        Map<String, Object> content = new HashMap<>();
        content.put("text", "java test isv");
        message.put("content", content);
        Request<Map<String, Object>, Map<String, Object>> request = Request.newRequest("/open-apis/message/v4/send",
                "POST", AccessTokenType.Tenant, message, new HashMap<>(), Request.setTenantKey("[tenant key]"));
        Response<Map<String, Object>> response = Api.send(config, request);
        System.out.println(response.getRequestID());
        System.out.println(response.getHTTPStatusCode());
        System.out.println(Jsons.DEFAULT_GSON.toJson(response));
    }
/**
     * send text message (isv app)
     */
send text message (isv app)
send text message ( isv app )
private static void sendIsvMessage() throws Exception {
        Config config = Config.getTestISVConf("staging");
        config.getStore().put(Keys.appTicketKey(config.getAppSettings().getAppID()), "[app ticket from event]", 12, TimeUnit.HOURS);
        Map<String, Object> message = new HashMap<>();
        message.put("user_id", "[user id]");
        message.put("msg_type", "text");
        Map<String, Object> content = new HashMap<>();
        content.put("text", "java test isv");
        message.put("content", content);
        Request<Map<String, Object>, Map<String, Object>> request = Request.newRequest("/open-apis/message/v4/send",
                "POST", AccessTokenType.Tenant, message, new HashMap<>(), Request.setTenantKey("[tenant key]"));
        Response<Map<String, Object>> response = Api.send(config, request);
        System.out.println(response.getRequestID());
        System.out.println(response.getHTTPStatusCode());
        System.out.println(Jsons.DEFAULT_GSON.toJson(response));
    }
private static void sendIsvMessage ( ) throws Exception { Config config = Config . getTestISVConf ( "staging" ) ; config . getStore ( ) . put ( Keys . appTicketKey ( config . getAppSettings ( ) . getAppID ( ) ) , "[app ticket from event]" , 12 , TimeUnit . HOURS ) ; Map < String , Object > message = new HashMap < > ( ) ; message . put ( "user_id" , "[user id]" ) ; message . put ( "msg_type" , "text" ) ; Map < String , Object > content = new HashMap < > ( ) ; content . put ( "text" , "java test isv" ) ; message . put ( "content" , content ) ; Request < Map < String , Object > , Map < String , Object > > request = Request . newRequest ( "/open-apis/message/v4/send" , "POST" , AccessTokenType . Tenant , message , new HashMap < > ( ) , Request . setTenantKey ( "[tenant key]" ) ) ; Response < Map < String , Object > > response = Api . send ( config , request ) ; System . out . println ( response . getRequestID ( ) ) ; System . out . println ( response . getHTTPStatusCode ( ) ) ; System . out . println ( Jsons . DEFAULT_GSON . toJson ( response ) ) ; }
send text message (isv app)
send text message ( isv app )