Slack Post (String type Data Item)

Post the contents of a String type data item to the specified Slack channel.

    A. Set SLACK CHANNEL to post (e.g. "#random")Single-line inputRequired
    B. Set OAuth2 Config Name (at [OAuth 2.0 Setting])Single-line inputRequired
    C. Select TEXT DATA for Post MessageData selectStringRequired
    -variable namevariable label
    Aconf_ChannelSet SLACK CHANNEL to post (e.g. "#random")
    Bconf_OAuth2Set OAuth2 Config Name (at [OAuth 2.0 Setting])
    Cconf_MessageSelect TEXT DATA for Post Message
    //// == 注意 / Note ==
    // Authorization Code Request URL: https://slack.com/oauth/authorize
    // Access Token Request URL: https://slack.com/api/oauth.access
    // Scope: chat:write:bot
    // Client ID: ( from https://api.slack.com/apps )
    // Consumer Secret: ( from https://api.slack.com/apps )
    
    //// == 自動工程コンフィグの参照 / Config Retrieving ==
    var dataDefNumC = configs.get("conf_Message"); // SELECT returns Number
    var slackChannel = configs.get("conf_Channel"); // TEXTFIELD returns String
    var myOAuthConfig = configs.get("conf_OAuth2"); // TEXTFIELD returns String
    
    //// == ワークフローデータの参照 / Data Retrieving ==
    var textForPost = data.get( dataDefNumC ) + "\n";
    
    //// == 演算 / Calculating ==
    var token = httpClient.getOAuth2Token( myOAuthConfig );
    httpClient.begin()
      .formParam( "token", token )
      .formParam( "channel", slackChannel )
      .formParam( "text", textForPost )
      .post( "https://slack.com/api/chat.postMessage" );
    

    • C’: Strings stored in the Data Item selected at config C

    • Text of C’ will be automatically posted to the Channel that is specified at the config A