Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SubscriberApi.GetNotificationFeed: JSON unmarshal error #69

Open
stonymahony opened this issue Nov 3, 2023 · 0 comments
Open

SubscriberApi.GetNotificationFeed: JSON unmarshal error #69

stonymahony opened this issue Nov 3, 2023 · 0 comments

Comments

@stonymahony
Copy link

I get the following error when using the SubscriberApi.GetNotificationFeed API with novu cloud and this sdk@0.1.2:

unable to unmarshal response body: json: cannot unmarshal array into Go struct field .data.cta.Action.buttons of type struct { Type string "json:\"type\""; Content string "json:\"content\""; ResultContent string "json:\"resultContent\"" }

There seems to be something wrong with the types.

The model for CTA of the SDK:

type CTA struct {
	Type   string `json:"type"`
	Action struct {
		Status  string `json:"status"`
		Buttons struct {
			Type          string `json:"type"`
			Content       string `json:"content"`
			ResultContent string `json:"resultContent"`
		} `json:"buttons"`
		Result struct {
			Payload map[string]interface{} `json:"payload"`
			Type    string                 `json:"type"`
		} `json:"result"`
	}
}

Example response from the novu API which caused the error:

"cta": {
        "action": {
          "status": "pending",
          "buttons": [
            {
              "type": "primary",
              "content": "Primary",
              "_id": "6544fb84010788e821cdaeb7",
              "id": "6544fb84010788e821cdaeb7"
            }
          ]
        },
        "type": "redirect",
        "data": {
          "url": "[object Object]"
        }
      }

Is the SDK not compatible with the current novu version?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant