Comments (6)
Hi Markus!
To refer to stored user credentials in the agent options you should use liquid templating like this:
{
"password": "{% credential PASSWORD %}"
}
Where PASSWORD
is the name of the credential. Expression in curly braces will be replaced by the value of the credential.
Thanks!
from active_workflow.
Thank you! (Of course just now I finally spotted the help text where it says exactly that...)
But still I don't seem to get it right:
I set up a credential with my user account with the name cred_test
and some gibberish value, put it in the options JSON object like this: { ..., "username": "{% credential cred_test %}" }
and had my custom remote agent print the received payload to stdout which reads:
{
'method': 'check',
'params': {
'message': None,
'options': { ... , 'username': '{% credential cred_test %}'},
'memory': {},
'credentials': {'name': 'value'}
}
}
PS: The exact same syntax works fine if I put it in the Manual Message agent, my cred_test
gets replaced with the stored value. Do I have to enable liquid templating for the remote agent somehow?
from active_workflow.
Ah, I see. Custom remote agents don't get liquid templating out of the box (yet)... We will add partial "preprocessing" of options through liquid templating (specifically to handle cases like yours).
Currently, your remote agent is getting options verbatim as entered by the user. It also receives all the credentials. If you need that users of your remote agent can use credentials in options you can add liquid templating support in your agent yourself (not a straightforward thing) or do it in a simple, but less generic way:
For example, if you only need a credential for some password, you could create an agent option:
{
"password_from_credential": "[name_of_the_credential]"
}
And then use it to look up the value of the credential in your agent's code.
Sorry for the inconvenience and thank you!
P.S.
Liquid templating is not supported out of the box for remote agents, because users may want to refer to something that is internal to the agent and that data is not available to the ActiveWorkflow system.
Another solution in the works will be toolkits/libraries for several popular programming languages (rust included!) that will help develop custom remote agents and will include liquid templating. Imagine it like some sort of agent SDK.
from active_workflow.
Thank you for the clarification. Using credentials is not a must at the moment for my project, I am just trying to figure all of the possible options out :)
Still one more follow-up question though: My custom remote agent apparently receives 'credentials': {'name': 'value'}
as the actual payload. If I understood you correctly though, it should have received the actual credentials stored in the Active Workflow UI? (which would have been something like {'cred_test': '123456789abc'}
in this case)
from active_workflow.
Hm, that is unexpected. In fact credentials to remote agents are sent in the following format:
{
...,
'params': {
...,
'credentials': [{ 'name': 'qwerty', 'value': 'asdfg' }, {...}, {...}]
}
}
I.e. a list of objects with name
and value
fields.
I suspect something with JSON parsing, but I may be wrong. Could you please print raw (before parsing) request content to stdout to make sure that remote agent indeed fails to receive the right credentials?
Thank you, Markus!
from active_workflow.
Mystery solved, it was indeed a problem with the JSON parsing of our remote agent :)
Thank you so much, I really enjoy this project and will spread the word about it!
from active_workflow.
Related Issues (12)
- docker workflow isn't working HOT 1
- Security concern HOT 1
- Send array in Post Agent HOT 7
- AGPL-3.0-only HOT 2
- SMTP configuration
- Contribute back to Huginn? HOT 4
- Using alpine image HOT 2
- TCP Timeout for Remote Agents / Async HTTP HOT 1
- Remote Agent API: empty strings in errors or logs cause errors HOT 4
- Updating Remote Agent information/description HOT 4
- Application freezes when run with docker-compose since v0.9.9 HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from active_workflow.