package slacko

  1. Overview
  2. Docs

Module SlackoSource

An OCaml binding to the REST API of Slack. Each function triggers an HTTP request, so it returns immediately and returns an Lwt.t value.

To use the API you first need to either apply for a token from Slack, or get one via the OAuth2 API. This string can then be converted into a session by means of start_session. With this session most other methods from the binding can be called. The result of each API call is a variant type containing either the JSON result or an error type describing what kind of error occured.

  • author Marek Kubica

Types used in the binding

The binding exposes a number of errors that can happen. As not every function returns every possible API error, the possible errors are grouped into more convenient sets of errors that can be composed together to get the exact error types.

Sourcetype api_error = [
  1. | `Unhandled_error of string
  2. | `Unknown_error
]
Sourcetype parsed_api_error = [
  1. | `ParseFailure of string
  2. | api_error
]
Sourcetype auth_error = [
  1. | `Not_authed
  2. | `Invalid_auth
  3. | `Account_inactive
]

API calls that require authentication (a session) might fail with one of these errors, so functions that take session arguments will return at least these error variants.

Sourcetype timestamp_error = [
  1. | `Invalid_ts_latest
  2. | `Invalid_ts_oldest
]

API calls that take timestamp arguments can signal errors when the timestamp is invalid. The binding does its best to make sure that invalid timestamps are avoided.

Sourcetype channel_error = [
  1. | `Channel_not_found
]

API calls that require channel inputs can signal this error if the channel does not exist.

Sourcetype user_error = [
  1. | `User_not_found
]

API calls that require user inputs signal this error if the user was not found.

Sourcetype invite_error = [
  1. | `Cant_invite_self
  2. | `Cant_invite
]

Inviting might fail because invitation is impossible for some reason or because attempting to invite oneself.

Sourcetype not_in_channel_error = [
  1. | `Not_in_channel
]

Some API calls require the user to be in channel for the action to succeed, not meeting this requirement can raise this error.

Sourcetype already_in_channel_error = [
  1. | `Already_in_channel
]

Some API calls require the user not to be in channel for the action to suceed. The opposite of not_in_channel_error.

Sourcetype archive_error = [
  1. | `Is_archived
]

Channels might be archived, so modification attempts will fail with this error.

Sourcetype name_error = [
  1. | `Name_taken
]

When creating channels, names have to be unique, an attempt to create a duplicate one will result in this error.

Sourcetype kick_error = [
  1. | `Cant_kick_self
]

Kick (in general) might fail, because kicking oneself is not supported.

Sourcetype channel_kick_error = [
  1. | kick_error
  2. | `Cant_kick_from_general
  3. | `Cant_kick_from_last_channel
]

Kicking users from channels might fail, because channels have additional restrictions on kicking: users can't be kicked from the #general channel and they cannot be kicked from the last channel they are in.

Sourcetype restriction_error = [
  1. | `Restricted_action
]

If an action was attempted that the user does not have permission to, this error is returned.

Sourcetype leave_general_error = [
  1. | `Cant_leave_general
]

Leaving the #general channel is not supported by Slack, an attempt do do so will trigger this error.

Sourcetype message_error = [
  1. | `Cant_delete_message
  2. | `Message_not_found
]

The message might not exist or be impossible to delete for other reasons.

Sourcetype message_length_error = [
  1. | `Msg_too_long
]

message types, like topic types might be too long to post. The Slack API does not specify the maximum message length, so Slacko can't make sure your messages stay below this limit, so everytime you post, this error can realistically happen.

Sourcetype attachments_error = [
  1. | `Too_many_attachments
]

When posting a message with attachments, you may receive this error if you post too many. The Slack API documentation states that attempting to post a message with more than 100 attachments will fail with this error, but also that no message should ever have more than 20 attachments. Slacko doesn't check the number of attachments sent.

Sourcetype rate_error = [
  1. | `Rate_limited
]

Doing too many API requests in a certain timespan might cause a rate limitation to be applied by Slack. This is the error that results in that case.

