Class MetaService

java.lang.Object
com.bytedesk.social.meta.MetaService

@Service public class MetaService extends Object
  • Field Details

    • restTemplate

      private final org.springframework.web.client.RestTemplate restTemplate
    • objectMapper

      private final com.fasterxml.jackson.databind.ObjectMapper objectMapper
    • apiVersion

      @Value("${meta.graph.api.version:v23.0}") private String apiVersion
    • GRAPH_API_BASE_URL

      private static final String GRAPH_API_BASE_URL
      See Also:
  • Constructor Details

    • MetaService

      public MetaService()
  • Method Details

    • getUserProfile

      public Map<String,Object> getUserProfile(String userId, String pageAccessToken)
      获取用户信息
    • sendMessage

      public boolean sendMessage(String platform, String recipientId, String messageText, String pageAccessToken)
      发送消息到Meta平台
    • setMessengerProfile

      public boolean setMessengerProfile(String webhookUrl, String pageAccessToken)
      设置Messenger Profile
    • verifySignature

      public boolean verifySignature(String signature, String payload, String appSecret)
      验证webhook签名
    • hmacSha1

      private String hmacSha1(String data, String key) throws Exception
      Throws:
      Exception
    • bytesToHex

      private String bytesToHex(byte[] bytes)