Do you happen to know why does the following line shows an error?
"mrkdwn_in": ['text','pretext'], -- expecting '}', found ':'

def payload = JsonOutput.toJson([
      "username": "Production Deployer",
      "icon_emoji": ":robot_face:",
      "mrkdwn": true,
      "attachments": [
         {
            "mrkdwn_in": ['text','pretext'],
            "color": "#199515",
            "text": "*$JOB_NAME:* <$BUILD_URL|Build #$BUILD_NUMBER>, 
_microservice_ in _${clusterName}_ successfully updated.",
            "fallback": "*Production Deployer*: operation succeeded."
         }
      ]
   ])


On Friday, June 30, 2017 at 6:23:18 PM UTC+3, Idan Adar wrote:
>
> Ohhh, nice!
> Thanks for the example Michael.
>
> On Friday, June 30, 2017 at 5:41:38 PM UTC+3, mpapo - Michael Pailloncy 
> wrote:
>>
>> Alternatively, you can create your own Pipeline method, a bit like this 
>> one : 
>> https://github.com/jenkinsci/pipeline-examples/blob/master/pipeline-examples/slacknotify/slackNotify.groovy
>>   
>> Since it's a simple curl, you can then directly use all the existing 
>> options/parameters offered by the Slack REST API.
>>
>> Note that it's better to centralized this method inside a Global Shared 
>> Library (just in case you are not already using it :))
>>
>>
>> 2017-06-30 16:11 GMT+02:00 Idan Adar <[email protected]>:
>>
>>> Anyone? :)
>>>
>>> On Tuesday, June 27, 2017 at 8:13:35 PM UTC+3, Idan Adar wrote:
>>>>
>>>> In a Node.js app, one can use the slack-notify package to send 
>>>> something like this:
>>>>
>>>>
>>>> slack.send({
>>>>       "username": "myBotName",
>>>>       "icon_emoji": ":robot_face:",
>>>>       "mrkdwn": true,
>>>>       "attachments": [
>>>>          {
>>>>             "mrkdwn_in": ['text','pretext'],
>>>>             "color": "#199515",
>>>>             "text": message,
>>>>             "fallback": "*my*: _markdown_ message."
>>>>          }
>>>>       ]   
>>>>    });
>>>>
>>>> In a Jenkinsfile, one can do this:
>>>> slackSend (
>>>>        color: '#F01717',
>>>>        message: "$JOB_NAME: <$BUILD_URL|Build #$BUILD_NUMBER>, my 
>>>> message."
>>>> )
>>>>
>>>> I'm looking for a way to accomplish the Node implementation, but using 
>>>> slackSend so that the message dispatched from the Jenkinsfile will be 
>>>> on-par with the Node.js-sent message.
>>>>
>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Jenkins Users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to [email protected].
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/jenkinsci-users/deaa0550-128a-4513-8972-0cf991d49bbd%40googlegroups.com
>>>  
>>> <https://groups.google.com/d/msgid/jenkinsci-users/deaa0550-128a-4513-8972-0cf991d49bbd%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/b4ac2560-b636-49da-a7e6-4d90e677a383%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to