API-Reference

class libslack.slackapi.SlackApi(authentication_token, request=None)[source]

A SlackApi object can be used to interact with the slack api.

For futher details see methods.

call(api_call, parameters=None)[source]

Executes a call on the remote slack api and returns an appropriate SlackApiResponse object.

Parameters:
  • api_call (string) – which identifies the web api endpoint which shall be called.
  • parameters (dict) –

    which will be supplied to the web api endpoint.

    e.g.: {'channel': 'C1234567890', 'text': 'this message will be sent'}

    Attention

    The authentication-token allways will be passed to the endpoint implicitly.

Returns:

an ApiResponse object containing the data provided by the slackapi endpoint.

Raise:

Exception if an unknown api method is called.

class libslack.slackapi.SlackApiRequest(api_call, authentication_token)[source]

The SlackApiRequest class handles and encapsulates a slack request.

execute(request_parameters=None)[source]

Executes an ApiRequest, request an api call.

Parameters:
  • request_parameters (dict) –

    which will be supplied to the web api endpoint.

    e.g.: {'channel': 'C1234567890', 'text': 'this message will be sent'}

    Attention

    The authentication-token allways will be passed to the endpoint implicitly.

  • authentication_token – which grants access to the api.
Returns:

an SlackApiResponse object based on the response of the slackapi endpoint.

Raise:

Exception if an error occurs while executing the api call.

class libslack.slackapi.SlackApiResponse(response_data)[source]

The SlackApiResponse class handles and encapsulates an response provided by the slackapi after an api method was called at the endpoint.

get_error_message()[source]

If is_error returns True, this method returns a more detail error message.

Returns:a string which provides a more detail error message.
is_error()[source]

Indicates whether or not the response indicates that an error occured while trying to execute the associated api call.

Returns:True if an error has occurred, otherwise False.