Webhook Modifier Examples
Webhook Modifier examples vary from simple JSON and XML POST messages to complex examples using POST messages from Amazon Simple Notification Service (SNS) and Jira Software.
The examples are intended to provide guidance for using Modifiers to extract JSON or XML data into a format usable for CSM. For guidance on using Modifiers of different types, see JSON Modifiers and XML Modifiers.
Simple JSON POST Request
This example shows how to extract this JSON notes data to a Text Field in a Business Object record:
"notes": "The customer would like to buy a Silver
membership.",
Post data:
{
"id": "944ff7dfc501391af808764a02ab2fcd4c",
"firstname": "Jason",
"lastname": "Taylor Sr.",
"email": "[email protected]",
"siteid": 46,
"notes": "The customer would like to buy a Silver membership.",
"currentdatetime": "07-21-2019",
"customertypeid": 142
}
Modifier sample:
This example requires two Modifiers: one to declare the data type as JSON and another to map the notes data to a Text Field in a Business Object.
Modifier Type | Value, Element, etc. | Notes |
---|---|---|
As JSON() | N/A | Declares the incoming data as JSON. |
JSON Path (value) | notes | Maps the notes data to the selected Text Field. |
Simple XML POST Request
This example shows how to extract this XML notes data to a Text Field in a Business Object record.
<notes>The customer would like to buy a Silver
membership.</notes>
Post data:
<List> <item> <id>944ff7dfc501391af808764a02ab2fcd4cd</id> <firstname>Jason</firstname> <lastname>Taylor</lastname> <email>[email protected]</email> <siteid>46</siteid>
<notes>The customer would like to buy a Silver membership.</notes>
<currentdatetime>07-21-2019</currentdatetime> <customertypeid>142</customertypeid> </item> </List>
Modifier sample:
This example requires three Modifiers: one to declare the data type as XML, one to find the item element, and one to map the notes data to a Text Field in a Business Object.
Modifier Type | Value, Element, etc. | Notes |
---|---|---|
As XML() | N/A | Declares the incoming data as XML. |
Find Element | item | Finds the item element in the POST data. |
XPath (value) () | notes | Maps the notes data to the selected Text Field |
Complex JSON Post Request (Amazon)
This example shows how to extract this JSON notes data to a Text Field
in a Business Object record:
\"notes\": \"The customer would like to buy a Silver
membership.
The sample data is from Amazon Simple Notification Service (SNS).
Post data:
{
"Type" : "Notification",
"MessageId" : "8db3250a-9ce2-588f-9746-70cde0de2aa0",
"TopicArn" : "arn:aws:sns:us-west-2:000000000000:New_Customer_Object_AWS_JSON",
"Message" : " {\n \"id\": \"944ff7dfc501391af808764a02ab2fcd4c\",\n \"firstname\": \"Marie\",\n \"lastname\": \"Smith\",\n \"email\": \"[email protected]\",\n \"siteid\": 46,\n \"notes\": \"The customer would like to buy a Silver membership.\",\n \"currentdatetime\": \"07-21-2019\",\n \"customertypeid\": 142\n }",
"Timestamp" : "2019-08-09T13:49:48.167Z",
"SignatureVersion" : "1",
"Signature" : "RoPT3rzdzZFptij0j8HpR53dBjeABhAiJ/9+y6YNdsHBWJzFJY0djUQAUr5zyCujh9qHXXWUgHR07KPhq2YrKoO35nPVoKgIyLzVfGiTacRHpMv9+irc7qBihn+c9eb4cJdsaRoiS+wRZGdBqnN0w4QXWf/cOnwInIHpkhNpKz2i8xCUQT/yRzUaMRbgGT+wZrtHfhwwhuUEXvliF+Mp78zxwBGYpNQxyblMneVskroYyaZhjBb6Sl7bOLlF9AvW5riasiUnGlsbxrf9lS7FDE074fR61bKfNhR0lGYdl4/T0lYceJU+E6tWC5PKKuiqWyArnNaLdJM0tycM7fFSAw==",
"SigningCertURL" : "https://sns.us-west-2.amazonaws.com/SimpleNotificationService-6aad65c2f9911b05cd53efda11f913f9.pem",
"UnsubscribeURL" : "https://sns.us-west-2.amazonaws.com/?Action=Unsubscribe&SubscriptionArn=arn:aws:sns:us-west-2:330538622256:New_Customer_Object_AWS_JSON:1a7a7e5e-2d54-4723-a9d7-3aec73648792"
}
Modifier sample:
This example requires three Modifiers: one to declare the data type as JSON, one to find message object, and one to map the notes data to a Text Field in a Business Object.
Modifier Type | Value, Element, etc. | Notes |
---|---|---|
As JSON() | N/A | Declares the incoming data as JSON. |
Find Object (Message) | item | Finds the item element in the POST data. |
JSON Path (value)(notes) | notes | Maps the notes data to the selected Text Field. |
Complex XML POST Request (Amazon)
This example shows how to extract this XML notes data to a Text Field in a Business Object record.
<notes>The customer would like to buy a Gold
membership.</notes>
The sample data is from Amazon Simple Notification Service (SNS).
Post data:
{
"Type" : "Notification",
"MessageId" : "1582a97c-dd2d-5fd5-abf5-fcbba01b3861",
"TopicArn" : "arn:aws:sns:us-west-2:330538622256:New_Customer_Object_AWS_XML",
"Message" : "\t<List>\n\t\t<item>\n\t\t\t<id>944ff7dfc501391af808764a02ab2fcd4cd</id>\n\t\t\t<firstname>Jason</firstname>\n\t\t\t<lastname>Taylor</lastname>\n\t\t\t<email>[email protected]</email>\n\t\t\t<siteid>46</siteid>\n\t\t\t<notes>The customer would like to buy a Gold membership.</notes>\n\t\t\t<currentdatetime>07-21-2019</currentdatetime>\n\t\t\t<customertypeid>142</customertypeid>\n\t\t</item>\n\t</List>",
"Timestamp" : "2019-08-09T13:53:58.341Z",
"SignatureVersion" : "1",
"Signature" : "aSOnIPCzJWj8uC4l5wBhDOoAwOCVEUuqnTIs2axWk0FDJhpLLJiVfnJ571GhFQw7j5QQC9fxqyUNl+M8guBfaGv5WylfZqf3nAHYYFauSOoq9kkieVrezNjvtROJGZwkyHxNjxw0/MPTTgz60IcBrJlwK2/jur5EcFuqvyeqdn6wUowe2u1Sbo+C5E6QORsY9T/2fqTMRtA02uUwexaIBgBp/xVb+6yXT8AlvwptHoFjV0SCySL1H0SNANuzvFtBQ7r49XRhIjgGWD9B/9RIp8dr9GEyXtTCe+saN6KLNIynnwb1VJGDt+eMRr3nalsWZ4huwOd7vBuamNotYIB6Wg==",
"SigningCertURL" : "https://sns.us-west-2.amazonaws.com/SimpleNotificationService-6aad65c2f9911b05cd53efda11f913f9.pem",
"UnsubscribeURL" : "https://sns.us-west-2.amazonaws.com/?Action=Unsubscribe&SubscriptionArn=arn:aws:sns:us-west-2:330538622256:New_Customer_Object_AWS_XML:ebed2bfb-2ec4-4085-934e-c49fc71b79bc"
}
Modifier sample:
Because SNS encapsulates all data as JSON, this example requires five Modifiers: one to declare the data type as JSON, one to one to return a value based on the supplied JSON path, one to declare the data inside the JSON as XML, one to find the item element, and one to map the notes data to a Text Field in a Business Object.
Modifier Type | Value, Element, etc. | Notes |
---|---|---|
As JSON() | N/A | Declares the incoming data as JSON. |
JSON Path (value)(message) | message | Returns a value based on the supplied JSON path. |
As XML() | N/A | Declares the data inside the JSON as XML. |
Find Element (item) | item | Finds the item element in the POST data. |
XPath (value)(notes) | notes | Maps the notes data to the selected Text Field. |
Complex JSON Post Request (Jira Software)
This example shows how to extract this JSON changelog data (shown in bold text below) to a Text Field in a Business Object record.
{ "field": "description", "fieldtype": "jira", "fieldId":
"description", "from": null, "fromString": null, "to": null, "toString": "This
is the description field for a new JIRA issue request." },
The sample data is from Jira Software.
Post data:
{
"timestamp": 1564693604774,
"webhookEvent": "jira:issue_created",
"issue_event_type_name": "issue_created",
"user": {
"self": "https://webhookstest.atlassian.net/rest/api/2/user?accountId=557058%3A57f5e298-87a6-4fc8-87d7-d7ab15be260e",
"name": "Jill Hanson",
"key": "jill.hanson",
"accountId": "557058:57f5e298-87a6-4fc8-87d7-d7ab15be260e",
"emailAddress": "jill.hanson@example company.com",
"avatarUrls": {
"48x48": "https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/557058:57f5e298-87a6-4fc8-87d7-d7ab15be260e/ccb36e82-479b-4034-950e-6fce17dc2d89/128?size=48&s=48",
"24x24": "https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/557058:57f5e298-87a6-4fc8-87d7-d7ab15be260e/ccb36e82-479b-4034-950e-6fce17dc2d89/128?size=24&s=24",
"16x16": "https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/557058:57f5e298-87a6-4fc8-87d7-d7ab15be260e/ccb36e82-479b-4034-950e-6fce17dc2d89/128?size=16&s=16",
"32x32": "https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/557058:57f5e298-87a6-4fc8-87d7-d7ab15be260e/ccb36e82-479b-4034-950e-6fce17dc2d89/128?size=32&s=32"
},
"displayName": "Jill Hanson",
"active": true,
"timeZone": "America/Denver",
"accountType": "atlassian"
},
"issue": {
"id": "10006",
"self": "https://webhookstest.atlassian.net/rest/api/2/issue/10006",
"key": "TES-7",
"fields": {
"statuscategorychangedate": "2019-08-01T15:06:44.856-0600",
"issuetype": {
"self": "https://webhookstest.atlassian.net/rest/api/2/issuetype/10001",
"id": "10001",
"description": "Stories track functionality or features expressed as user goals.",
"iconUrl": "https://webhookstest.atlassian.net/secure/viewavatar?size=medium&avatarId=10315&avatarType=issuetype",
"name": "Story",
"subtask": false,
"avatarId": 10315
},
"timespent": null,
"customfield_10030": null,
"project": {
"self": "https://webhookstest.atlassian.net/rest/api/2/project/10000",
"id": "10000",
"key": "TES",
"name": "JIRA issue summary information",
"projectTypeKey": "software",
"simplified": false,
"avatarUrls": {
"48x48": "https://webhookstest.atlassian.net/secure/projectavatar?pid=10000&avatarId=10409",
"24x24": "https://webhookstest.atlassian.net/secure/projectavatar?size=small&s=small&pid=10000&avatarId=10409",
"16x16": "https://webhookstest.atlassian.net/secure/projectavatar?size=xsmall&s=xsmall&pid=10000&avatarId=10409",
"32x32": "https://webhookstest.atlassian.net/secure/projectavatar?size=medium&s=medium&pid=10000&avatarId=10409"
}
},
"fixVersions": "9.7.0",
"aggregatetimespent": null,
"resolution": null,
"customfield_10027": null,
"resolutiondate": null,
"workratio": -1,
"watches": {
"self": "https://webhookstest.atlassian.net/rest/api/2/issue/TES-7/watchers",
"watchCount": 0,
"isWatching": true
},
"lastViewed": null,
"created": "2019-08-01T15:06:44.730-0600",
"customfield_10020": null,
"customfield_10021": null,
"customfield_10022": null,
"customfield_10023": null,
"priority": {
"self": "https://webhookstest.atlassian.net/rest/api/2/priority/3",
"iconUrl": "https://webhookstest.atlassian.net/images/icons/priorities/medium.svg",
"name": "Medium",
"id": "3"
},
"customfield_10024": null,
"customfield_10025": [],
"customfield_10026": null,
"labels": [],
"customfield_10016": null,
"customfield_10017": null,
"customfield_10018": {
"hasEpicLinkFieldDependency": false,
"showField": false,
"nonEditableReason": {
"reason": "PLUGIN_LICENSE_ERROR",
"message": "Portfolio for Jira must be licensed for the Parent Link to be available."
}
},
"customfield_10019": "0|i0001b:",
"aggregatetimeoriginalestimate": null,
"timeestimate": null,
"versions": [],
"issuelinks": [],
"assignee": null,
"updated": "2019-08-01T15:06:44.730-0600",
"status": {
"self": "https://webhookstest.atlassian.net/rest/api/2/status/10000",
"description": "",
"iconUrl": "https://webhookstest.atlassian.net/",
"name": "Backlog",
"id": "10000",
"statusCategory": {
"self": "https://webhookstest.atlassian.net/rest/api/2/statuscategory/2",
"id": 2,
"key": "new",
"colorName": "blue-gray",
"name": "New"
}
},
"components": [],
"timeoriginalestimate": null,
"description": "test new issue desc",
"customfield_10010": null,
"customfield_10014": null,
"timetracking": {},
"customfield_10015": null,
"customfield_10005": null,
"customfield_10006": null,
"security": null,
"customfield_10007": null,
"customfield_10008": null,
"attachment": [],
"aggregatetimeestimate": null,
"customfield_10009": null,
"summary": "my new issue",
"creator": {
"self": "https://webhookstest.atlassian.net/rest/api/2/user?accountId=557058%3A57f5e298-87a6-4fc8-87d7-d7ab15be260e",
"name": "john.smith",
"key": "john.smith",
"accountId": "557058:57f5e298-87a6-4fc8-87d7-d7ab15be260e",
"emailAddress": "john.smith@example company.com",
"avatarUrls": {
"48x48": "https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/557058:57f5e298-87a6-4fc8-87d7-d7ab15be260e/ccb36e82-479b-4034-950e-6fce17dc2d89/128?size=48&s=48",
"24x24": "https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/557058:57f5e298-87a6-4fc8-87d7-d7ab15be260e/ccb36e82-479b-4034-950e-6fce17dc2d89/128?size=24&s=24",
"16x16": "https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/557058:57f5e298-87a6-4fc8-87d7-d7ab15be260e/ccb36e82-479b-4034-950e-6fce17dc2d89/128?size=16&s=16",
"32x32": "https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/557058:57f5e298-87a6-4fc8-87d7-d7ab15be260e/ccb36e82-479b-4034-950e-6fce17dc2d89/128?size=32&s=32"
},
"displayName": "John Smith",
"active": true,
"timeZone": "America/Denver",
"accountType": "atlassian"
},
"subtasks": [],
"reporter": {
"self": "https://webhookstest.atlassian.net/rest/api/2/user?accountId=557058%3A57f5e298-87a6-4fc8-87d7-d7ab15be260e",
"name": "john.smith",
"key": "john.smith",
"accountId": "557058:57f5e298-87a6-4fc8-87d7-d7ab15be260e",
"emailAddress": "john.smith@example company.com",
"avatarUrls": {
"48x48": "https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/557058:57f5e298-87a6-4fc8-87d7-d7ab15be260e/ccb36e82-479b-4034-950e-6fce17dc2d89/128?size=48&s=48",
"24x24": "https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/557058:57f5e298-87a6-4fc8-87d7-d7ab15be260e/ccb36e82-479b-4034-950e-6fce17dc2d89/128?size=24&s=24",
"16x16": "https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/557058:57f5e298-87a6-4fc8-87d7-d7ab15be260e/ccb36e82-479b-4034-950e-6fce17dc2d89/128?size=16&s=16",
"32x32": "https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/557058:57f5e298-87a6-4fc8-87d7-d7ab15be260e/ccb36e82-479b-4034-950e-6fce17dc2d89/128?size=32&s=32"
},
"displayName": "John Smith",
"active": true,
"timeZone": "America/Denver",
"accountType": "atlassian"
},
"customfield_10000": "{}",
"aggregateprogress": {
"progress": 0,
"total": 0
},
"customfield_10001": null,
"customfield_10002": null,
"customfield_10003": null,
"customfield_10004": null,
"environment": null,
"duedate": null,
"progress": {
"progress": 0,
"total": 0
},
"votes": {
"self": "https://webhookstest.atlassian.net/rest/api/2/issue/TES-7/votes",
"votes": 0,
"hasVoted": false
}
}
},
"changelog": {
"id": "10011",
"items": [
{
"field": "description",
"fieldtype": "jira",
"fieldId": "description",
"from": null,
"fromString": null,
"to": null,
"toString": "This is the description field for a new JIRA issue request."
},
{
"field": "priority",
"fieldtype": "jira",
"fieldId": "priority",
"from": null,
"fromString": null,
"to": "3",
"toString": "Medium"
},
{
"field": "reporter",
"fieldtype": "jira",
"fieldId": "reporter",
"from": null,
"fromString": null,
"to": "john.smith",
"toString": "John Smith",
"tmpFromAccountId": null,
"tmpToAccountId": "557058:57f5e298-87a6-4fc8-87d7-d7ab15be260e"
},
{
"field": "Status",
"fieldtype": "jira",
"fieldId": "status",
"from": null,
"fromString": null,
"to": "10000",
"toString": "Backlog"
},
{
"field": "summary",
"fieldtype": "jira",
"fieldId": "summary",
"from": null,
"fromString": null,
"to": null,
"toString": "JIRA issue summary information"
}
]
}
}
Modifier sample:
This example requires five Modifiers: one to declare the data type as JSON, one to find the changelog object, one to find the internal array, one to find the array index, and one to map the toString data to the selected Text Field.
Modifier Type | Value, Element, etc. | Notes |
---|---|---|
As JSON() | N/A | Declares the incoming data as JSON. |
Find Object (changelog) | changelog | Finds the changelog element in the POST data. |
Find Array (items) | items | Finds and returns a JSON array for items. |
Goto Array Index (0) | 0 | Returns a new JSON object of the indexed object in the arrary. |
Find Object (toString) | toString | Maps the toString data to the selected Text Field. |
Simple JSON Post Request (Slack)
This example shows how to extract this JSON event and user data to a Text Field in a Business Object record:
"event": { "client_msg_id":
"db93027c-b354-4bc4-b583-75caeafc5204", "type": "app_mention", "text":
"<@USY1K9YHH> create incident My printer doesn't work", "user":
"USDKMAUSV", "ts": "1580746614.000400", "team": "TSRMJ2UTZ", "blocks": [
{
The sample data is from Slack.
Post data:
{
"token": "6EK61SvTDR1tOLA1gBTm0wU1",
"team_id": "TSRMJ2UTZ",
"api_app_id": "AT91HES6Q",
"event": {
"client_msg_id": "db93027c-b354-4bc4-b583-75caeafc5204",
"type": "app_mention",
"text": "<@USY1K9YHH> create incident My printer doesn't work",
"user": "USDKMAUSV",
"ts": "1580746614.000400",
"team": "TSRMJ2UTZ",
"blocks": [
{
"type": "rich_text",
"block_id": "SkD",
"elements": [
{
"type": "rich_text_section",
"elements": [
{
"type": "user",
"user_id": "USY1K9YHH"
},
{
"type": "text",
"text": " create incident My printer doesn't work"
}
]
Modifier sample:
This example requires three Modifiers: one to declare the data type as JSON, one to find the event object, and one to find the user object.
Modifier Type | Value, Element, etc. | Notes |
---|---|---|
As JSON() | N/A | Declares the incoming data as JSON. |
Find Object (event) | item | Finds the item element in the POST data. |
Find Object (user) | item | Finds the item element in the POST data. |