Ruby library for the Mural public API.
Disclaimer
The views and opinions expressed in this repository are solely hose of the individual contributors and do not represent the official view of Tactivos, Inc. d/b/a Mural.
Mural does not endorse this repository in any way.
git checkout https://github.com/mickaelpham/mural-ruby
cd mural-ruby
bundle install-
Register a new app and gather your
client_idandclient_secret. For the scopes, pick the minimum required for your application. -
Create a
.envfile with the following template and fill inMURAL_CLIENT_IDandMURAL_CLIENT_SECRETwith those values:
MURAL_CLIENT_ID=
MURAL_CLIENT_SECRET=
MURAL_SCOPE=
MURAL_REDIRECT_URI=http://localhost:4567/callback
MURAL_HOST=app.mural.co
- Run the script to request your access and refresh tokens:
bin/authorize- Start the console:
bin/console- From the console, create a client instance and start using it, e.g.:
irb(main):001> mural = Mural::Client.from_env
=>
#<Mural::Client:0x0000000120baa740
...
irb(main):002> mural.users.current_user
=>
#<Mural::CurrentUser:0x0000000124614bd8
@avatar="<AVATAR_URL>",
@company_id=nil,
@company_name=nil,
@created_on=1753301275000,
@email="<USER_EMAIL>",
@first_name="<USER_FIRST_NAME>",
@id="=<USER_ID>",
@last_active_workspace="<USER_WORKSPACE>",
@last_name="<USER_LAST_NAME>",
@type="member">To upload a my.pdf file that's located in the same directory as where you are
running the script:
MURAL_ID = 'workspace-1.mural-1'
client = Mural::Client.from_env
# Create an asset, receive an URL to upload the content to.
asset = client.mural_content.create_asset(
MURAL_ID,
file_extension: 'pdf',
asset_type: 'file'
)
# Upload the asset to the received URL.
request = Net::HTTP::Put.new(uri)
request['x-ms-blob-type'] = asset.headers.blob_type
path = File.expand_path('./my.pdf', __dir__)
request.body = File.read(path)
Net::HTTP.start(
uri.hostname, uri.port, use_ssl: uri.scheme == 'https'
) do |http|
http.request request
end
# Create a `file` widget on the mural to display the asset preview.
params = Mural::Widget::CreateFileParams.new.tap do |params|
params.name = asset.name
params.x = 250
params.y = 0
end
client.mural_content.create_file(MURAL_ID, params)- You can reply to a comment by passing a
repliesarray ofStringmessage. Each message will be added as a reply to the original comment. - You can "[at] mention" someone in a comment or in a reply by using the
following pattern in the
messageor thereplies:
@[<USER FULL NAME> @<USER ID>](<USER ID>)
Example replying to a thread:
MURAL_ID = 'mural-1'
COMMENT_ID = 'comment-1'
reply_to_params = Mural::Widget::UpdateCommentParams.new.tap do |c|
c.replies = ["Can you have a look @[John Doe @user-1](user-1)]?"]
end
client.mural_content.update_comment(MURAL_ID, COMMENT_ID, reply_to_params)Note that the user must already be a mural member for the mention to trigger an email notification.
DrawWidget, AKA sketches, are not returned by theGET widgetsendpoint.
- Similarly,
InkingWidget, AKA drawings, are not returned by the endpoint.
- Mind maps are smart widgets, they are simply a collection of text and arrow
widgets. There are no specific
typefor a mind map in the API.
- Likewise, smart planners are collection of widgets, and the API doesn't specify anything about them.





