Skip to content

Getting token to use Monolog with Slack #743

@nisbeti

Description

@nisbeti

It is not straight forward to get a token to use monolog with Slack. The expectation is that you write an OAuth client to get the token, but it is possible to get it manually. These are the steps I followed today:

You should already have an account and a channel set up that you want to send error messages to.

  1. Create a new Slack App - https://api.slack.com/applications/new which will give you a client_id and a client_secret which you need for step two. You will need to enter a redirect URI, which can be any page for this purpose.
  2. Got to https://slack.com/oauth/authorize?client_id=[client_id]&scope=chat:write:bot
  3. Authorise App on the page that is returned.
  4. From the URI copy the code that is returned.
  5. Go to https://slack.com/api/oauth.access?client_id=[client_id]&client_secret=[client_secret]&code=[code]
  6. Your token is in the JSON that is displayed.

TO debug errors insert echo fread($this->resource, 1000); at the end of the writeToSocket method of Monolog/Handler/SocketHandler (see #514)

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions