diff --git a/source/_components/mailgun.markdown b/source/_components/mailgun.markdown index db3085cc1fc..db47b0549e9 100644 --- a/source/_components/mailgun.markdown +++ b/source/_components/mailgun.markdown @@ -8,8 +8,11 @@ comments: false sharing: true footer: true logo: mailgun.png -ha_category: Notifications +ha_category: + - Notifications ha_release: 0.38 +redirect_from: + - /components/notify.mailgun/ --- To be able to receive webhooks from Mailgun, your Home Assistant instance needs to be accessible from the web ([Hass.io instructions](/addons/duckdns/)) and you need to have the `base_url` configured for the HTTP component ([docs](/components/http/#base_url)). @@ -18,27 +21,11 @@ To set it up, go to the integrations page in the configuration screen and find M You will get a URL of the following format: `https:///api/webhook/9940e99a26fae4dcf6fe0a478124b6b58b578ea4c55c9a584beb1c9f5057bb91`. To receive webhooks from Mailgun, you need to provide that url as a callback URL in the Webhooks tab of the Mailgun Control Panel. -Events coming in from Mailgun will be available as events in Home Assistant and are fired as `mailgun_message_received`. The [data specified by Mailgun](https://documentation.mailgun.com/en/latest/api-events.html#event-structure) will be available as the event data. You can use this event to trigger automations. +There is currently support for the following device types within Home Assistant: -You can then consume that information with the following automation: +- [Notifications](#notifications). -```yaml -automation: - trigger: - platform: event - event_type: mailgun_message_received - event_data: - action: call_service - action: - service: light.turn_on - entity_id: light.office -``` - -To send messages, use the [Mailgun notify platform][notify]. - -[notify]: /components/notify.mailgun/ - -## {% linkable_title Sample configuration %} +## {% linkable_title Configuration %} ```yaml # Example configuration.yaml entry @@ -62,3 +49,79 @@ sandbox: default: false type: boolean {% endconfiguration %} + +Events coming in from Mailgun will be available as events in Home Assistant and are fired as `mailgun_message_received`. The [data specified by Mailgun](https://documentation.mailgun.com/en/latest/api-events.html#event-structure) will be available as the event data. You can use this event to trigger automations. + +You can then consume that information with the following automation: + +```yaml +automation: + trigger: + platform: event + event_type: mailgun_message_received + event_data: + action: call_service + action: + service: light.turn_on + entity_id: light.office +``` + +## {% linkable_title Notifications %} + +The Mailgun notification service allows you to send emails via Mailgun's REST API. It requires the [Mailgun component](#configuration) to be set up. + +### {% linkable_title Notifications configuration %} + +```yaml +# Example configuration.yaml entry +notify: + - name: mailgun + platform: mailgun + recipient: CHANGE@EXAMPLE.COM +``` + +{% configuration %} +domain: + description: This is the domain name to be used when sending out mail. + required: true + type: string +sandbox: + description: "(**Deprecated**) If a sandboxed domain is used, specify it in `domain`." + required: false + default: false + type: boolean +api_key: + description: This is the API Key that has been generated in your Mailgun account. + required: true + type: string +recipient: + description: The email address of the recipient. + required: true + type: string +sender: + description: The sender's email address. + required: false + default: "`hass@DOMAIN`, where `DOMAIN` is the outgoing mail domain, as defined by the `domain` configuration entry." + type: string +{% endconfiguration %} + +### {% linkable_title Example automation %} + +The following automation reacts to an event by sending out an email with two attachments. + +```yaml +# Example automation using Mailgun notifications +automation: + trigger: + platform: event + event_type: SPECIAL_EVENT + action: + service: notify.mailgun + data: + title: "Something special has happened" + message: "This a test message from Home Assistant" + data: + images: + - /home/pi/pic_test1.png + - /home/pi/pic_test2.png +``` \ No newline at end of file diff --git a/source/_components/notify.mailgun.markdown b/source/_components/notify.mailgun.markdown deleted file mode 100644 index 35941fc55d4..00000000000 --- a/source/_components/notify.mailgun.markdown +++ /dev/null @@ -1,77 +0,0 @@ ---- -layout: page -title: "Mailgun Notify" -description: "Instructions on how to add Mailgun mail notifications to Home Assistant." -date: 2017-02-06 16:52 -sidebar: true -comments: false -sharing: true -footer: true -logo: mailgun.png -ha_category: Notifications -ha_release: 0.38 ---- - -The Mailgun notification service allows you to send emails via Mailgun's REST API. It requires the [Mailgun component] to be set up. - -[Mailgun component]: /components/mailgun/ - -## {% linkable_title Sample configuration %} - -```yaml -# Example configuration.yaml entry -mailgun: - domain: EXAMPLE.COM - api_key: YOUR_API_KEY - -notify: - - name: mailgun - platform: mailgun - recipient: CHANGE@EXAMPLE.COM -``` - -{% configuration %} -domain: - description: This is the domain name to be used when sending out mail. - required: true - type: string -sandbox: - description: "(**Deprecated**) If a sandboxed domain is used, specify it in `domain`." - required: false - default: false - type: boolean -api_key: - description: This is the API Key that has been generated in your Mailgun account. - required: true - type: string -recipient: - description: The email address of the recipient. - required: true - type: string -sender: - description: The sender's email address. - required: false - default: "`hass@DOMAIN`, where `DOMAIN` is the outgoing mail domain, as defined by the `domain` configuration entry." - type: string -{% endconfiguration %} - -## {% linkable_title Example automation %} - -The following automation reacts to an event by sending out an email with two attachments. - -```yaml -# Example automation using Mailgun notifications -automation: - trigger: - platform: event - event_type: SPECIAL_EVENT - action: - service: notify.mailgun - data: - title: "Something special has happened" - message: "This a test message from Home Assistant" - data: - images: - - /home/pi/pic_test1.png - - /home/pi/pic_test2.png -```