Building an Out-of-the-Box Voice Assistant: External Processing with n8n

TL;DR Use Custom Sentence Trigger & Restful Command

configuration.yaml:

...
rest_command:
  custom_http_post:
    url: "{{ url }}"
    method: post
    headers:
      Content-Type: "application/json"
      Authorization: "Bearer {{ token }}"
    payload: "{{ payload }}"

create automation:

alias: restful-automation
description: ""
triggers:
  - trigger: conversation
    command:
      - (ask|tell) ai {query}
conditions: []
actions:
  - action: rest_command.custom_http_post
    response_variable: query_response
    data:
      url: http://192.168.0.111:5678/webhook-test/hass
      token: ""
      payload: >-
        {{ { 'query': trigger.slots.query , 'conversation_id': 'n8n' } | to_json
        }}
  - set_conversation_response: "{{ query_response }}"
mode: single

Example

Note: Remember to change the Webhook response to last executed node :smiley:

Used integrations and Addons:

  • HassMic
  • OpenAI_Compatible_Conversation
  • Whisper
  • Piper
  • OpenWakeWord

References

The following references consist the step by step guide of setting up the whole voice assist framework:

1 Like