Auto Actions: Difference between revisions

Jump to navigation Jump to search
Lesley (talk | contribs)
Lesley (talk | contribs)
 
(82 intermediate revisions by 2 users not shown)
Line 14: Line 14:
==Summary==
==Summary==
<div class="summarybox">
<div class="summarybox">
An Auto Action is an action which can be used '''manually or programmed to run automatically''' at a specific time relative to the time of the '''booking''', to the '''check-in''' date or to the '''check-out''' date.  
An Auto Action is an action which can be used '''manually or programmed to run automatically''' at a time relative to the time of the '''booking''', to the '''check-in''' date or to the '''check-out''' date.  


Auto actions have one or more trigger conditions and one or more actions. They can be triggered on a number of different conditions, like property, time or booking related conditions. Auto Actions can  
Auto actions have one or more trigger conditions and one or more actions. They can be triggered on a number of different conditions, like property, time or booking related conditions. Auto Actions can  
Line 30: Line 30:
Using 'Group Keywords' you can refine the triggers in the Auto Action to include/exclude properties if the purpose/message in the Auto action needs to be different.
Using 'Group Keywords' you can refine the triggers in the Auto Action to include/exclude properties if the purpose/message in the Auto action needs to be different.


<span style="color:#019cde; font-size: 150%;“ >{{#fas:info-circle}}  </span>  Auto Actions are  not designed as real-time actions. They are sent in batches at times so we recommend you set your triggers to allow for this.
<span style="color:#019cde; font-size: 150%;“ >{{#fas:info-circle}}  </span>  Auto Actions are  not designed as real-time actions. They are processed in batches so we recommend you set your triggers to allow for this.


== Setup ==
== Setup ==
Line 55: Line 55:


'''Auto sending:'''
'''Auto sending:'''
The auto action batch process runs multiple times per hour.


