# TTN Webhooks Integration with Slack

**URL:** <https://www.thethingsnetwork.org/forum/t/ttn-webhooks-integration-with-slack/63593>\
**Category:** The Things Stack v3\
**Tags:** end-devices\
**Created:** [June 21, 2023, 12:47pm UTC](https://www.thethingsnetwork.org/forum/t/ttn-webhooks-integration-with-slack/63593 "2023-06-21T12:47:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![audev](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/audev/32/45297_2.png) [@audev](https://www.thethingsnetwork.org/forum/u/audev)\
**Post date:** [June 21, 2023, 12:47pm UTC](https://www.thethingsnetwork.org/forum/t/ttn-webhooks-integration-with-slack/63593/1 "2023-06-21T12:47:40Z")

</div>

Hello,

I started using The Things Stack a few months ago and so, still discovering many of the available functionalities. I am struggling with Webhooks Integrations functionalities, and would be grateful if someone could help me 🙂

Task Description:

1. MKRWAN 1310 send messages to the TTN.
2. Use TTN Webhooks to send messages to Slack.

Configuration:

1. An end-device (MKRWAN 1310) is sending messages to the TTN. Messages are decoded in the uplink payload formatters using a custom javascript formatter (decodedUplink) function.
2. Example of a receive message is as follow:

```auto
 "received_at": "2023-06-21T12:00:01.843661970Z",
    "uplink_message": {
      "session_key_id": "Axxx...",
      "f_port": 2,
      "f_cnt": 122,
      "frm_payload": "U3RhdHVzIEFjdGl2ZQ==",
      "decoded_payload": {
        "msg": "Status Active"
      },

```

1. Webhook has been configured in Slack to be sent to a Slack channel called “lora-test”. Following this Slack tutorial - [Sending messages using Incoming Webhooks | Slack](https://api.slack.com/messaging/webhooks). Testing the sample curl request provided by Slack directly from a terminal, a “Hello, World!” message is received in the Slack Channel.

```auto
curl -X POST -H 'Content-type: application/json' --data 
'{"text":"Hello, World!"}' 
https://hooks.slack.com/services/Txxx/Bxxx/zxxx

```

1. Creating a new custom webhook in the TTN using as BaseURL `https://hooks.slack.com/services/Txxx/Bxxx/zxxx` and ticking the uplink message box by replacing **_/path/to/webhook_** with **_Txxx/Bxxx/zxxx_** no messages arrived in the Slack channel.
2. Testing if messages from TTN are sent using the webhook.site ( [https://webhook.site](https://webhook.site/)) mentioned by @descartes in thread [Webhook and Payload Formatter](https://www.thethingsnetwork.org/forum/t/webhook-pending-and-payload-formatter/54050/11?) I can confirm that the messages arrive.

So if messages arrived on webhook.site, why are the messages not being received on the Slack Channel?

_Note that I am only interested in the “decoded\_payload: {msg: “”}” part of the content._

Thank you in advance for your help.  
Aude

 ![webhook](https://www.thethingsnetwork.org/forum/uploads/default/original/3X/c/3/c3f6e2ca05c80e7bb466f0b06c9d48fa5457747f.jpeg)

---

<div class="post-metadata">

**Author:** ![descartes](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/descartes/32/47220_2.png) [@descartes](https://www.thethingsnetwork.org/forum/u/descartes)\
**Post date:** [June 21, 2023, 2:07pm UTC](https://www.thethingsnetwork.org/forum/t/ttn-webhooks-integration-with-slack/63593/2 "2023-06-21T14:07:53Z")

</div>

> [@audev](#):
>
> using the @descartes webhook.site

Flattered, but that’s not my site, just a tool I use - would be useful to know where you saw me mention it so I can try & clarify ownership.

> [@audev](#):
>
> why are the messages not being received on the Slack Channel?

Incompatible data structures - like you sent Kanji to a someone in the UAE - Slack needs at a minimum a key of “text” with the text you want, TTS sends lots of loverly payload information with many key-value pairs and arrays and objects and stuff, but no “text”.

And no, you can’t mash it in to co-operation without going via something that will take the TTS payload & completely re-write it - there are NO facilities on TTS to do so - we can add decoded fields but we can’t complete do over the payload JSON.

You may be able to do a translation with IFTTT or you could setup a AWS Lamba using JQ or if you have your own web space that can run PHP, write a bit of code to do it.

---

<div class="post-metadata">

**Author:** ![audev](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/audev/32/45297_2.png) [@audev](https://www.thethingsnetwork.org/forum/u/audev)\
**Post date:** [June 21, 2023, 3:15pm UTC](https://www.thethingsnetwork.org/forum/t/ttn-webhooks-integration-with-slack/63593/3 "2023-06-21T15:15:19Z")

</div>

> Flattered, but that’s not my site, just a tool I use - would be useful to know where you saw me mention it so I can try & clarify ownership.

Apologise for wording this wrongly. I have corrected my post.

> Incompatible data structures

Ok. That is a little be sad. I was thinking it would be easier to extract the payload msg from the TTN. In another application, I am using MQTT - telegraf - InfluxDB to retrieve incoming data from the TTN, I might then look to do something similar.

Many thanks for your help 🙂
