Continuing the Response Duplication - how to pass along original event data?

Not Yet Reviewed

This is a follow up to:

https://support.xmatters.com/hc/en-us/community/posts/115000018286-Using-response-to-duplicate-event-to-different-team 

So in the above it looks like you can build/forward the new event with eventProperties from the old event

// Prepare the HTTP request
var request = http.request({
'endpoint': 'xMatters',
'method': 'POST',
'path': '/reapi/2015-04-01/forms/c34c75ba-379f-4d58-99b4-02154cc8fb79/triggers',
'headers': {
'Content-Type': 'application/json'
}
});

// Where the 'path' is the form uuid destination for the new event

// Prepare the HTTP request body
var json = {
"recipients": recipients,
"Message": callback.eventProperties.Message,
};

// Where recipients is set to the new group and Message is also included in the form


// Submit the request and capture the response
var response = request.write(json);


The problem is then that the "Message" part of the payload gets rejected with "DATA_FORMAT_ERROR", that includes a list of allowed properties/fields

Removing "Message" works fine, but now we can't forward information from the original notification.

0

Comments

5 comments
Date Votes

Please sign in to leave a comment.

  • Hi Kirk!

     

    What you need to do is create a JSON array called properties, instead of "Message".

    So the step would look more like this...

    var myProperties = [];

    myProperties["Message"] = callback.eventProperties.Message;

    // Prepare the HTTP request body
    var json = {
    "recipients": recipients,
    "properties": myProperties,
    };

    And, probably more succinctly, you could probably refer directly to callback.eventProperties...

    // Prepare the HTTP request body
    var json = {
    "recipients": recipients,
    "properties": callback.eventProperties,
    };

    Anyway, give those a try and let us know!

    0
  • Hi Jordon,

    Pretty good though I used 

    var myProperties = {
    "Message": callback.eventProperties.Message,
    "foo": "bar",
    };


    0
  • Great Kirk!  Now, if I could just learn how to make my posts look like yours :)

    0
  • @jordan, hit the paragraph icon and you'll see the different formatting options. I find the best thing to do is write on a separate line "CODEHERE", then put a few blank lines after it. Then select your CODEHERE text and apply the "code" format. THEN paste the code over the CODEHERE placeholder. Doing it any other way gives me headaches. 

    0
  • Thanks @Travis!

    0

Didn't find what you were looking for?

New post