Sourcetype message_update_error = [
  1. | `Message_not_found
  2. | `Cant_update_message
  3. | `Edit_window_closed
]

Updating a message might fail because the message was not found, couldn't be updated for some reason or because the time in which a message can be edited has passed.

Sourcetype file_error = [
  1. | `File_not_found
  2. | `File_deleted
]

Handling files can result in multiple problems: the file wasn't found in the first place or it might have been deleted in the maintime.

Sourcetype unknown_type_error = [
  1. | `Unknown_type
]

This error shouldn't ever be returned but serves as a catch-all in case the Slack API returns a new, unknown error type that Slacko doesn't yet understand.

Sourcetype already_archived_error = [
  1. | `Already_archived
]

When trying to archive something that was already archived before, this error is returned.

Sourcetype not_in_group_error = [
  1. | `Not_in_group
]

Doing an action in a group when not being part of the group can fail.

Sourcetype leave_last_channel_error = [
  1. | `Cant_leave_last_channel
]
Sourcetype last_member_error = [
  1. | `Last_member
]

An error when the user is the last member and can't do what he planned to do because that would cause the channel not to have members anymore.

Sourcetype oauth_error = [
  1. | `Invalid_client_id
  2. | `Bad_client_secret
  3. | `Invalid_code
  4. | `Bad_redirect_uri
  5. | `Unknown_error
]

These errors might be returned when the exchange of oauth authorization for a token has failed.

Sourcetype presence_error = [
  1. | `Invalid_presence
]

Setting an invalid presence information is not supported.

