Webhooks

Slack example

This guide demonstrates how to set up a webhook to send a notification to a Slack channel on various events an order can go through in Geins.

Introduction

Slack is a popular messaging app for teams. It provides a platform for team communication and collaboration. Slack also supports webhooks, which can be used to send notifications to a Slack channel. This can be useful for sending notifications about events in geins , such as when an order is locked or when a new customer is created.

Setting up webhook for locked order

This example demonstrates how to configure a webhook to send a notification to a Slack channel when an order gets locked. The notification will include a link to the OMS for more detailed information about the order.

  • Step 1: Create the incoming Webhook in Slack. Please refer to Slack documentation
  • Step 2: Set up the webhook to listen for lock actions on the Order entity.

cURL Example

curl -X POST "https://mgmtapi.geins.io/API/Webhook" `
     -H "Content-Type: application/json" `
     -H "X-ApiKey: {MGMT_API_KEY}" `
     -u "user:password" `
     -d '{
           "Entity": "Order",
           "Name": "Order Notification to Slack",
           "Description": "Notifies when an order is locked",
           "Actions": "lock",
           "Method": "POST",
           "Url": "https://hooks.slack.com/services/00000000000/00000000000/000000000000000000000000",
           "Body": "{\"text\": \"An order has been locked: <https://webshop.admin.geins.io/Admin/Order/Edit/{{id}}|Order Details>\"}",
           "Headers": "Content-Type: application/json",
           "Retry": true
         }'