External Events - Payload data changes when content type is not application/json

Am trying to integrate Survey Monkey with my app. Survey monkey(link) will post message whenever user completes their survey.

Survey Monkey triggers app webhook and this works perfectly. I see payload(data) in onExternalEventHandler differs from the actual because of change in content type(other than application/JSON).

Because of which not able to process payload data at the external event handler. @Hem Please look into this. As discussed adding payload sample for reference.

The following payload works fine, when i change content-type to application/json.

Actual Request

 Content Type: **application/vnd.surveymonkey.response.v1+json**
	"name": "Response complete",
    "filter_type": "survey",
    "filter_id": "1234",
    "event_type": "response_completed",
    "event_id": "1234",
    "event_datetime": "2020-04-09T04:31:07.712348+00:00",
    "object_type": "response",
    "object_id": "1234",
    "resources": {
      "respondent_id": "1234",
      "recipient_id": "1234",
      "survey_id": "1234",
      "user_id": "1234",
      "collector_id": "1234"

Received as:


   '**{\n\t"name": "Response complete with json",\n    "filter_type": "survey",\n    "filter_id": "280425564",\n    "event_type": "response_completed",\n    "event_id": "1234",\n    "event_datetime": "2020-04-09T04:31:07.712348+00:00",\n    "object_type": "response",\n    "object_id": "1234",\n    "resources": {\n      "respondent_id": "1234",\n      "recipient_id": "1234",\n      "survey_id": "1234",\n      "user_id": "1234",\n      "collector_id": "1234"\n    }\n}**'

Hi @Sudharsan_Danasu,

We have verified that this content-type has already been whitelisted by us. So, you will be able to get this external event in the app.
However, this particular format is not recognized by our system and it cannot parse this payload. Currently, only the JSON and XML payloads are parsed at our end. The other payloads will directly be parsed and sent as text.

So, you can parse this payload as text in your external events handler method and use it. Simple JSON.parse() method would work for this payload.

Note: Please have a check if the payload is of data type String before parsing it so that if this payload is parsed by our system in the future, the application will work smoothly.

This topic was automatically closed after 13 days. New replies are no longer allowed.