Sourcetype user_visibility_error = [
  1. | `User_not_visible
]

User is not visible, so action cannot be performed on them.

Sourcetype invalid_name_error = [
  1. | `Invalid_name
]
Sourcetype bot_error = [
  1. | `User_is_bot
]
Sourcetype parsed_auth_error = [
  1. | parsed_api_error
  2. | auth_error
]

API calls which require authentication will always return (at least) these error types.

Sourcetype topic_result = [
  1. | `Success of string
  2. | parsed_auth_error
  3. | channel_error
  4. | archive_error
  5. | not_in_channel_error
  6. | `User_is_restricted
]

Setting topics or purposes will result either in a success or one of these errors. Convenience type composed of subtypes.

Sourcetype timestamp = Ptime.t

Slack uses 6 decimal digit fixed point seconds since Epoch to represent message timestamps, which are also used to identify messages within a channel. Ptime provides an exact representation, allowing precise history queries and message identification.

Sourcetype session

Sessions are required in the API for all actions that interact with

token is an alias for session for backwards compatibility reasons.

Sourcetype token = session

token is an alias for session for backwards compatibility reasons.

Sourcetype topic

The topic type represents a topic or a purpose message. Both are limited deliberately to have at most 250 UTF-8 encoded codepoints.

Sourcetype message

The message represents a message to be posted.

Sourcetype channel

A channel type, can be either a channel name (starting with a #) or a channel id.

Sourcetype conversation

A type of an IM conversation

Sourcetype user

An user, represented by either a user name or a user id.

Sourcetype bot

A bot user, represented by a bot id

Sourcetype group

A group, a private subset of users chatting together.

Sourcetype chat =
  1. | Channel of channel
  2. | Im of conversation
  3. | User of user
  4. | Group of group

A place one can post messages to.

Sourcetype sort_criterion =
  1. | Score
  2. | Timestamp

What criterion to use in search.

Sourcetype sort_direction =
  1. | Ascending
  2. | Descending

Search result can be ordered in ascending or descending order.

Sourcetype presence =
  1. | Auto
  2. | Away

Presence can either be active or away.

Sourcetype topic_obj = {
  1. value : string;
  2. creator : user;
  3. last_set : timestamp;
}

A topic or purpose object.

Sourcetype user_obj = {
  1. id : user;
  2. name : string;
  3. deleted : bool;
  4. color : string option;
  5. real_name : string option;
  6. tz : string option;
  7. tz_label : string option;
  8. tz_offset : int;
  9. profile : Yojson.Safe.json;
  10. is_admin : bool;
  11. is_owner : bool;
  12. is_primary_owner : bool;
  13. is_restricted : bool;
  14. is_ultra_restricted : bool;
  15. is_bot : bool;
  16. has_files : bool;
}

Object representing lots of information about a Slack user.

Sourcetype group_obj = {
  1. id : group;
  2. name : string;
  3. is_group : bool;
  4. created : timestamp;
  5. creator : user;
  6. is_archived : bool;
  7. members : user list;
  8. topic : topic_obj;
  9. purpose : topic_obj;
  10. is_open : bool option;
  11. last_read : timestamp option;
  12. unread_count : int option;
  13. unread_count_display : int option;
  14. latest : Yojson.Safe.json option;
}

Object representing information about a Slack group.

Sourcetype channel_obj = {
  1. id : channel;
  2. name : string;
  3. is_channel : bool;
  4. created : timestamp;
  5. creator : user;
  6. is_archived : bool;
  7. is_general : bool;
  8. is_member : bool;
  9. members : user list;
  10. topic : topic_obj;
  11. purpose : topic_obj;
  12. last_read : timestamp option;
  13. latest : Yojson.Safe.json option;
  14. unread_count : int option;
  15. unread_count_display : int option;
  16. num_members : int option;
}

Object representing information about a Slack channel.

Sourcetype field_obj = {
  1. title : string option;
  2. value : string;
  3. short : bool;
}

Object representing a message attachment field.

Sourcetype attachment_obj = {
  1. fallback : string option;
  2. color : string option;
  3. pretext : string option;
  4. author_name : string option;
  5. author_icon : string option;
  6. title : string option;
  7. text : string option;
  8. fields : field_obj list option;
  9. image_url : string option;
  10. thumb_url : string option;
  11. footer : string option;
  12. footer_icon : string option;
  13. ts : timestamp option;
  14. mrkdwn_in : string list option;
}

Object representing a message attachment.

Sourcetype message_obj = {
  1. type' : string;
  2. ts : timestamp;
  3. user : user option;
  4. bot_id : bot option;
  5. text : string option;
  6. is_starred : bool option;
}

Object representing a message. Can be of a number of types.

Sourcetype history_obj = {
  1. latest : timestamp option;
  2. messages : message_obj list;
  3. has_more : bool;
}
Sourcetype authed_obj = {
  1. url : string;
  2. team : string;
  3. user : string;
  4. team_id : string;
  5. user_id : user;
}

Authentication information from the current user.

Sourcetype channel_leave_obj = {
  1. not_in_channel : bool option;
}

Response to a channel leave request.

Sourcetype channel_rename_obj = {
  1. id : channel;
  2. is_channel : bool;
  3. name : string;
  4. created : timestamp;
}

Response to renaming of a channel.

Sourcetype chat_obj = {
  1. ts : timestamp;
  2. chat : chat;
  3. text : string option;
}
Sourcetype emoji = string * string

A single emoji.

Sourcetype chat_close_obj = {
  1. no_op : bool option;
  2. already_closed : bool option;
}
Sourcetype groups_invite_obj = {
  1. already_in_group : bool option;
  2. group : group_obj;
}

Response to a channel invite.

Sourcetype groups_open_obj = {
  1. no_op : bool option;
  2. already_open : bool option;
}

Response to opening a group.

Sourcetype groups_rename_obj = {
  1. id : channel;
  2. is_group : bool;
  3. name : string;
  4. created : timestamp;
}

Response to rename of a group

Sourcetype im_obj = {
  1. id : string;
  2. is_im : bool;
  3. user : user;
  4. created : timestamp;
  5. is_user_deleted : bool;
  6. unread_count : int option;
  7. unread_count_display : int option;
}

Information about a direct conversation with a person.

Sourcetype im_channel_obj = {
  1. id : string;
}
Sourcetype im_open_obj = {
  1. no_op : bool option;
  2. already_open : bool option;
  3. channel : im_channel_obj;
}

Information about an direct conversation channel.

Sourcetype oauth_obj = {
  1. access_token : string;
  2. scope : string;
}

When requesting an OAuth token, you get a token and the scope for which this token is valid.

Sourcetype comment_obj = {
  1. id : string;
  2. timestamp : timestamp;
  3. user : user;
  4. comment : string;
}

Represents a comment on an item.

Sourcetype paging_obj = {
  1. count : int;
  2. total : int;
  3. page : int;
  4. pages : int;
}

Paging information for requests that might have multi page results.

Sourcetype file_obj = {
  1. id : string;
  2. created : timestamp;
  3. timestamp : timestamp;
  4. name : string option;
  5. title : string;
  6. mimetype : string;
  7. pretty_type : string;
  8. user : user;
  9. mode : string;
  10. editable : bool;
  11. is_external : bool;
  12. external_type : string;
  13. size : int;
  14. url_private : string;
  15. url_private_download : string;
  16. thumb_64 : string option;
  17. thunb_80 : string option;
  18. thumb_360 : string option;
  19. thumb_360_gif : string option;
  20. thumb_360_w : int option;
  21. thumb_360_h : int option;
  22. preview : string option;
  23. preview_highlight : string option;
  24. lines : int option;
  25. lines_more : int option;
  26. is_public : bool;
  27. channels : channel list;
  28. groups : group list;
  29. ims : conversation list;
  30. initial_comment : Yojson.Safe.json option;
  31. num_stars : int option;
}

Information about a file.

Sourcetype files_info_obj = {
  1. file : file_obj;
  2. comments : comment_obj list;
  3. paging : paging_obj;
}

Metainformation about a file.

Sourcetype files_list_obj = {
  1. files : file_obj list;
  2. paging : paging_obj;
}

A list of files.

Sourcetype stars_list_obj = {
  1. items : Yojson.Safe.json list;
  2. paging : paging_obj;
}

Information about starred items.

Sourcetype message_search_obj = {
  1. total : int;
  2. paging : paging_obj;
  3. matches : message_obj list;
}
Sourcetype file_search_obj = {
  1. total : int;
  2. paging : paging_obj;
  3. matches : file_obj list;
}
Sourcetype search_obj = {
  1. query : string;
  2. messages : message_search_obj option;
  3. files : file_search_obj option;
}
Sourcetype team_obj = {
  1. id : string;
  2. name : string;
  3. domain : string;
  4. email_domain : string;
  5. icon : Yojson.Safe.json;
}
Sourcetype login_obj = {
  1. user_id : user;
  2. username : string;
  3. date_first : timestamp;
  4. date_last : timestamp;
  5. count : int;
  6. ip : string;
  7. user_agent : string;
  8. isp : string;
  9. country : string;
  10. region : string;
}
Sourcetype team_access_log_obj = {
  1. logins : login_obj list;
  2. paging : paging_obj;
}
Sourcetype history_result = [
  1. | `Success of history_obj
  2. | parsed_auth_error
  3. | channel_error
  4. | timestamp_error
]

