Allows to unsubscribe handler
from processing Workato messages.
See on method.
Allows to subscribe to messages of specific type, emitted by embedded Workato app.
See EmbeddingMessages.EmbeddingWorkatoMessage for the complete list of emitted messages.
Example:
Workato.on('navigated', payload => {
console.log(`Workato navigated to ${payload.url}`);
if (payload.replaced) {
console.log('And URL was replaced in browser history');
}
});
Value of the type
property of EmbeddingMessages.EmbeddingWorkatoMessage (e.g. navigated
).
Will be called with message's payload as the first parameter.
Allows to subscribe to all messages, emitted by Workato.
Example:
Workato.on('*', message => {
console.log(`Received a "${message.type}" message.');
if (message.payload) {
console.log('Message payload:', message.payload);
}
});
Will be called for all the messages emitted by Workato. First parameter will be the EmbeddingMessages.EmbeddingWorkatoMessage object.
Sends a message to embedded Workato app.
See EmbeddingMessages.EmbeddingVendorMessage for the complete list of emitted messages.
Disables handleNavigation helper. Does nothing if handleNavigation has never been called.
Helper method that allows to synchronize current Workato URL with current vendor's URL.
It does the following:
Calls provided config.onWorkatoNavigation callback every time after embedded Workato app is navigated to another page (Workato URL changes). It's also called right after initialization of Workato app.
If this handler is omitted or event.preventVendorUrlChange
is not called, current browser's URL will be
updated to corresponding embedding URL using History API.
Calls provided config.onVendorNavigation callback every time user clicks on embedding links in the vendor's webapp or clicks browser's back/forward buttons.
If this handler is omitted or event.preventWorkatoUrlChange
is not called, navigateTo method will
be called with the corresponding Workato URL.
Also if this handler is omitted or event.preventVendorUrlChange
is not called, current browser's URL will
be updated to corresponding embedding URL using History API.
These handlers can be used, for example, to highlight currently active embedding link in the vendor's webapp or to properly embed Workato into an existing SPA app with it's own routing solution.
Navigates Workato webapp in the embedding iframe to the provided URL.
Note that navigation to all non-Workato URLs (e.g. https://foobar.com
) with be ignored.
Constructs embedding URL out of Workato URL.
Example:
Workato.configure({embeddingUrlPrefix: '/integration'});
Workato.constructEmbeddingUrl('/') // => '/integration/'
Workato.constructEmbeddingUrl('/recipes') // => '/integration/recipes'
Workato.constructEmbeddingUrl('/recipes/1?a=1#hash') // => '/integration/recipes/1?a=1#hash'
Extracts Workato URL from vendor URL.
Returns null
if vendor URL is not embedding URL.
Example:
Workato.configure({embeddingUrlPrefix: '/integration'});
Workato.extractWorkatoUrl('/integration') // => '/'
Workato.extractWorkatoUrl('/integration/bar?a=1#hash') // => '/bar?a=1#hash'
Workato.extractWorkatoUrl('https://vendor.com/integration/bar?a=1#hash') // => '/bar?a=1#hash'
Workato.extractWorkatoUrl('/blah') // => null
Workato.extractWorkatoUrl('https://google.com/foo/bar?a=1#hash') // => null
Vendor URL. May or may not contain an origin.
Generates a URL that can be used as a value for embedding iframe's src
attribute.
JWT token for authorization. See more information here: https://docs.workato.com/oem/jwt-direct-linking
Optional
workatoUrl: stringSpecifies Workato URL that will be initially opened in the iframe. If omitted, Workato URL will be extracted from the current browser's URL and if it's not an embedding URL, an error will be thrown.
Readonly
currentCurrent Workato URL, loaded into the embedding iframe e.g. /recipes/1?status=succeeded#jobs
.
Is null
until first EmbeddingMessages.EmbeddingLoadedMessage is received.
Also becomes null
after EmbeddingMessages.EmbeddingUnloadedMessage is received.
A flag indicating that embedded Workato app is loaded and ready to send/receive messages.
Becomes true
after EmbeddingMessages.EmbeddingLoadedMessage is received and false
after EmbeddingMessages.EmbeddingUnloadedMessage.
Allows to set/update the client config.
This method must be called at least once to specify required config properties (see EmbeddingClientConfig).