Auto Action Emails which are sent automatically by the system are sent from the EMail address of the account that created the Auto Action. This is the account set up in in {{#fas:cog}} (SETTINGS) ACCOUNT-> OUTGOING EMAIL.   
Auto Action Emails which are sent automatically by the system are sent from the EMail address of the account that created the Auto Action. This is the account set up in in {{#fas:cog}} (SETTINGS) ACCOUNT-> OUTGOING EMAIL.   
Line 107: Line 105:
'''Time'''  
'''Time'''  


"Trigger Time" defines when the action is allowed to start.  Once it has started it is allowed to go for the "Time Window" period.  When the "Time Window" period has elapsed the auto action stops.  
"Trigger Time" and "Trigger Event" define when the action is allowed to start.  Once it has started it is allowed to go for the "Time Window" period.  When the "Time Window" period has elapsed the auto action stops.


Both "Trigger Time" and "Time Window" are relative to a "Trigger Event"  i.e. check-in, check-out, time of booking.
Both "Trigger Time" and "Time Window" are relative to a "Trigger Event"  i.e. check-in, check-out, time of booking.
Line 181: Line 179:
=== Booking Info ===
=== Booking Info ===
Set up auto actions which automatically add or remove info codes. This is good practice for reporting and also to trigger/exclude bookings from other auto actions.
Set up auto actions which automatically add or remove info codes. This is good practice for reporting and also to trigger/exclude bookings from other auto actions.
Booking info codes can be used to 'sequence' your auto actions.
For example, you have an auto action that sends a message to the guest, but only after another action has already triggered.
Consider the auto action to add a pending payment to a booking for the Security deposit authorisation, this should only be triggered when the Booking info code = STRIPEPAYMENT or CARDTOSTRIPE, both confirm the guest credit card is in the booking.


=== Invoice ===
=== Invoice ===
Line 197: Line 201:
=== Webhook ===
=== Webhook ===
Create auto actions which trigger a web hook when the trigger conditions are met.
Create auto actions which trigger a web hook when the trigger conditions are met.
== Same day/Near term bookings ==
With Same day/Near term bookings, consider the actions/messages you want to trigger with your auto actions.
If you have messages/emails that need to send to your guest at various points before they arrive at your property, then for Same day/Near term bookings, you should consider consolidating the information and sending one message/email.
In the Trigger tab of the auto action, 'Between booking and check-in' can be used to manage which bookings the action can be triggered on.
===Example 1 - Same day booking ===
Trigger tab:
*Trigger Event = Booking
*Trigger Time = Immediate
*Between Booking and Check in = 0 and 0 (same day).
For your other auto actions, set the Between Booking and Check in = 1 and 999, then they will not trigger on same day bookings.
===Example 2 - Near term booking ===
If your business process is to send a confirmation message at the time of booking, then the check-in instructions 2 days before arrival, then for same day bookings, you can use 1 auto action.
Trigger tab:
*Trigger Event = Booking
*Trigger Time = Immediate
*Between Booking and Check in = 0 and 2 (Near term).
Message tab: consolidate the message from your standard Confirmation message and check-in instructions.
For your other auto actions, set the Between Booking and Check in = 3 and 999, then they will not trigger on Near term bookings.


== Multiple Properties ==
== Multiple Properties ==
Line 285: Line 316:
For example a trigger that tests all bookings from booking time for 1 year will test many bookings while a trigger that tests only the 7 days before check-in will test less bookings and perform faster.
For example a trigger that tests all bookings from booking time for 1 year will test many bookings while a trigger that tests only the 7 days before check-in will test less bookings and perform faster.


The test tab of the auto action has a button that will show you how many and which bookings are being tested by the auto action.
The '''test tab''' of the auto action has a button that will show you how many and which bookings are being tested by the auto action. The list may include booking that will not trigger the auto action.  
 
To check if the booking meets all the rules, enter the booking number and test if the auto action would trigger on that booking with some diagnostics information shown to help trouble shooting.
It is also possible to specify a booking number and test if the auto action would trigger on that booking with some diagnostics information shown to help trouble shooting.
Alternatively open the booking and go to the Mail & Action tab, then search for the auto action id, check the details in the Status column.  


'''Optimising your auto actions''' You can trigger multiple actions in one auto action,  
'''Optimising your auto actions''' You can trigger multiple actions in one auto action,  
Line 328: Line 359:
  If you have sub accounts and need an auto action to be used across multiple accounts/properties, then create the auto action at the Master Account Level and set Property = 'All visible in account' and ensure the Master account has access to the properties.
  If you have sub accounts and need an auto action to be used across multiple accounts/properties, then create the auto action at the Master Account Level and set Property = 'All visible in account' and ensure the Master account has access to the properties.


== Examples ==
== Use Cases ==


=== Send Emails/Message/SMS to guests ===
=== Guest Management ===
{| class="wikitable"
! scope="col"| Guest Management
! scope="col"| Link to Auto Action example
|-


<span style="color:#019cde; font-size: 150%;“ >{{#fas:info-circle}}  </span>  Message API messages will be shown in the message tab of the booking and in the Channel Message centre. Currently this is only available for Booking.com and Airbnb.
|You want to send a confirmation message to bookings received from OTAs/Channels
|[[Auto_Actions#Email_confirmation_for_channel_bookings_-_Select_from_the_predefined_template|Send Confirmation message to Channel bookings]]
|-


<div class="mw-collapsible mw-collapsed">
|You want to send a booking registration form (PDF) to your guests so they can complete all guest details
<div  class="headline-collapse" >
|[[Auto_Actions#Send_Email_with_Booking_Registration_Form_-_PDF_attachment|Send an email with Booking registration document (PDF)]]
====Send an Email to the guest when the status of a booking changes to "Cancelled"====
|-
</div>
<div class="mw-collapsible-content">


'''Trigger tab:'''
|Send a confirmation message to the guest when a payment has been received
|[[Auto_Actions#Send_an_Email_to_the_guest_when_a_payment_is_made|Send email/message to confirm receipt of a payment]]
|-


Time:
|You want to send an Invoice (PDF) to the guest after checkout
*Trigger Event = Check-in
|[[Auto_Actions#Send_invoice_after_check-out_-_PDF_attachment_-_Select_from_the_predefined_template|Send an invoice to the guest after checkout]]
*Trigger Time = -365
|-
*Trigger Window = 365


Booking Source
|You want to send an email to the guest confirming their booking has been cancelled
*Booking Source = All (for example)
|[[Auto_Actions#Send_an_Email_to_the_guest_when_the_status_of_a_booking_changes_to_.22Cancelled.22|Send Cancellation notice to the guest]]
|-


Booking Conditions
! scope="col"| Payments
*Booking Status = Cancelled
! scope="col"| Link to Auto Action example
|-


'''Message tab''': For channels using the Message API, then enter the text in the Plain text box, for emails enter the text in the HTML box.
|You want to send a payment Request to your guests for all bookings
|[[Auto_Actions#Send_a_Request_for_payment_to_your_guests_for_all_bookings|Send a payment request for all bookings]]
|-


*Send Message = Booking API/Smart Email
|You want to send a Request for payment to your guests after the booking has been created
|[[Auto_Actions#Send_a_Request_for_payment_to_your_guests_XX_days_after_booking|Send a payment request after the booking]]
|-
 
|You want to send a Request for payment to your guests XX days BEFORE CHECK-IN
|[[Auto_Actions#Send_a_Request_for_payment_to_your_guests_XX_days_before_check-in|Send a payment request for payment before checkin]]
|-
 
|STRIPE - Send a Request to 'Authorise' a Security deposit from your guests before check-in
|[[Auto_Actions#Send_a_Request_to_.27Capture.27_a_Security_deposit_from_your_guests_XX_days_before_check-in_-_with_Stripe|Authorise a Security deposit on the Guest credit card]]
|-
 
|STRIPE - The guest payment has failed, send an email to the guest with the details.
|[[Auto_Actions#Send_an_email_to_the_guest_email_address_when_a_payment_FAILS_at_Stripe|Send an email when the guest payment has failed]]
|-
 
|STRIPE - The guest's credit card as it will expire before checkin, send a request so they can update their details.
|[[Auto_Actions#Send_a_Request_to_update_the_guest.27s_credit_card_as_it_will_expire_before_checkin|Send a request to update their credit card details]]
|-
 
! scope="col"| Check-in Details
! scope="col"| Link to Auto Action example
|-
 
|You want to send an Email with access instructions and a key code 1 day before check-in (Self Checkin)
|[[Auto_Actions#Send_an_Email_with_a_key_code_for_a_specific_unit_one_day_before_check-in_.28Self_Checkin.29|Send access details to your guest prior to arrival]]
|-
 
|You want to send Email to guests with check-in details before Check-in - Fully paid
|[[Auto_Actions#Send_Email_to_guests_with_check-in_details_2_days_before_Check-in.2C_booking_paid.2Fno_outstanding_balance|Send access details as booking is fully paid]]
|-
 
|You want to send Email to guests with check-in details before Check-in - Security Deposit Authorised at Stripe
|[[Auto_Actions#Send_Email_to_guests_with_check-in_details_2_days_before_Check-in.2C_Security_Deposit_Authorised_at_Stripe|Send access details as Security deposit authorised at Stripe]]
|-
 
|}
 
== Examples ==
 
=== Send Emails/Message/SMS to guests ===
 
<span style="color:#019cde; font-size: 150%;“ >{{#fas:info-circle}}  </span>  Message API messages will be shown in the message tab of the booking and in the Channel Message centre. Currently this is only available for Booking.com, Airbnb, Expedia and VRBO.
 
<div class="mw-collapsible mw-collapsed">
<div  class="headline-collapse" >
====Send an Email to the guest when the status of a booking changes to  "Cancelled"====
</div>
<div class="mw-collapsible-content">
 
'''Trigger tab:'''
 
Time:
*Trigger Event = Check-in
*Trigger Time = -365
*Trigger Window = 365
 
Booking Source
*Booking Source = All (for example)
 
Booking Conditions
*Booking Status = Cancelled
 
'''Message tab''': For channels using the Message API, then enter the text in the Plain text box, for emails enter the text in the HTML box.
 
*Send Message = Booking API/Smart Email


If the "Mail & Actions" tab contains a "real" Email address the message is sent to the guests Email address. If only a masked Email address is available the message sends via the channels API messaging systems if possible.
If the "Mail & Actions" tab contains a "real" Email address the message is sent to the guests Email address. If only a masked Email address is available the message sends via the channels API messaging systems if possible.
Line 429: Line 534:


Time:
Time:
*Trigger Event = Check-in
*Trigger Event = Booking (but not after check-in)
*Trigger Time = -365 days
*Trigger Time = Immediate
*Trigger Window = 355 days
*Trigger Window = 1 day
*Between Booking and Check in = 10 to 999


Booking Conditions:
Booking Conditions:
Line 1,136: Line 1,242:
   
   
Trigger tab:
Trigger tab:
*Trigger Event = After Booking
*Trigger Event = Booking
*Trigger Time = Immediate
*Trigger Time = Immediate
*Trigger Window = 365
*Trigger Window = 365
Line 1,245: Line 1,351:
<div  class="headline-collapse" >
<div  class="headline-collapse" >


====Send Remotelock/Lockstate,  Nuki PIN or Chekin Link 2 days before Check-in (Self Checkin) - ''Select from the predefined template'' ====
====Send Remotelock/Lockstate,  Nuki PIN, TTLOCK or Chekin Link 2 days before Check-in (Self Checkin) - ''Select from the predefined template'' ====
</div>
</div>
<div class="mw-collapsible-content">
<div class="mw-collapsible-content">
Line 1,263: Line 1,369:


Info Codes :-
Info Codes :-
*Info Code = LOCKSTATE_PIN or NUKI_PIN or CHEKIN_URL (select the appropriate Booking Info Code for the service you use)
*Info Code = LOCKSTATE_PIN or NUKI_PIN or CHEKIN_URL or LOCK_PIN (select the appropriate Booking Info Code for the service you use)


'''Messaging tab:''' For channels using the Message API, then enter the text in the Plain text box, for emails enter the text in the HTML box.
'''Messaging tab:''' For channels using the Message API, then enter the text in the Plain text box, for emails enter the text in the HTML box.
Line 1,277: Line 1,383:
*Plain text box - will send to channels using Message API
*Plain text box - will send to channels using Message API


Message Text :- enter the text you wish to send to your guests include URL. Include these template variables - [BOOKINGINFOCODETEXT:LOCKSTATE_PIN] or [BOOKINGINFOCODETEXT:NUKI_PIN] or [BOOKINGINFOCODETEXT:CHEKIN_PIN] see the list of ALL template variables that can be used [[Template_Variables| see here]]
Message Text :- enter the text you wish to send to your guests include URL. Include these template variables - [BOOKINGINFOCODETEXT:LOCKSTATE_PIN] or [BOOKINGINFOCODETEXT:NUKI_PIN] or [BOOKINGINFOCODETEXT:CHEKIN_PIN] ] or [BOOKINGINFOCODETEXT:LOCK_PIN] see the list of ALL template variables that can be used [[Template_Variables| see here]]


*HTML box - Email will be sent
*HTML box - Email will be sent


Email Text :- It is possible to use the same details (URL) as in the Plain Text box above. Include these template variables - [BOOKINGINFOCODETEXT:LOCKSTATE_PIN] or [BOOKINGINFOCODETEXT:NUKI_PIN] or [BOOKINGINFOCODETEXT:CHEKIN_PIN] see the list of ALL template variables that can be used [[Template_Variables| see here]]
Email Text :- It is possible to use the same details (URL) as in the Plain Text box above. Include these template variables - [BOOKINGINFOCODETEXT:LOCKSTATE_PIN] or [BOOKINGINFOCODETEXT:NUKI_PIN] or [BOOKINGINFOCODETEXT:CHEKIN_PIN] or [BOOKINGINFOCODETEXT:LOCK_PIN] see the list of ALL template variables that can be used [[Template_Variables| see here]]


</div>
</div>
Line 2,007: Line 2,113:
   
   
Trigger tab:
Trigger tab:
*Trigger Event = After Booking
*Trigger Event = Booking
*Trigger Time = Immediate
*Trigger Time = Immediate
*Trigger Window = 365
*Trigger Window = 365
Line 2,040: Line 2,146:
   
   
Trigger tab:
Trigger tab:
*Trigger Event = After Booking
*Trigger Event = Booking
*Trigger Time = Immediate
*Trigger Time = Immediate
*Trigger Window = 365
*Trigger Window = 365
Line 2,073: Line 2,179:
   
   
Trigger tab:
Trigger tab:
*Trigger Event = After Booking
*Trigger Event = Booking
*Trigger Time = Immediate
*Trigger Time = Immediate
*Trigger Window = 1 day
*Trigger Window = 1 day
Line 2,175: Line 2,281:
Trigger tab:
Trigger tab:


*Trigger Event = After Booking
*Trigger Event = Booking
*Trigger Time =  immediately
*Trigger Time =  immediately
*Trigger Window = 365
*Trigger Window = 365
Line 2,189: Line 2,295:


<div class="mw-collapsible mw-collapsed">
<div class="mw-collapsible mw-collapsed">
<div  class="headline-collapse" >  
<div  class="headline-collapse" >
 
====Identify bookings with Custom Question ticked/unticked ====
====Identify bookings with Custom Question ticked/unticked ====
</div>
</div>
Line 2,199: Line 2,306:
Trigger tab:
Trigger tab:


*Trigger Event = After Booking
*Trigger Event = Booking
*Trigger Time =  immediately
*Trigger Time =  Immediate
*Trigger Window = 365
*Trigger Window = 365
*Booking Source = All
*Booking Source = All
Line 2,211: Line 2,318:
</div>
</div>
</div>
</div>
===Add invoice items to a booking ===


<div class="mw-collapsible mw-collapsed">
<div class="mw-collapsible mw-collapsed">
<div  class="headline-collapse" >  
<div  class="headline-collapse" >  
====Test if Stripe Authorisation has expired and you need to trigger a new authorisation ====
====Add a fee to all bookings from a channel====
</div>
</div>
<div class="mw-collapsible-content">
<div class="mw-collapsible-content">
Stripe authorisations are dependent on a number of factors including your account type, credit card provider, Stripe rules and the guest bank provider.
Trigger tab:
*Trigger Event = Booking
*Trigger Time = Immediate
*Booking Source = Expedia (for example)


If you have bookings that are longer than the authorisation period, you will need to create multiple authorisations. You can use the details below in an auto action to test the date/value of the text/description of the Booking info code = 'STRIPEAUTHORIZE'
Invoice tab:
*Add Invoice Item = Add new
*Type = Amount
*Description = Cleaning fee (for example) - Template variables can be used.  
*Amount = 50 (for example - the amount of your cleaning fee)
*per = Room
*Period = one time
*VAT = 19% (for example - enter the VAT amount if applicable)


For example you have a booking that is for 14 nights, but the authorisation period is 7 days.  
The fee will be added the next time the auto actions run.  
</div>
</div>


Trigger tab:
<div class="mw-collapsible mw-collapsed">
<div  class="headline-collapse" >


*Trigger Event = Checkin
====Add a fee (Penalty) to all bookings with an Outstanding Balance====
*Trigger Time = + 7 days
*Trigger Window = 365
*Booking Source = All
*Booking Status = All but not cancelled


Booking Conditions
</div>
<div class="mw-collapsible-content">
You want to add a 2.2% fee to all bookings if there is an outstanding balance 2 days prior to checkin.


*Group Booking Trigger = Trigger only Master
Trigger tab:
*Status = All not cancelled
*Invoice Balance= Any
*Minimum Stay = 7
*Maximum Stay = 14


Info Codes
Time :
*Any booking info code = CARDTOSTRIPE, STRIPEAUTHORIZE
*Trigger Event = Checkin
*Exclude Booking Info code = BOOKINGVIRTCARD, EXPEDIACOLLECT, AGODACOLLECT
*Trigger Time = -2 days
*Trigger Window = 2 days


<span style="color: #f3e504; font-size: 150%;" >{{#fas:lightbulb}} </span> If you receive virtual credit cards from the channels, then enter the Booking Info codes to prevent additional pending payments being added to bookings.
Booking Conditions:
*Status = All not Cancelled
*Invoice Balance = Not Zero


Booking Fields
Invoice tab:
*Template Variable = [IF<^[SUBSTR|28|10|[BOOKINGINFOCODETEXT:STRIPEAUTHORIZE]]^[CURRENTDATEYYYY-MM-DD]^yes~no] equal yes
*Type = Amount
*Description = Payment Fee||[INVOICEBALANCE:2.2%]
*Amount = 0 (leave as 0 so the value is set from the calculation in Description field)
*Per = Room
*Period = one time
*VAT = 19% (for example - enter the VAT amount if applicable)


The entry in the info tab of the booking will typically be
The fee will be added the next time the auto actions run.
</div>
</div>


STRIPEAUTHORIZE Authorize 1500.00 EUR until 2024-08-14........
<div class="mw-collapsible mw-collapsed">
<div  class="headline-collapse" >


Check the substring numbers for your specific bookings, the date starts on the 28th char as the amount is 1500.00
====Add a negative value to Direct bookings for Stripe Charges====


Booking tab: Optional
</div>
*Flag Text = Security Deposit Pending Payment (for example)
<div class="mw-collapsible-content">
*Flag Colour = select the colour as this will be visible in the Calendar/Bookings list
You want to add the Stripe fee to all Direct bookings to show total value of booking, i.e. if you want to show the booking value. In this example the Stripe charge will be added as a negative figure. 


Booking Info tab: If you do not require an auto action to send a payment link to the guest for payment/authorisation, then this is optional.
Trigger tab:
*Booking Info Code - REFDEPPP (for example)
*Booking Info Text - Refundable Security Deposit pending payment
Invoice tab:
*Add a Pending Payment to the booking
*Payment Type = Fixed amount
*Description = the text you will see in the "Charges and Payments" tab
*Status = if you use the status function add the status you want to apply to the pending payment (optional)
*Amount = 1500 (enter the value you want to authorise on the guest credit card )
*Payment Rule = Security Deposit (use the payment rule)
*Payment Due = Trigger date
*Payment time = set the time to collect payment
*Invoicee = If you use the "invoicee" function you can select which invoicee the pending payment will be assigned to.


<span style="color: #f3e504; font-size: 150%;" >{{#fas:lightbulb}} </span> If you accept Virtual Credit Cards from the channels, then you will need to send a payment link to either collect the guest credit card to then authorise the Security Deposit on their personnel card OR send a payment link so the guest can authorise the payment on their own credit card, it is not possible to take a Security deposit from a virtual card.
Time :
*Trigger Event = Booking
*Trigger Time = Immediate
*Trigger Window = 1 day


Booking Conditions:
*Status = All not Cancelled


</div>
Booking Source:
</div>
*Booking Source = Direct
 
===Add invoice items to a booking ===
 
<div class="mw-collapsible mw-collapsed">
<div  class="headline-collapse" >
====Add a fee to all bookings from a channel====
</div>
<div class="mw-collapsible-content">
Trigger tab:
*Trigger Event = After Booking
*Trigger Time = Immediate
*Booking Source = Expedia (for example)


Invoice tab:
Invoice tab:
*Add Invoice Item = Add new
*Type = Amount
*Type = Amount
*Description = Cleaning fee (for example) - Template variables can be used.
*Description = Stripe Fee||[INVOICECHARGESNUM:-3%]
*Amount = 50 (for example - the amount of your cleaning fee)
*Amount = 0 (leave as 0 so the value is set from the calculation in the Description field)
*per = Room
*Per = Room
*Period = one time
*Period = one time
*VAT = 19% (for example - enter the VAT amount if applicable)
*VAT = 19% (for example - enter the VAT amount if applicable)


The fee will be added the next time the auto actions run.  
The fee/charge will be added the next time the auto actions run.  
</div>
</div>
</div>
</div>
Line 2,307: Line 2,413:
<div  class="headline-collapse" >
<div  class="headline-collapse" >


====Add a fee (Penalty) to all bookings with an Outstanding Balance====
====Add a new charge - City tax, calculated from number of nights/adults in a booking ====


</div>
</div>
<div class="mw-collapsible-content">
<div class="mw-collapsible-content">
You want to add a 2.2% fee to all bookings if there is an outstanding balance 2 days prior to checkin.
 
Some locations have set a cap on the Tourist tax based on the number of adults, upto a max 7 nights, you can use the calculation below to test the values and apply the appropriate charge or the cap.
 
This example will calculate the Price, testing if the 'number of nights' *'number of adults' *2 *1.03 is greater than 7 (nights) *'number of adults' *1.03
 
Then set the value = 7* number of adults *2 *1.03
ELSE set the value = 'number of nights' * 'number of adults' *2 *1.03
 
Special characters ^~ are required rather than :| as the | can be used as a separator in the Description field to set the Description|Status|Price|VAT


Trigger tab:
Trigger tab:


Time :
Time :
*Trigger Event = Checkin
*Trigger Event = Booking
*Trigger Time = -2 days
*Trigger Time = Immediate
*Trigger Window = 2 days
*Trigger Window = 1 day


Booking Conditions:
Booking Conditions:
*Status = All not Cancelled  
*Status = All not Cancelled  
*Invoice Balance = Not Zero
 
Booking Source:
*Booking Source = Direct


Invoice tab:
Invoice tab:
*Type = Amount
*Type = Amount
*Description = Payment Fee||[INVOICEBALANCE:2.2%]
*Description = Tourist Tax|Stayfee|[IF>^[NUMNIGHTS][*][NUMADULT][*]2[*]1.03^7[*][NUMADULT][*]2[*]1.03^7[*][NUMADULT][*]2[*]1.03~[NUMNIGHTS][*][NUMADULT][*]2[*]1.03]
*Amount = 0 (leave as 0 so the value is set from the calculation in Description field)
*Amount = 0 (leave as 0 so the value is set from the calculation in the Description field)
*Per = Room
*Per = Room
*Period = one time
*Period = one time
*VAT = 19% (for example - enter the VAT amount if applicable)
*VAT = 19% (for example - enter the VAT amount if applicable)


The fee will be added the next time the auto actions run.  
The fee/charge will be added the next time the auto actions run.  
</div>
</div>
 
<div class="mw-collapsible mw-collapsed">
<div  class="headline-collapse" >
 
====Add a negative value to Direct bookings for Stripe Charges====
 
</div>
<div class="mw-collapsible-content">
You want to add the Stripe fee to all Direct bookings to show total value of booking, i.e. if you want to show the booking value. In this example the Stripe charge will be added as a negative figure. 
 
Trigger tab:
 
Time :
*Trigger Event = Booking
*Trigger Time = Immediate
*Trigger Window = 1 day
 
Booking Conditions:
*Status = All not Cancelled


Booking Source:
*Booking Source = Direct
Invoice tab:
*Type = Amount
*Description = Stripe Fee||[INVOICECHARGESNUM:-3%]
*Amount = 0 (leave as 0 so the value is set from the calculation in the Description field)
*Per = Room
*Period = one time
*VAT = 19% (for example - enter the VAT amount if applicable)
The fee/charge will be added the next time the auto actions run.
</div>
</div>
</div>
</div>
Line 2,382: Line 2,465:


Trigger tab:
Trigger tab:
*Trigger Event = After Booking
*Trigger Event = Booking
*Trigger Time = Immediate
*Trigger Time = Immediate
*Booking Source = Expedia (for example)
*Booking Source = Expedia (for example)
Line 2,407: Line 2,490:


Trigger tab:
Trigger tab:
*Trigger Event = After Booking
*Trigger Event = Booking
*Trigger Time = Immediate
*Trigger Time = Immediate
*Time Window = 365
*Time Window = 365
Line 2,428: Line 2,511:
</div>
</div>


===Payments/Pending Payments===
<div class="mw-collapsible mw-collapsed">
<div  class="headline-collapse" >
 
==== Update VAT value for Charge item - City Tax (for example) ====


<div class="mw-collapsible mw-collapsed">
<div  class="headline-collapse" >
====Add a pending payment====
</div>
</div>
<div class="mw-collapsible-content">
<div class="mw-collapsible-content">
Trigger tab:
*Trigger Event = After Booking or Before Check-in
*Trigger Time = set the time you want to collect the payment
*Booking Source =All (for example, you can also set different rules for different channels)
*Group Booking Trigger = Trigger only Master (this will trigger on individual bookings and Master booking if a group)


Booking Info tab: Optional
You need to change the VAT value for specific items (City tax) in the Charges & Payments tab of the booking.
Add a booking info tab for information and reporting
*Flag Text = PendingPayment (for example)
*Flag Colour = select the colour as this will be visible in the Calendar/Bookings list


Booking tab: Optional
Trigger tab:
*Booking Info Code = PENDPAY
*Trigger Event = Booking
*Booking Info Text = Pending payment added
*Trigger Time = Immediate
*Time Window = 365
*Booking Source = Expedia (for example)


Invoice tab:
Invoice tab:
*Payment Type = select on what the payment is calculated (Percent of Balance due OR Group balance if you receive Group bookings)
*Add Invoice Item = Update Only
*Description = the text you will see in the "Charges and Payments" tab
*Type = Change VAT
*Status = if you use the status function add the status you want to apply to the pending payment (optional)
*Description = City Tax (this needs to be an exact match to the charge item description)  
*Amount = enter the amount or percentage you want to collect
*Amount = 0
*Payment Rule = use auto or manual  - if you have set up payment rules in {{#fas:cog}} (SETTINGS) GUEST MANAGEMENT->PAYMENT COLLECTION they will be available here
*VAT = 12 (for example)
*Payment Due = Set when the payment is due
*Per = Per Person
*Period = One time
*Invoicee = Ignore


</div>
</div>


Create a Payment Rule to collect a payments when bookings are not cancelled.
<div class="mw-collapsible mw-collapsed">
<div  class="headline-collapse" >


Go to Settings > Payments > Payment Rules
==== Update VAT value for the Accommodation fee (first item in the Charges & Payments tab) ====
 
</div>
<div class="mw-collapsible-content">


Payment Rule :
You need to change the VAT value for the Accommodation fee usually the first line the Charges & Payments tab of the booking.


Name = Enter your title - Not Cancelled (for example)
Trigger tab:
Action = Auto
*Trigger Event = Booking
*Trigger Time = Immediate
*Time Window = 365
*Booking Source = ALL (or select a specific channel)


Payment Trigger :
Invoice tab:
*Add Invoice Item = Update Only
*Type = Change VAT
*Description = [ROOMNAME1] [FIRSTNIGHT] - [LEAVINGDAY][NOCONVERT]


*Booking Status = All not cancelled
Check the Description in the Charges & Payments tab for the Accommodation charge usually [ROOMNAME1] [FIRSTNIGHT] - [LEAVINGDAY]
*Any Booking Info Code = optional
*All Booking Info Codes = optional
*Exclude Booking Info Code = optional (can exclude Virtual Credit cards, find the Booking info code in the booking)


Payment Action :
To update this value you also need [NOCONVERT] so the template variable is used rather than the value.


*Capture = Yes - immediately charged (Capture=Yes)
*Amount = 0
*Add info code on success = add a Booking Info item to the booking on success
*VAT = 12 (for example)
*Add info code on failure = add a Booking Info item to the booking on failure
*Per = Per Person
*Period = One time
*Invoicee = Ignore


</div>
</div>
</div>
</div>
===Payments/Pending Payments===


<div class="mw-collapsible mw-collapsed">
<div class="mw-collapsible mw-collapsed">
<div  class="headline-collapse" >
<div  class="headline-collapse" >  
 
====Add a pending payment====
====Add a pending payment - Set the Security Deposit value based on the price of the booking, using a calculation ====
</div>
</div>
<div class="mw-collapsible-content">
<div class="mw-collapsible-content">
Trigger tab:
Trigger tab:
*Trigger Event = After Booking or Before Check-in
*Trigger Event = Booking or Booking (but not after Check-in)
*Trigger Time = set the time you want to collect the payment
*Trigger Time = set the time you want to collect the payment
*Booking Source =All (for example, you can also set different rules for different channels)
*Booking Source =All (for example, you can also set different rules for different channels)
*Group Booking Trigger = Trigger only Master (this will trigger on individual bookings and Master booking if a group)


Booking tab: Optional
Booking Info tab: Optional
Add a booking info tab for information and reporting
*Flag Text = PendingPayment (for example)
*Flag Text = PendingPayment (for example)
*Flag Colour = select the colour as this will be visible in the Calendar/Bookings list
*Flag Colour = select the colour as this will be visible in the Calendar/Bookings list


Booking Info tab: Optional
Booking tab: Optional
Add a booking info tab for information and reporting
*Booking Info Code = PENDPAY
*Booking Info Code = PENDPAY
*Booking Info Text = Pending payment added
*Booking Info Text = Pending payment added


Invoice tab:
Invoice tab:
*Payment Type = fixed value
*Payment Type = select on what the payment is calculated (Percent of Balance due OR Group balance if you receive Group bookings)
*Description = Security Deposit||[IF<=:[INVOICEFIRSTITEMNUM]:800:200|[INVOICEFIRSTITEMNUM][/.0]4]
*Description = the text you will see in the "Charges and Payments" tab
(Security Deposit is the description, then 2 | symbol, then the calculation for the 'Amount' to be set.)
This calculation, tests if the first invoice item value (usually the Accommodation value) is greater than or = 800 if so set the Security Deposit Amount = 1 quarter of the first invoice item value, otherwise set = 200.
 
<span class="" style="color: #f3e504; font-size: 150%;" >{{#fas:lightbulb}} </span>  <span style="font-weight: bold;" >Tip</span> A price value for the invoice item can be specified after a second pipe (|) symbol, this can be used to calculate a price using template variables. If the price value in the description field is zero or absent, the numeric value from the amount field will be used.
 
*Status = if you use the status function add the status you want to apply to the pending payment (optional)
*Status = if you use the status function add the status you want to apply to the pending payment (optional)
*Amount = 0
*Amount = enter the amount or percentage you want to collect
*Payment Rule = use auto or manual  - if you have set up payment rules in {{#fas:cog}} (SETTINGS) Payments > Payment Rules they will be available here  
*Payment Rule = use auto or manual  - if you have set up payment rules in {{#fas:cog}} (SETTINGS) GUEST MANAGEMENT> PAYMENTS they will be available here  
*Payment Due = Set when the payment is due
*Payment Due = Set when the payment is due


Line 2,547: Line 2,633:
<div  class="headline-collapse" >
<div  class="headline-collapse" >


====Collect outstanding booking balance 3 days prior to arrival( Credit card details were collected at time of booking)====
====Add a pending payment - Set the Security Deposit value based on the price of the booking, using a calculation ====
</div>
</div>
<div class="mw-collapsible-content">
<div class="mw-collapsible-content">
Trigger tab:
*Trigger Event = Booking or Booking (but not after Check-in)
*Trigger Time = set the time you want to collect the payment
*Booking Source =All (for example, you can also set different rules for different channels)


''''Create a Payment Rule  (Optional)''''
Booking tab: Optional
*Flag Text = PendingPayment (for example)
*Flag Colour = select the colour as this will be visible in the Calendar/Bookings list


Standard payment rules in the system are Auto & Manual, you can create additional rules for the collection of outstanding payments, you can control the collection of payments if the booking status is changed, for example the booking is cancelled before the final payment is due to be collected.
Booking Info tab: Optional
Add a booking info tab for information and reporting
*Booking Info Code = PENDPAY
*Booking Info Text = Pending payment added


Go to {{#fas:cog}} (SETTINGSPAYMENTS > PAYMENT RULES
Invoice tab:
*Payment Type = fixed value
*Description = Security Deposit||[IF<=:[INVOICEFIRSTITEMNUM]:800:200|[INVOICEFIRSTITEMNUM][/.0]4]
(Security Deposit is the description, then 2 | symbol, then the calculation for the 'Amount' to be set.)
   
This calculation, tests if the first invoice item value (usually the Accommodation value) is greater than or = 800 if so set the Security Deposit Amount = 1 quarter of the first invoice item value, otherwise set = 200.


Create a Payment Rule to collect payments if bookings are not cancelled.
<span class="" style="color: #f3e504; font-size: 150%;" >{{#fas:lightbulb}} </span>  <span style="font-weight: bold;" >Tip</span> A price value for the invoice item can be specified after a second pipe (|) symbol, this can be used to calculate a price using template variables. If the price value in the description field is zero or absent, the numeric value from the amount field will be used.


Click '''Create New Payment Rule''' :
*Status = if you use the status function add the status you want to apply to the pending payment (optional)
*Amount = 0
*Payment Rule = use auto or manual  - if you have set up payment rules in {{#fas:cog}} (SETTINGS) PAYMENTS > PAYMENT RULES they will be available here
*Payment Due = Set when the payment is due
 
 
Create a Payment Rule to collect a payments when bookings are not cancelled.
 
Go to Settings > Payments > Payment Rules


Payment Rule:
Payment Rule :
*Name = Enter your title - Not Cancelled (for example)  
 
*Action = Auto
Name = Enter your title - Not Cancelled (for example)
Action = Auto


Payment Trigger :
Payment Trigger :
*Booking Status = All not cancelled
*Booking Status = All not cancelled
*Any Booking Info Code (optional)
*Any Booking Info Code = optional
*All Booking Info Codes (optional)
*All Booking Info Codes = optional
*Exclude Booking Info Code = optional (can exclude Virtual Credit cards, find the Booking info code in the booking)
*Exclude Booking Info Code = optional (can exclude Virtual Credit cards, find the Booking info code in the booking)


Payment Action :
Payment Action :
*Funding Source = Guest card only
 
*Payment value adjustment = Limit to group booking balance
*Capture = Yes - immediately charged (Capture=Yes)
*Capture = Yes - immediately charged (Capture=Yes)
*Add info code on success = add a Booking Info item to the booking on success
*Add info code on success = add a Booking Info item to the booking on success
*Add info code on failure = add a Booking Info item to the booking on failure
*Add info code on failure = add a Booking Info item to the booking on failure


Prevent Auto Payment :
</div>
*Prevent payment if booking status = Cancelled
</div>
*Prevent payment after check-out (days) = 7 (default)
*Prevent payment action = Set Manual


<div class="mw-collapsible mw-collapsed">
<div  class="headline-collapse" >


'''Create Auto Actions '''
====Collect outstanding booking balance 3 days prior to arrival( Credit card details were collected at time of booking)====
</div>
<div class="mw-collapsible-content">


Collect the outstanding balance for bookings created via your booking page.
''''Create a Payment Rule  (Optional)''''


Go to {{#fas:cog}} (SETTINGS)  GUEST MANAGEMENT > AUTO ACTIONS and click '''Create New Action''' to create them.
Standard payment rules in the system are Auto & Manual, you can create additional rules for the collection of outstanding payments, you can control the collection of payments if the booking status is changed, for example the booking is cancelled before the final payment is due to be collected.
 
Go to {{#fas:cog}} (SETTINGS)  PAYMENTS > PAYMENT RULES
 
Create a Payment Rule to collect payments if bookings are not cancelled.
 
Click '''Create New Payment Rule''' :
 
Payment Rule:
*Name = Enter your title - Not Cancelled (for example)
*Action = Auto
 
Payment Trigger :
*Booking Status = All not cancelled
*Any Booking Info Code (optional)
*All Booking Info Codes (optional)
*Exclude Booking Info Code = optional (can exclude Virtual Credit cards, find the Booking info code in the booking)
 
Payment Action :
*Funding Source = Guest card only
*Payment value adjustment = Limit to group booking balance
*Capture = Yes - immediately charged (Capture=Yes)
*Add info code on success = add a Booking Info item to the booking on success
*Add info code on failure = add a Booking Info item to the booking on failure
 
Prevent Auto Payment :
*Prevent payment if booking status = Cancelled
*Prevent payment after check-out (days) = 7 (default)
*Prevent payment action = Set Manual
 
 
'''Create Auto Actions '''
 
Collect the outstanding balance for bookings created via your booking page.
 
Go to {{#fas:cog}} (SETTINGS)  GUEST MANAGEMENT > AUTO ACTIONS and click '''Create New Action''' to create them.


'''Collect outstanding balance for direct bookings'''
'''Collect outstanding balance for direct bookings'''
Line 2,639: Line 2,785:


Trigger tab:
Trigger tab:
*Trigger Event = After Booking  
*Trigger Event = Booking  
*Trigger Time = immediate
*Trigger Time = immediate
*Booking Source =All (for example, you can also set different rules for different channels)
*Booking Source =All (for example, you can also set different rules for different channels)
Line 2,685: Line 2,831:
<div class="mw-collapsible-content">
<div class="mw-collapsible-content">
Trigger tab:
Trigger tab:
*Trigger Event = After Booking
*Trigger Event = Booking
*Trigger Time = Immediate
*Trigger Time = Immediate
*Trigger Window = 365
*Trigger Window = 365
Line 2,693: Line 2,839:


Booking Info tab:
Booking Info tab:
*Booking Info Code : Enter the preset code for the icon or info code which you have created in {{#fas:cog}} (SETTINGS) ACCOUNT->PREFERENCES.
*Booking Info Code : Enter the preset code for the icon or info code which you have created in {{#fas:cog}} (SETTINGS) ACCOUNT > PREFERENCES.
*Booking Info Text : Enter the text you wish to show
*Booking Info Text : Enter the text you wish to sho


Process Template Variables : When created
Process Template Variables : When created
Line 2,732: Line 2,878:
<div class="mw-collapsible-content">
<div class="mw-collapsible-content">
Trigger tab:
Trigger tab:
*Trigger Event = After Booking or Before Check-in
*Trigger Event = Booking or Booking (but not after Check-in)
*Trigger Time = set the time you want to add the pending payment to the booking
*Trigger Time = set the time you want to add the pending payment to the booking
*Booking Source =All (for example, you can also set different rules for different channels)
*Booking Source =All (for example, you can also set different rules for different channels)
Line 2,748: Line 2,894:
*Status = if you use the status function add the status you want to apply to the pending payment (optional)
*Status = if you use the status function add the status you want to apply to the pending payment (optional)
*Amount = enter the amount or percentage you want to collect
*Amount = enter the amount or percentage you want to collect
*Payment Rule = Manual  - if you have set up payment rules in {{#fas:cog}} (SETTINGS) GUEST MANAGEMENT->PAYMENT COLLECTION they will be available here  
*Payment Rule = Manual  - if you have set up payment rules in {{#fas:cog}} (SETTINGS) PAYMENTS > PAYMENT RULES they will be available here  
*Payment Due = Set when the payment is due
*Payment Due = Set when the payment is due


Line 2,791: Line 2,937:


Booking Fields
Booking Fields
*Template Variable = [IF<^[SUBSTR|28|10|[BOOKINGINFOCODETEXT:STRIPEAUTHORIZE]]^[CURRENTDATEYYYY-MM-DD]^yes~no] equal yes
*Template Variable = [IF<^[AUTHORIZEUNTIL{%Y-%m-%d}]^[CURRENTDATEYYYY-MM-DD]^yes~no] equal yes


The entry in the info tab of the booking will typically be  
The entry in the info tab of the booking will typically be  
Line 2,851: Line 2,997:
<div class="mw-collapsible-content">
<div class="mw-collapsible-content">
Trigger tab:
Trigger tab:
*Trigger Event = After Booking
*Trigger Event = Booking
*Trigger Time = Immediate
*Trigger Time = Immediate
*Booking Source = Booking.com (for example)
*Booking Source = Booking.com (for example)
Line 2,872: Line 3,018:
<div class="mw-collapsible-content">
<div class="mw-collapsible-content">
Trigger tab:
Trigger tab:
*Trigger Event = After Booking
*Trigger Event = Booking
*Trigger Time = Immediate
*Trigger Time = Immediate
*Booking Source = Booking.com (for example)
*Booking Source = Booking.com (for example)
Line 2,931: Line 3,077:
<div class="mw-collapsible-content">
<div class="mw-collapsible-content">
Trigger tab:
Trigger tab:
*Trigger Event = After Booking
*Trigger Event = Booking
*Trigger Time = Immediate
*Trigger Time = Immediate
*Trigger Window = 365
*Trigger Window = 365
Line 3,072: Line 3,218:
*Flag Text = Failed CC reported to Booking.com  
*Flag Text = Failed CC reported to Booking.com  
*Flag Colour - choose the flag colour
*Flag Colour - choose the flag colour
</div>
</div>
<div class="mw-collapsible mw-collapsed">
<div  class="headline-collapse" >
====Apply a flag when booking has been Checked-in====
</div>
<div class="mw-collapsible-content">
Trigger tab:
*Trigger Event = Check-in
*Trigger Time = Immediate
*Trigger Window = 1 day
*Booking Source = All
*Booking Status = All but not cancelled
*Any booking info code = CHECKIN
Booking tab:
*Execution = One time only
*Flag Text = Guest checked in (or any text you want to see)
*Flag Colour - choose the flag colour
</div>
</div>
</div>
</div>
Line 3,114: Line 3,284:
<div  class="headline-collapse" >
<div  class="headline-collapse" >


==== Change the status of all bookings which have been imported from Ical to "Request" ====
==== Change the booking status from Inquiry to Confirmed when the payment is made ====
</div>
</div>
<div class="mw-collapsible-content">
<div class="mw-collapsible-content">
Trigger tab:
Trigger tab
*Trigger Event = After Booking
*Trigger Event = Booking
*Trigger Time = Immediate
*Trigger Time = 365 days
*Booking Source = Ical Import (1, 2, 3)
*Booking Status = Inquiry
*Booking Source = ALL
*Invoice Balance = Any payment Made


Booking tab:
Booking tab:
*Execution = One time only
*Execution = One time only
*Booking Status = Request
*Booking Status = Cancelled


Booking changes are applied before the mail is sent.
</div>
</div>
</div>
</div>
Line 3,133: Line 3,304:
<div  class="headline-collapse" >
<div  class="headline-collapse" >


==== Change Room Unit Status when guest checks out ====
==== Change the status of all bookings which have been imported from Ical to "Request" ====
</div>
</div>
<div class="mw-collapsible-content">
<div class="mw-collapsible-content">
Trigger tab
Trigger tab:
*Trigger Event = Check-out
*Trigger Event = Booking
*Trigger Time = Immediate
*Booking Source = Ical Import (1, 2, 3)
 
Booking tab:
*Execution = One time only
*Booking Status = Request
 
Booking changes are applied before the mail is sent.
</div>
</div>
 
<div class="mw-collapsible mw-collapsed">
<div  class="headline-collapse" >
 
==== Change Room Unit Status when guest checks out ====
</div>
<div class="mw-collapsible-content">
Trigger tab
*Trigger Event = Check-out
*Trigger Time = Immediate
*Trigger Time = Immediate
*Trigger Window = 1 day
*Trigger Window = 1 day
Line 3,162: Line 3,352:
  You need two keys to use our API JSON functions - one for the API itself and one for the property. The keys have to consist of 16 characters of your choosing.<br>
  You need two keys to use our API JSON functions - one for the API itself and one for the property. The keys have to consist of 16 characters of your choosing.<br>
  '''API key:'''
  '''API key:'''
*{{#fas:cog}} (SETTINGS) ACCOUNT -> ACCOUNT->ACCESS  "API Key 1"
*{{#fas:cog}} (SETTINGS) ACCOUNT > ACCOUNT >ACCESS  "API Key 1"
*API Key = my_very_secret_api_key
*API Key = my_very_secret_api_key
*API Key Access = allow any IP
*API Key Access = allow any IP
Line 3,203: Line 3,393:
You need two keys to use our API JSON functions - one for the API itself and one for the property. The keys have to consist of 16 characters of your choosing.<br>
You need two keys to use our API JSON functions - one for the API itself and one for the property. The keys have to consist of 16 characters of your choosing.<br>
'''API key:'''
'''API key:'''
*{{#fas:cog}} (SETTINGS) ACCOUNT -> ACCOUNT->ACCESS  "API Key 1"
*{{#fas:cog}} (SETTINGS) ACCOUNT > ACCOUNT > ACCESS  "API Key 1"
*API Key = my_very_secret_api_key
*API Key = my_very_secret_api_key
*API Key Access = allow any IP
*API Key Access = allow any IP
Line 3,210: Line 3,400:
*Property Access = Owned by this account only
*Property Access = Owned by this account only
*'''Property key:'''
*'''Property key:'''
*{{#fas:cog}} (SETTINGS) PROPERTIES > ACCESS> propKey = secret_key_for_prop_XXXXXX
*{{#fas:cog}} (SETTINGS) PROPERTIES > ACCESS > propKey = secret_key_for_prop_XXXXXX


Set the triggers you need, for example:
Set the triggers you need, for example:
Line 3,285: Line 3,475:


}
}
</div>
</div>
<div class="mw-collapsible mw-collapsed">
<div  class="headline-collapse" >
====Use webhook to switch a Shelly on====
</div>
<div class="mw-collapsible-content">
Here is a simple PHP script with which you can switch a Shelly via an autoaction in beds24.
You can use this to switch on a string of lights on the day of arrival or to charge the night storage heating if a certain info code is set in the booking on the day before arrival.
Create an auto action and enter the PHP script ‘beds24-shelly-steuern.php’ under ‘Webhook’. The parameters for the control are transferred under ‘Data in body’:
id:b0b21c1xxxxx
shelly_server:shelly-123-eu.shelly.cloud
auth_key:ABCDEFGHIJKLMNPQRSTUVWXYZABCDEFGHIJKLMNPQRSTUVWXYZABCDEFGHIJKLMNPQRSTUVWXYZ
shelly_url:device/relay/control
parameter:channel=0&turn=on
email_result:[email protected]
remarks:Text, z.B. mit Template Variablen [GUESTFULLNAME] und [BOOKID]
</div>
</div>
<div class="mw-collapsible mw-collapsed">
<div  class="headline-collapse" >
====V2 version of the code for Shelly ====
</div>
<div class="mw-collapsible-content">
Here is the second version v2 of the PHP script to switch on a Shelly device via an autoaction.
Now you can also store the device IDs in the script instead of adding them to the body parameters. This makes it possible to switch a Shelly device with a single autoaction. The device ID is then determined via the template variable [INTERNALROOMNAME].
Code: Select all
<?php
/*
* - Anschalten der Lichterkette aus beds24 mit einem PHP Skript über die Shelly Cloud -
* Version 2 vom 10.12.2024 - mehrere Devices im Array im Skript möglich
*
* https://domainname.de/scripte/beds24-shelly-steuern-v2.php
*
* curl -X POST https://shelly-123-eu.shelly.cloud/device/relay/control -d "channel=0&turn=on&id=b0b21c123456&auth_key=abcdefghijklmnopqrstuvwxyz1234567890"
* Einstellungen in beds24
* - in einer Autoaction unter 'Webhook' das Script eintragen: https://domainname.de/pfad_zum_script/beds24-shelly-steuern-v2.php
* - alternativ wenn Geräte-Id überINTERNALROOMNAME im Skript selbst: https://domainname.de/pfad_zum_script/beds24-shelly-steuern-v2?roomname=[INTERNALROOMNAME]
* - unter 'Daten im Body' die Parameter zur Steuerung eintragen:
* - id:<Shelly Geräte-Id>    ===> alternativ mehrere Geräte-Id im Skript selbst
* - shelly_server:<Shelly Cloud Server>
* - auth_key:<Shelly Cloud-Autorisierungs-Schlüssel>
* - parameter:<Shelly Befehle>
* - email_result:<*optional* e-mail für Empfänger des Schaltergebnisses>
* - remarks:<*optional* beliebige Anmerkungen für E-Mail>
*
* Beispiel:
* id:b0b21c123456
* shelly_server:shelly-123-eu.shelly.cloud
* auth_key:abcdefghijklmnopqrstuvwxyz1234567890
* shelly_url:device/relay/control
* parameter:channel=0&turn=on
* email_result:[email protected]
* remarks:Text, auch mit Template Variablen [GUESTFULLNAME] und [BOOKID]/[INTERNALROOMNAME] möglich
*/
/* ----------------------------------------------------------- */
/* Parameter & Einstellungen */
/* ----------------------------------------------------------- */
/* Shelly Geräte-ID entweder beim Aufruf in beds24 über die 'Daten im Body' übergeben oder hier im Skript eintragen. Wenn im Script, dann beim Aufruf die Templatevariable [INTERNALROOMNAME] mitgeben, über die erfolgt dann die Auswahl hier im Array */
$p_geraete_ids = array (
"chalet" => "e465b8123456",
"fewo" => "b0b21c123456",
"linx" => "e465b8123456"
);
$p_test = false; /* im Testmodus kommen die Parameter direkt aus dem Script statt über beds24 */
/* Body Daten zum direkten Testen d.h. Direktaufruf des Scripts ohne Autoaction */
$test_body = array(  /* zum direkten Aufruf des Scripts die Parameter hier testweise eintragen */
/* https://shelly-api-docs.shelly.cloud/cloud-control-api/communication */
"id" => "xxx",    /* rausnehmen, wenn ids über Array kommen sollen */
"shelly_server" => "shelly-123-eu.shelly.cloud",
"auth_key" => "abcdefghijklmnopqrstuvwxyz1234567890",
"shelly_url" => "device/relay/control",
"parameter" => "channel=0&turn=on",
"email_result" => "[email protected]",
"remarks" => "Text, z.B. mit Template Variablen [GUESTFULLNAME] und [BOOKID]"
);
/* ----------------------------------------------------------- */
/* ab hier normalerweise keine Änderungen mehr vornehmen
/* ----------------------------------------------------------- */
$hf_internalroomname = filter_var($_GET["roomname"], FILTER_SANITIZE_STRING);  /* wenn über ?roomname=[INTERNALROOMNAME] übergeben
/* Body aus Post message lesen und in Variablen $body[keyname] einlesen */
if ($p_test == false ) {
$hf_body = explode( "\n", file_get_contents('php://input') );
$body = array();
foreach ($hf_body as $v) {
list($body_key,$body_value) = explode( ':', $v );
$body[$body_key] = $body_value;
}
}
else {
$body = $test_body; /* im Testmodus Parameter direkt aus dem Script nehmen */
}
ob_start(); /* Bildschirmausgabe buffern */
/* wenn übergeben, dann Geräte-ID aus den body-parametern übernehmen, ansonsten über [INTERNALROOMNAME] ermitteln */
if ( $body["id"]) {                      /* in Body Parameter gesetzt */
$hf_geraete_id = $body["id"];
} else {
$hf_geraete_id = $p_geraete_ids[$hf_internalroomname];    /* Geräte-Id aus Skript Array nehmen */
}
/* Prüfen ob wichtige Argumente übergeben */
if ( isset($body["shelly_server"]) == false ) { echo("Argument shelly_server fehlt, z.B.: shelly_server:servername<br>"); $body["shelly_server"] = "fehlt";}
if ( isset($body["shelly_url"]) == false ) { echo("Argument shelly_url fehlt, z.B. : shelly_url:device/relay/control<br>"); $body["shelly_url"] = "fehlt";}
if ( isset($body["parameter"]) == false ) { echo("Argument parameter fehlt, z.B.: parameter:channel=0&turn=on><br>"); $body["parameter"] = "fehlt";}
if ( isset($body["auth_key"]) == false ) { echo("Argument auth_key fehlt, z.B.: auth_key:abcdefghijklmnopqrstuvwxyz1234567890<br>"); $body["auth_key"] = "fehlt";}
$url = 'https://'.$body["shelly_server"].'/'.trim($body["shelly_url"], " /");
$ch=curl_init();
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); /* Zertifikatswarnung übergehen */
curl_setopt($ch, CURLOPT_SSL_VERIFYSTATUS, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_PROXY_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS,
            $body["parameter"]."&id=".$hf_geraete_id."&auth_key=".$body["auth_key"]);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded'));
curl_setopt($ch, CURLOPT_URL, $url);
$result = curl_exec($ch);
curl_close ($ch);
if ( $body["remarks"] ) {  /* Anmerkungen fürs Protokoll/E-Mail ausgeben */
echo ("<br>".$body["remarks"]."<br>");
};
$output = ob_get_contents(); /* Bildschirmausgabe aus Buffer lesen */
ob_end_clean();
echo $output;
if ( $body["email_result"] ) {
mail($body["email_result"], 'Ergebnis Shelly Skript - Device: '.$hf_geraete_id, $output, 'From: beds24 Shelly Script <'.$body["email_result"].'>');
    echo ("<br>Mail an: ".$body["email_result"]);
}
?>


</div>
</div>