Return value of a history related request.

Type construction helper functions

To build the types required in the API calls, you can use these helper functions.

Sourceval start_session : ?base_url:string -> string -> session

Create a session from a token string and an optional base_url.

Sourceval token_of_string : string -> session

Deprecated wrapper for backcompat.

  • deprecated Please use 'start_session' instead.
Sourceval field : ?title:string -> ?short:bool -> string -> field_obj
Sourceval attachment : ?fallback:string -> ?color:string -> ?pretext:string -> ?author_name:string -> ?author_link:string -> ?author_icon:string -> ?title:string -> ?title_link:string -> ?text:string -> ?fields:field_obj list -> ?image_url:string -> ?thumb_url:string -> ?footer:string -> ?footer_icon:string -> ?ts:timestamp -> ?mrkdwn_in:string list -> unit -> attachment_obj
Sourceval message_of_string : string -> message

Build a message from a string.

Sourceval topic_of_string : string -> topic option

Build a topic out of a string. topic types are also used to set purposes. Also validates the length of the topic, since Slack has a 250 UTF-8 codepoint length limit on purposes and topics.

Sourceval topic_of_string_exn : string -> topic

Same as topic_of_string but throws an exception if it fails to convert the text data into a topic.

Sourceval group_of_string : string -> group

Construct a group out of a given string. This can be either a group id, starting with capital 'G' character which is the preferred way or it can be a group name for convenience. In the latter case, each API call with requires a group will perform an additional request to determine the group id from the name.

