HubSpot / slack-client

An asynchronous HTTP client for Slack's web API
Apache License 2.0
114 stars 53 forks source link

How to set the charset? #213

Open tarzasai opened 3 years ago

tarzasai commented 3 years ago

Sorry for the stupid question, I'm new to Slack development. I receive a missing_charset warning in response all the times on SlackClient.postMessage(), and I checked the samples and look everywhere in the code but I don't understand how to set the charset.

My SlackClient instance:

  @Bean
  public SlackClient getSlackClient() {
    SlackClientRuntimeConfig runtimeConfig = SlackClientRuntimeConfig.builder()
      .setTokenSupplier(() -> slackAppToken)
      .build();
    return SlackClientFactory.defaultFactory().build(runtimeConfig);
  }

My postmessage code:

  public static void simplePostMessage(SlackClient slackClient, String channel, String text) {
    try {
      slackClient.postMessage(
        ChatPostMessageParams.builder()
          .setText(text)
          .setChannelId(channel)
          .build())
        .join().unwrapOrElseThrow();
    } catch (Exception e) {
      log.error("slackClient.postMessage", e);
    }
  }

Thank you.