# Webhooks Setup for Microsoft Teams

For activating notifications through Weebhooks on the team follow the following steps

* Login to your teams
* Go to the apps section and search for Weebhooks&#x20;

![](https://lh7-us.googleusercontent.com/t6jdp58UnxRLRyFaa0R6c5lZx_tcel2G7kI-zK4_G0SeBMlc1nywoAzoF1gQXkv4FIJlg-ZTujYvvSxX4Fe69IxYv_E84hw28V1lwm257GnC3yeYxPav71djqLfhA1189oPlPxFBGVq-LJkU3wrVlhs)

* Select Incoming Webhooks
* Select the team or channel where you want to get the notifications

![](https://lh7-us.googleusercontent.com/2l8JmEIbSfof0HBPjj089vNFFbTcTB05-ZaU37mRwXR5RYHFWruR04lGSYZKrBNsx8PqGiddiQF6TnxNx4p58Fa0WEt99XeAAf672rzxmnhiQhxzFGvOHxkDFvALB71z-wG4CExUvLjSz5r25FLzT54)

* To set an incoming webhook Provide a name and click create

![](https://lh7-us.googleusercontent.com/6rnG7Om3TDFC1AqIwIHYgwxe82QsErL9D0Os_TPWRI-CODTlZeaZgtIMpSqSpVwKC5WyTjz_efX98TfqVla6WWeMXsjr6Iw-4MYESQ2p51vPZaV4pMBCaWac6sUkD4usm8IQTr0qwENpe-Btcmgm6e0)

* Copy the URL to save it on the clipboard as this URL will be required to be pasted in the Notification section on the DBSync Notification page

![](https://lh7-us.googleusercontent.com/hqSPkNGU_FaehfCvPurTc6fjK6MPMzCNgCUuoWfquXYXv_JndVRxM7o4xJghmofV2ruwZLpbK83KUSp0l3MWffGFgH8OC7JXMyKMigTDYfOEPbTYkydZScE49uRQw3u8ago28kUu_tvvPRvLza5aBkI)

\
**Once Teams setup is completed go to the DBSync Notification Page**

* Select **'Webhooks'** as the channel type and the settings will appear on the screen as seen in the below image![](https://help.mydbsync.com/docs/download/attachments/68878820/image2022-5-10_23-38-14.png?version=1\&modificationDate=1702301155000\&api=v2)
* #### Configure Webhooks Notifications Settings <a href="#webhookssetupformicrosoftteams-configurewebhooksnotificationssettings" id="webhookssetupformicrosoftteams-configurewebhooksnotificationssettings"></a>

  **Receive Notifications** \
  Click the checkbox next to the desired event options. There are 3 main event options that can be configured are shown in the image below:

  ![](https://help.mydbsync.com/docs/download/attachments/68878820/image2022-5-10_23-38-29.png?version=1\&modificationDate=1702301155000\&api=v2)

  * **Process** &#x20;
  * **Started**- Click the checkbox next to the icon 'Started' if you wish to be notified when a process is started. For eg: If you enable this option you will be notified when a process such as 'Clean Copy', 'DB to Source', etc starts running.&#x20;
  * **Completed**- Click the checkbox next to the icon 'Completed' if you wish to be notified when a process is completed. For eg: If you enable this option you will be notified when a process such as 'Clean Copy', 'DB to Source', etc completes. <br>
  * **Errored**- Click the check-box next to the icon 'Errored' if you wish to be notified when errors arrears in the process or the process fails. For eg: If you enable this option you will be notified when a process such as 'Clean Copy', 'DB to Source', etc encounters errors or fails.&#x20;

  \
  **Methods of Configuration Notifications**&#x20;

  **POST method:**  &#x20;

  ![](https://help.mydbsync.com/docs/download/attachments/68878820/image2022-5-10_22-43-27.png?version=1\&modificationDate=1702301155000\&api=v2)

  * This method is used if the user wants to define the payload.
  * From the URL drop-down menu choose the POST method option.
  * Fill in all the details: URL, HEADERS, CONTENT TYPE, and PAYLOAD

  **For example:**

  Let us consider that a user wants to get notified in TEAMS.&#x20;

  Enter details as follows:

  URL:POST URL: <https://avankia.webhook.office.com/webhookb2/cfef3183-e63b-4f97-a5dc-5c038f23ce19@c86b5726-2a50-4b12-9703-ce9be669e77d/IncomingWebhook/95072733741343179cb2e3f28a4567ae/28fcde24-5b09-4aae-b25d-761b199a6f33>

  1. Content-Type:

  Content-type:

  Content type: application/JSON

  1. Payload:

  Payload: (Freeform)

  {\
  'text' : 'date=$date; format ="yyyy-MM-dd hh:mm:ss"$ profile=$profile$ command=$command$ zoneId=$zoneId; default="EST"$ errorCount=$errorCount$'\
  }

  * The screen will appear as below:<br>

  ![](https://help.mydbsync.com/docs/download/attachments/68878820/image2022-5-10_23-39-17.png?version=1\&modificationDate=1702301155000\&api=v2)

  * You can format your calls for multiple parameters.&#x20;
  * The above example: The user required details such as:

  date, time, profile, and error.

  * There is a specific list of supported expressions that have to be followed for writing the various required parameters in the URL while running the POST method.
  * These can be found listed under “Supported Expressions”. Various conditions for these parameters can also be listed.&#x20;
  * Once you enter all parameters Click SAVE
  * Click Test Connection and verify the same.

  In this manner, the user can define their own Payload and provide the parameters in the standard expressions format with/without conditions to receive the respective POST notifications in their communication channel.
* #### Supported Expressions:  <a href="#webhookssetupformicrosoftteams-supportedexpressions" id="webhookssetupformicrosoftteams-supportedexpressions"></a>

  | Option                  | Expression                  | Notes                                                                                                                                              |
  | ----------------------- | --------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
  | Current date            | $date; format=”dateformat”$ | <p>Format is an optional attribute. However, it is recommended to add one.</p><p>Do NOT escape quotes in date format as it can lead to errors.</p> |
  | Current event           | $event$                     | Values: Started, Errored or Completed                                                                                                              |
  | Error count             | $errorCount$                | Denotes the number of objects that encountered an error                                                                                            |
  | Is error in the backup  | $isError$                   | Values: true if the event is errored else false                                                                                                    |
  | Profile Name            | $profile$                   | <p><br></p>                                                                                                                                        |
  | Total records processed | $recordsProcessed$          | Total number of records processed ie. inserted + updated for all objects                                                                           |
  | Command                 | $command$                   | Provides a clear representation of the command that has been executed.                                                                             |
  | Zone ID                 | $ZoneId$                    | Shows the Time zone selected                                                                                                                       |

  #### Using Conditions: <a href="#webhookssetupformicrosoftteams-usingconditions" id="webhookssetupformicrosoftteams-usingconditions"></a>

  If else conditions are supported, however, we need to specify a boolean variable from the supported list for conditions:

  Syntax:

  $if(variable1)$value1$elseif(variable2)$value2$else$value3$endif$

  **Example**

  $if(isError)$$errorCount$$else$0$endif$
* Once All the steps are done you can Go to the team/channel selected to receive the notification and see if the notification is activated and received on the same as shown below\
  ![](https://lh7-us.googleusercontent.com/8Ny1UmIJGJMTe8BXoF-2HcB_ubI5FvzGLcFLpeNRFHBRnZCXrk0ktKZStf4qCxDLmK-WxIZ0HuiY7Jfhp7ZRzLM_KqHGhikqjXjq7MyGADN2AivBRuIdLGpbguVPPyEH-kB7nCbepSjfd7Mwlvtq2No)