Sourceval user_of_string : string -> user

Constructs a user out of a given string. The string can either be an user id starting with a capital 'U' which is the preferred way or it can be a simple user name in which case every API call will look up the user name to an id in an additional request.

Sourceval bot_of_string : string -> bot
Sourceval channel_of_string : string -> channel

Constructs a channel out of a given string. Can either be a channel id starting with a capital 'C' which is the preferred way or a channel name starting with a '#'. If a channel name was provided, each consecutive API call using it will first need to resolve the channel name into a channel id by means of an additional request.

Sourceval conversation_of_string : string -> conversation

Create a conversation type out of a given string. The string is usually starting with a capital 'D' and represents an IM conversation channel.

Slack API calls

Sourceval api_test : ?base_url:string -> ?foo:string -> ?error:string -> unit -> [ `Success of Yojson.Safe.json | api_error ] Lwt.t

Checks API calling code.

  • parameter base_url

    If set, overrides the Slack API base URL.

  • parameter foo

    A dummy value that will be returned by the API.

  • parameter error

    If set, will return a specific kind of error.

Sourceval auth_test : session -> [ `Success of authed_obj | parsed_auth_error ] Lwt.t

Checks authentication & identity.

  • parameter session

    The session containing the authentication token.

Sourceval channels_archive : session -> channel -> [ `Success | parsed_auth_error | channel_error | already_archived_error | `Cant_archive_general | `Last_restricted_channel | restriction_error | `User_is_restricted | bot_error ] Lwt.t

Archives a channel.

Sourceval channels_create : session -> string -> [ `Success of channel_obj | parsed_auth_error | name_error | `User_is_restricted | bot_error ] Lwt.t

Creates a channel.

Sourceval channels_history : session -> ?latest:timestamp -> ?oldest:timestamp -> ?count:int -> ?inclusive:bool -> channel -> history_result Lwt.t

Fetches history of messages and events from a channel.

  • parameter session

    The session containing the authentication token.

  • parameter latest

    The newest message from history to be returned.

  • parameter oldest

    The oldest message from history to be returned.

  • parameter count

    The number of messages to be returned.

  • parameter inclusive

    Include messages with latest or oldest timestamp in results.

  • parameter channel

    The Slack channel from which to get the history.

Sourceval channels_info : session -> channel -> [ `Success of channel_obj | parsed_auth_error | channel_error ] Lwt.t

Gets information about a channel.

Invites a user to a channel.

Sourceval channels_join : session -> channel -> [ `Success of channel_obj | parsed_auth_error | channel_error | name_error | archive_error | `User_is_restricted | bot_error ] Lwt.t

Joins a channel, creating it if needed.

Removes a user from a channel.

Sourceval channels_leave : session -> channel -> [ `Success of channel_leave_obj | parsed_auth_error | channel_error | archive_error | leave_general_error | `User_is_restricted | bot_error ] Lwt.t

Leaves a channel.

Sourceval channels_list : ?exclude_archived:bool -> session -> [ `Success of channel_obj list | parsed_auth_error ] Lwt.t

Lists all channels in a Slack team.

Sets the read cursor in a channel.

Sourceval channels_rename : session -> channel -> string -> [ `Success of channel_rename_obj | parsed_auth_error | channel_error | not_in_channel_error | name_error | invalid_name_error | `Not_authorized | `User_is_restricted | bot_error ] Lwt.t

Renames a team channel.

Sourceval channels_set_purpose : session -> channel -> topic -> topic_result Lwt.t

Sets the purpose for a channel.

Sourceval channels_set_topic : session -> channel -> topic -> topic_result Lwt.t

Sets the topic for a channel.

Sourceval channels_unarchive : session -> channel -> [ `Success | parsed_auth_error | channel_error | `Not_archived | `User_is_restricted | bot_error ] Lwt.t

