Skip to content

Slack API Integration

Yoanny Dominguez Carrero edited this page Nov 16, 2019 · 1 revision

Slack is a cloud-based propietary instant messaging platform developed by Slack Technologies.

The Cenit.io platform provides a collection that allows you to integrate with Slack's API with ease.

Quick Installation Guide

You do not need any data to successfully install the Slack Integration addon for Odoo.

Usage

Once installed, the addon features will allow you to send any data you want as Slack Schemas. To do so, all you need is add Data types describing how to transform your Odoo models into the Slack ones and authorize the Cenit.io platform to access to your Slack's work place.

Let's see one example, go and create a new Data type.

Products

A good choice to map to Slack messages are Odoo's product.template (also known as Products) creation event.

This model actually refers to products on your warehouses either you can sale it or not, so you will need to restrict them to those with sale_ok set as True. This is accomplished on the Conditions tab of the Data type form.

But lets not get ahead of ourselves. For the Name we recommend using something that'll let you know quickly what's the Data type about, something like "Product Created Message". Make sure to select Product Template for the model, Slack API 1.0.0 for the namespace, product-created-message for the slug and the following json for the schema.

{

"type": "object", "properties": {

"channel": {
"type": "string"

}, "text": {

"type": "string"

}

}

}

Now we are all for the mapping. Let's examine the Product Created Message schema properties.

  • channel: string - this is the channel where the message should be send.
    • Schema property: channel
    • Model value: general
    • Type: Default
  • text: string - The content of de message.
    • Schema property: text
    • Model value: Checkout our new product {name}!
    • Type: Default

Testing

In order to test the mappings go to the Sales Create a new Product.

If it does match the Conditions for the Data type, you should able to see in Slack channel a new message with the name of the new product.

To be continued

Clone this wiki locally