Appointment notification in Google Chat

We will see below an easy way to push the appointment notification in your Google Chat.


First, you must create a new webhook from your Google space settings:



Next, you can get the webhook link.


Then, using an API test application (Postman for example), you have to proceed as follows :

  1. Into the headers, insert your API key (apiKey) and your token :
  2. In the URL field, paste the link below with the ID of the company concerned :
    https://us.agendize.com/api/2.1/scheduling/companies/{{companyId}}/appointments/watch

    Note that the URL part: us.agendize.com, depends on your location or your business plan. You can check it when you are connected to the backoffice by checking the URL address field in your browser.

  3. On the script below, paste your webhook link in the address property value and the event you want to trigger (here, we are looking for a new appointment trigger using the event type: created) and eventually the watcher’s name. Afterwards, get the following data schema :

{
   "address": "https://chat.googleapis.com/v1/spaces/......",
   "events": [
       "created"
   ],
   "name": "New appointment",
   "schema": {
       "cards": [
           {
               "sections": [
                   {
                       "widgets": [
                           {
                               "keyValue": {
                                   "topLabel": "New appointment with {staff.firstName} {staff.lastName}",
                                   "content": "{service.name}",
                                   "contentMultiline": "true",
                                   "bottomLabel": "{start.dateTime}",
                                   "icon": "INVITE",
                                   "button": {
                                       "textButton": {
                                           "text": "RDV",
                                           "onClick": {
                                               "openLink": {
                                                   "url": "https://france.agendize.com/console/scheduling/view-event.jsp?id={id}"
                                               }
                                           }
                                       }
                                   }
                               }
                           },
                           {
                               "keyValue": {
                                   "topLabel": "Customer: {client.firstName} {client.lastName}",
                                   "content": "{client.email}",
                                   "contentMultiline": "true",
                                   "bottomLabel": "{company.name}",
                                   "icon": "PERSON",
                                   "button": {
                                       "textButton": {
                                           "text": "Fiche Hubspot",
                                           "onClick": {
                                               "openLink": {
                                                   "url": "https://app.hubspot.com/reports-dashboard/4138767/view/2886893?globalSearchQuery={client.email}"
                                               }
                                           }
                                       }
                                   }
                               }
                           }
                       ]
                   }
               ]
           }
       ]
   }
}


Here, we used the card model that you can found in the google documentation : https://developers.google.com/chat/api/guides/message-formats/cards


You can customize the data you want to receive in Google Chat. In the first section of the card (keyValue object), we have chosen to retrieve the appointment informations like :

  • the staff {staff.firstName} {staff.lastName}
  • the service concerned {service.name},
  • the date {start.dateTime},
  • and in addition, the link to the event page by the appointment {id}.


In the second section of the card (second keyValue object), we have chosen to retrieve some additional informations like :

  • the name of the customer {client.firstName}{client.lastName},
  • his email address {client.email},
  • and the company targeted by the appointment {company.name}


Last step, in your API test application, send the request via the POST method. Now, book a new appointment from your widget. You should see the following notification in you Google Chat :



For more information about the dynamic variables you can pass through in the card, please refer to the APIs documentation : https://developers.agendize.com.