Unarchives a channel.

Sourceval chat_delete : session -> timestamp -> chat -> [ `Success of chat_obj | parsed_auth_error | channel_error | message_error ] Lwt.t

Deletes a message.

Sourceval chat_post_message : session -> chat -> ?as_user:bool -> ?link_names:bool -> ?mrkdwn:bool -> ?reply_broadcast:bool -> ?thread_ts:timestamp -> ?unfurl_links:bool -> ?unfurl_media:bool -> ?username:string -> ?parse:string -> ?icon_url:string -> ?icon_emoji:string -> ?attachments:attachment_obj list -> message -> [ `Success of chat_obj | parsed_auth_error | channel_error | archive_error | message_length_error | attachments_error | rate_error | bot_error ] Lwt.t

Sends a message to a channel.

Sourceval chat_update : session -> timestamp -> chat -> ?as_user:bool -> ?attachments:attachment_obj list -> ?link_names:bool -> ?parse:string -> message -> [ `Success of chat_obj | parsed_auth_error | channel_error | message_update_error | message_length_error | attachments_error ] Lwt.t

Updates a message.

Sourceval emoji_list : session -> [ `Success of emoji list | parsed_auth_error ] Lwt.t

Lists custom emoji for a team.

Sourceval files_delete : session -> string -> [ `Success | parsed_auth_error | `Cant_delete_file | file_error | bot_error ] Lwt.t
Sourceval files_info : session -> ?count:int -> ?page:int -> string -> [ `Success of files_info_obj | parsed_auth_error | file_error | bot_error ] Lwt.t

Gets information about a team file.

Sourceval files_list : ?user:user -> ?ts_from:timestamp -> ?ts_to:timestamp -> ?types:string -> ?count:int -> ?page:int -> session -> [ `Success of files_list_obj | parsed_auth_error | user_error | unknown_type_error | bot_error ] Lwt.t

Lists & filters team files.

Sourceval files_upload : session -> ?filetype:string -> ?filename:string -> ?title:string -> ?initial_comment:string -> ?channels:string -> Cohttp_lwt.Body.t -> [ `Success of file_obj | parsed_auth_error | bot_error ] Lwt.t

Uploads or creates a file.

Sourceval groups_archive : session -> group -> [ `Success | parsed_auth_error | channel_error | already_archived_error | `Group_contains_others | `Last_restricted_channel | restriction_error | `User_is_ultra_restricted | bot_error ] Lwt.t

Archives a private group.

Sourceval groups_close : session -> group -> [ `Success of chat_close_obj | parsed_auth_error | channel_error ] Lwt.t

Closes a private group.

Sourceval groups_create : session -> group -> [ `Success of group_obj | parsed_auth_error | name_error | restriction_error | `User_is_ultra_restricted | bot_error ] Lwt.t

Creates a private group.

Sourceval groups_create_child : session -> group -> [ `Success of group_obj | parsed_auth_error | channel_error | already_archived_error | restriction_error | `User_is_ultra_restricted | bot_error ] Lwt.t

Clones and archives a private group.

Sourceval groups_history : session -> ?latest:timestamp -> ?oldest:timestamp -> ?count:int -> ?inclusive:bool -> group -> history_result Lwt.t

Fetches history of messages and events from a private group.

Sourceval groups_invite : session -> group -> user -> [ `Success of groups_invite_obj | parsed_auth_error | channel_error | user_error | invite_error | archive_error | `User_is_ultra_restricted | bot_error ] Lwt.t

Invites a user to a private group.

Sourceval groups_kick : session -> group -> user -> [ `Success | parsed_auth_error | channel_error | user_error | kick_error | not_in_group_error | restriction_error | `User_is_restricted | bot_error ] Lwt.t

Removes a user from a private group.

Sourceval groups_leave : session -> group -> [ `Success | parsed_auth_error | channel_error | archive_error | leave_last_channel_error | last_member_error | `User_is_ultra_restricted | bot_error ] Lwt.t

