0

I'm trying to post a message to Slack using their API and the response says: Waiting for activation

This is my code:

static async Task<HttpResponseMessage> PostMessage()
{ 
    client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", "xoxb-924542226483-938230541718-gk3vTmwEtOOK01NqO5kW6e0R");
    var atttrJson = new stackAttributes { channel = "#cymulateinterview", text = "Good Morning all" };
    var json = new JavaScriptSerializer().Serialize(atttrJson);
    var buffer = System.Text.Encoding.UTF8.GetBytes(json);
    var byteContent = new ByteArrayContent(buffer);
    byteContent.Headers.ContentType = new MediaTypeHeaderValue("application/json");
    var result = await client.PostAsync("https://slack.com/api/chat.postMessage", byteContent);
    return result;
}

What am I missing

ProgrammingLlama
  • 36,677
  • 7
  • 67
  • 86
JumpIntoTheWater
  • 1,306
  • 2
  • 19
  • 46
  • I haven't worked with Slack's API much, but: at a guess, your app hasn't been activated (maybe approved)? – ProgrammingLlama Feb 05 '20 at 06:56
  • nope.haven't worked with Slack at all until yesterday. it seems like I can post messages when using UI. I must be missing something. – JumpIntoTheWater Feb 05 '20 at 07:10
  • I doubt your problem is Slack related. Maybe it is similar to this: https://stackoverflow.com/questions/34551008/task-keeps-waiting-for-activation – Erik Kalkoken Feb 05 '20 at 11:14

0 Answers0