JSON, or JavaScript Object Notation, is an open, standard format (ECMA-404) widely used to exchange data between applications. Created in 2007 as a subset of the JavaScript programing language, it quickly became adopted by many languages as a means to deliver data regardless of the language of the sending and receiving applications to be a neutral conveyor. We can find a JSON file modeled on two different structures.
An object composed by name: value pairs, opened and closed by a bracket with each name separated from the corresponding value by a colon and each pair separated by a comma, such as the following example:
{
"name" : "Janet",
"state" : "California",
"cake" : "Toffee sticky pudding"
}
An ordered list of values inside an array opened and closed by a square bracket and the values separated by a comma: [ "1", "2", "3"].
A value in JSON can be a number, object, array, string, true, false, or null.
So, JSON will be the format that we will use to transmit our messages to the channel using the WebHook, and it will be structured in an object made of name:value pairs. The simplest message in Slack would bear a simple "text" keyword as the name part of the JSON and the message to deliver as its value:
{
"text": "This is the first line of a message This is
the second line."
}
Now that we have our first message formatted into a neat JSON, we must proceed to deliver this content to our #test channel.