Support Topics Documentation Slack YouTube Blog

Issue with JSON formating of incoming payload

Hi I am receiving a JSON payload but I think I am making some sort of mistake in defining the schema.

{
	"code": 14004,
	"message": "Service invocation failed: Unexpected character ('s' (code 115)): was expecting double-quote to start field name\n at [Source: (ByteArrayInputStream); line: 1, column: 4]"
}

The payload received should look like this:

{
  "subscription_id": "whsub_38Uj6FUd9waHdKSMivNXbe",
  "event": {
    "object_type": "activity.sms",
    "lead_id": "lead_0T2jx36bfiof7CKgKLBPWe57ojqABc7hoD36xwWD2wm",
    "action": "sent",
    "changed_fields": [],
    "data": {
      "local_phone": "+44XXX",
      "remote_phone": "+44XXX",
      "date_scheduled": "2021-01-25T13:00:00+00:00",
      "direction": "outbound",
      "date_sent": "2021-01-25T13:00:05.708000+00:00",
      "contact_id": "cont_eowpHVa7NGOmJOtrDlNHGpUCNtkOdsw1LH4E6ZfAOXi",
      "text": "#Scheduled# Test test 2",
      "remote_phone_formatted": "+44 XXX"
    }
  }
}

But is coming in with single quotes.

It feels like I should maybe be doing something differently here?

The strange thing is that when I print the result, it comes out correctly, but not when I return the result.

I feel like this is an easily-solvable problem but I can’t find the solution in the docs, the community or StackOverflow.

App ID: 4A47197B-AE30-FA84-FF56-0071F4010900
Method: smsSent

Any points would help!

Hello @Andreas_Marinopoulos

Try to change the type for “subscription_id” param, I can see that’s defined as “Any Object” but actually, it should be a String

Regards, Vlad