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 :
- Into the headers, insert your API key (apiKey) and your token :
- In the URL field, paste the link below with the ID of the company concerned :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.
https://us.agendize.com/api/2.1/scheduling/companies/{{companyId}}/appointments/watch
- 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": "Backoffice", "onClick": { "openLink": { "url": "https://app.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": "CRM", "onClick": { "openLink": { "url": "https://yourcrm.com/clients?search=${$.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.
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article