For security reasons, action requests can only be sent to endpoints that share the same domain as your custom data endpoint. For example, if you load user data from https://api.yoursite.com/users/details
, you can only send actions to api.yoursite.com
Need a straightforward action like deleting a user account? Use a simple button! Here's how:
<button
name="delete"
data-method="post"
data-url="https://api.yoursite.com/users/{{ email }}">
Delete this account
</button>
Required attributes:
data-url
: Where to send the request (must match your data endpoint domain)
data-method
: Optional, defaults to POST. Accepts POST, PUT, PATCH, and DELETE
Need to collect multiple pieces of data? Forms are your friend! They use standard HTML form attributes.
<form method="put" action="https://api.yoursite.com/users/...">
</form>
Checkboxes in Fernand are smart. They can handle both single confirmations and multiple selections.
<input type="checkbox" name="agree" value="yes" />
This generates: {"agree": true}
when checked, false
when unchecked.
<input type="checkbox" name="options" value="A" />
<input type="checkbox" name="options" value="B" />
This generates: {"options": ["A", "B"]}
when both are selected, or an empty array if none are selected.
When an agent triggers an action, here's what your server receives:
agent
Email of the agent performing the action
conversation_id
Fernand conversation ID
subject
Conversation subject
contact
Primary contact email
data
Form data (if using a form)
Success is any 2xx response, and requests timeout after 3 seconds.
Only agents with the "Execute" role can perform actions. Want to hide specific parts of your HTML template from unauthorized users? Use the {% if can_execute %}
conditional statement.
{% if can_execute %}
<button name="action" data-method="post" ...>Do something</button>
{% endif %}