Leaves a private group.

Sourceval groups_list : ?exclude_archived:bool -> session -> [ `Success of group_obj list | parsed_auth_error ] Lwt.t

Lists private groups that the calling user has access to.

Sets the read cursor in a private group.

Sourceval groups_open : session -> group -> [ `Success of groups_open_obj | parsed_auth_error | channel_error ] Lwt.t

Opens a private group.

Sourceval groups_rename : session -> group -> string -> [ `Success of groups_rename_obj | parsed_auth_error | channel_error | name_error | invalid_name_error | `User_is_restricted | bot_error ] Lwt.t

Renames a private group.

Sourceval groups_set_purpose : session -> group -> topic -> topic_result Lwt.t

Sets the purpose for a private group.

Sourceval groups_set_topic : session -> group -> topic -> topic_result Lwt.t

Sets the topic for a private group.

Sourceval groups_unarchive : session -> group -> [ `Success | parsed_auth_error | channel_error | `Not_archived | `User_is_restricted | bot_error ] Lwt.t

Unarchives a private group.

Sourceval im_close : session -> conversation -> [ `Success of chat_close_obj | parsed_auth_error | channel_error | `User_does_not_own_channel ] Lwt.t

Close a direct message channel.

Sourceval im_history : session -> ?latest:timestamp -> ?oldest:timestamp -> ?count:int -> ?inclusive:bool -> conversation -> history_result Lwt.t

Fetches history of messages and events from direct message channel.

Sourceval im_list : session -> [ `Success of im_obj list | parsed_auth_error ] Lwt.t

Lists direct message channels for the calling user.

Sets the read cursor in a direct message channel.

Opens a direct message channel.

Sourceval oauth_access : ?base_url:string -> string -> string -> ?redirect_url:string -> string -> [ `Success of oauth_obj | `ParseFailure of string | oauth_error ] Lwt.t

Exchanges a temporary OAuth code for an API session.

Sourceval search_all : session -> ?sort:sort_criterion -> ?sort_dir:sort_direction -> ?highlight:bool -> ?count:int -> ?page:int -> string -> [ `Success of search_obj | parsed_auth_error | bot_error ] Lwt.t

Searches for messages and files matching a query.

Sourceval search_files : session -> ?sort:sort_criterion -> ?sort_dir:sort_direction -> ?highlight:bool -> ?count:int -> ?page:int -> string -> [ `Success of search_obj | parsed_auth_error | bot_error ] Lwt.t

Searches for files matching a query.

Sourceval search_messages : session -> ?sort:sort_criterion -> ?sort_dir:sort_direction -> ?highlight:bool -> ?count:int -> ?page:int -> string -> [ `Success of search_obj | parsed_auth_error | bot_error ] Lwt.t

Searches for messages matching a query.

Sourceval stars_list : ?user:user -> ?count:int -> ?page:int -> session -> [ `Success of stars_list_obj | parsed_auth_error | user_error | bot_error ] Lwt.t

Lists stars for a user.

Sourceval team_access_logs : ?count:int -> ?page:int -> session -> [ `Success of team_access_log_obj | parsed_auth_error | `Paid_only | bot_error ] Lwt.t

Gets the access logs for the current team.

Sourceval team_info : session -> [ `Success of team_obj | parsed_auth_error | bot_error ] Lwt.t

Gets information about the current team.

Sourceval users_get_presence : session -> user -> [ `Success of presence | user_error | parsed_auth_error ] Lwt.t

Gets user presence information.

Gets information about a user.

Sourceval users_list : session -> [ `Success of user_obj list | parsed_auth_error ] Lwt.t

Lists all users in a Slack team.

Sourceval users_set_active : session -> [ `Success | parsed_auth_error | bot_error ] Lwt.t

Marks a user as active.

Sourceval users_set_presence : session -> presence -> [ `Success | parsed_auth_error | presence_error ] Lwt.t

Manually sets user presence.

OCaml

Innovation. Community. Security.