From 42b4f0af6ea907943a3ada9f07fbe1a45455b663 Mon Sep 17 00:00:00 2001 From: vip30 Date: Sat, 10 Oct 2020 10:23:17 +0800 Subject: [PATCH] Add chat unfurl api --- README.md | 2 +- lib/slack/web/docs/chat.unfurl.json | 75 +++++++++++++++++++++++++++++ mix.exs | 2 +- 3 files changed, 77 insertions(+), 2 deletions(-) create mode 100644 lib/slack/web/docs/chat.unfurl.json diff --git a/README.md b/README.md index 857a13e..b2c658e 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ def application do end def deps do - [{:slack, "~> 0.23.5"}] + [{:slack, "~> 0.23.6"}] end ``` diff --git a/lib/slack/web/docs/chat.unfurl.json b/lib/slack/web/docs/chat.unfurl.json new file mode 100644 index 0000000..feae2f0 --- /dev/null +++ b/lib/slack/web/docs/chat.unfurl.json @@ -0,0 +1,75 @@ +{ + "desc":"Provide custom unfurl behavior for user-posted URLs.", + "args":{ + "ts":{ + "required":true, + "example":"1405894322.002768", + "desc":"Timestamp of the message to add unfurl behavior to." + }, + "channel":{ + "required":true, + "type":"channel", + "example":"C1234567890", + "desc":"Channel ID of the message." + }, + "unfurls":{ + "required":true, + "desc":"URL-encoded JSON map with keys set to URLs featured in the the message, pointing to their unfurl blocks or message attachments." + }, + "user_auth_message":{ + "required":false, + "desc":"Provide a simply-formatted string to send as an ephemeral message to the user as invitation to authenticate further and enable full unfurling behavior." + }, + "user_auth_required":{ + "required":false, + "example":true, + "desc":"Set to true or 1 to indicate the user must install your Slack app to trigger unfurls for this domain." + }, + "user_auth_url":{ + "required":false, + "example":"https://example.com/onboarding?user_id=xxx", + "desc":"Send users to this custom URL where they will complete authentication in your app to fully trigger unfurling. Value should be properly URL-encoded.." + } + }, + "errors":{ + "missing_channel":"The request is missing the channel parameter", + "missing_ts":"The request is missing the ts parameter", + "cannot_find_channel":"The specified channel could not be located for this token.", + "cannot_find_service":"A record of your app being allowed to unfurl for this workspace could not be found.", + "cannot_parse_attachment":"The provided unfurls argument could not be parsed or understood.", + "missing_unfurls":"The request is missing the unfurls parameter.", + "invalid_unfurls_format":"The unfurls parameter cannot be JSON-decoded into a map of URLs to attachments.", + "cannot_unfurl_url":"The URL cannot be unfurled. This error may be returned if you haven't acknowledged a link_shared event tied to the same URL. It is also returned when the domain appears in a workspace's administrative blacklists.", + "cannot_prompt":"The current user has already interacted with and dismissed a prompt for this application.", + "cannot_find_message":"The ts value in the request does not match a message.", + "cannot_unfurl_message":"The URL cannot be unfurled because the URL provided does not appear in the message.", + "not_authed":"No authentication token provided.", + "invalid_auth":"Some aspect of authentication cannot be validated. Either the provided token is invalid or the request originates from an IP address disallowed from making the request.", + "account_inactive":"Authentication token is for a deleted user or workspace.", + "token_revoked":"Authentication token is for a deleted user or workspace or the app has been removed.", + "no_permission":"The workspace token used in this request does not have the permissions necessary to complete the request. Make sure your app is a member of the conversation it's attempting to post a message to.", + "org_login_required":"The workspace is undergoing an enterprise migration and will not be available until migration is complete.", + "ekm_access_denied":"Administrators have suspended the ability to post a message.", + "missing_scope":"The token used is not granted the specific scope permissions required to complete this request.", + "not_allowed_token_type":"The token type used in this request is not allowed.", + "method_deprecated":"The method has been deprecated.", + "deprecated_endpoint":"The endpoint has been deprecated.", + "two_factor_setup_required":"Two factor setup is required.", + "enterprise_is_restricted":"The method cannot be called from an Enterprise.", + "is_bot":"This method cannot be called by a bot user.", + "invalid_arguments":"The method was either called with invalid arguments or some detail about the arguments passed are invalid, which is more likely when using complex arguments like blocks or attachments.", + "invalid_arg_name":"The method was passed an argument whose name falls outside the bounds of accepted or expected values. This includes very long names and names with non-alphanumeric characters other than _. If you get this error, it is typically an indication that you have made a very malformed API call.", + "invalid_array_arg":"The method was passed an array as an argument. Please only input valid strings.", + "invalid_charset":"The method was called via a POST request, but the charset specified in the Content-Type header was invalid. Valid charset names are: utf-8 iso-8859-1.", + "invalid_form_data":"The method was called via a POST request with Content-Type application/x-www-form-urlencoded or multipart/form-data, but the form data was either missing or syntactically invalid.", + "invalid_post_type":"The method was called via a POST request, but the specified Content-Type was invalid. Valid types are: application/json application/x-www-form-urlencoded multipart/form-data text/plain.", + "missing_post_type":"The method was called via a POST request and included a data payload, but the request did not include a Content-Type header.", + "team_added_to_org":"The workspace associated with your request is currently undergoing migration to an Enterprise Organization. Web API and other platform operations will be intermittently unavailable until the transition is complete.", + "ratelimited":"The request has been ratelimited. Refer to the Retry-After header for when to retry the request.", + "accesslimited":"Access to this method is limited on the current network", + "request_timeout":"The method was called via a POST request, but the POST data was either missing or truncated.", + "service_unavailable":"The service is temporarily unavailable", + "fatal_error":"The server could not complete your operation(s) without encountering a catastrophic error. It's possible some aspect of the operation succeeded before the error was raised.", + "internal_error":"The server could not complete your operation(s) without encountering an error, likely due to a transient issue on our end. It's possible some aspect of the operation succeeded before the error was raised." + } + } \ No newline at end of file diff --git a/mix.exs b/mix.exs index 0c1b21b..1aaa4cf 100644 --- a/mix.exs +++ b/mix.exs @@ -4,7 +4,7 @@ defmodule Slack.Mixfile do def project do [ app: :slack, - version: "0.23.5", + version: "0.23.6", elixir: "~> 1.7", elixirc_paths: elixirc_paths(Mix.env()), name: "Slack",