Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SlackTaskClient is not allowing to Post with a valid OAuth Token (returns response "invalid_arguments") #217

Closed
DarienTGS opened this issue Jan 30, 2020 · 4 comments

Comments

@DarienTGS
Copy link

This is my working code in C# that passes in a slackToken that I have defined in my environment variables. It is used to connect to the SlackTaskClient just like shown here (https://github.com/Inumedia/SlackAPI/wiki/Examples) and it is returning the response invalid_arguments in the response message. Perplexed as to why this is happening with a newly created OAuth token and the app has been added to the channel.

  private static async Task<PostMessageResponse> PostToSlack(string slackToken)
    {
        var slackClient = new SlackTaskClient(slackToken);
        var response = await slackClient.PostMessageAsync("#general", "test");
        return response;
    }
@Inumedia
Copy link
Owner

Hi, please try version 1.1.4 when it becomes available.

@DarienTGS
Copy link
Author

Thank you I will.

We diagnosed the the problem you are sending as_user = false as part of the payload without using a guard statement so it always send and that is a deprecated argument.

Add a guard statement in your TaskClient for that check and it should be good to go again.

As for now we just created a basic HTTP client and are sending it manually using JSON but the SDK would be nice to use.

@Inumedia
Copy link
Owner

This should be fixed in 1.1.4, it should no longer send the as_user = false if it isn't supplied

@DarienTGS
Copy link
Author

This has been fixed in 1.1.4. Using the API documentation posting to a slack channel with an app now works with a valid OAuth token.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants