Skip to content

[question]: External ID example doesn't seem to be working #1037

Open
@EsinShadrach

Description

@EsinShadrach

How can we help?

How do I target a specific user? I presently have a basic example to send a push notif to a set of users via the external ID but it send to like all the device, cause I know the device I'm on has an external ID of "5"

const options = {
  method: "POST",
  headers: {
    accept: "application/json",
    Authorization: `Key ${apiKey}`,
    "content-type": "application/json",
  },
  body: JSON.stringify({
    app_id: appId,
    // for grouping notifs
    collapse_id: "fixture_id_here",
    headings: { en: "Hello from Backend" },
    contents: { en: "Your message body here." },
    included_segments: ["Total Subscriptions"],
    target_channel: "push",
    include_aliases: {
      external_id: ["user1", "user2", "user3"],
    },
  }),
};

fetch(url, options)
  .then((res) => res.json())
  .then((json) => console.log(json))
  .catch((err) => console.error(err));

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions