Set a custom redirect link

Ask the Community

Cord can send a Slack or email notification whenever a user is mentioned or when a thread is shared. By default, this notification contains a link to the page where the conversation happened. You have the option to redirect users to a custom URL instead.


Setup your custom Redirect URI in the Cord Console #

Login to the Cord Console, click on your project, then click the Notifications tab.

Paste your URL into the "Redirect URI" field.

What you will receive from Cord #

The notifications that Cord sends will contain a link to the URL you provided. Cord will add a query parameter cord_notifications to this URI.

For example, if you provided the follow Redirect URI:

Plaintext:
https://example.com/cord-redirect?original-page=home
https://example.com/cord-redirect?original-page=home
Copy

Cord will send you that URI with one additional parameter:

Plaintext:
https://example.com/cord-redirect?original-page=home&cord_notifications=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.TWF5IGFsbCB5b3VyIHdpbGRlc3QgZHJlYW1zIGNvbWUgdHJ1ZSEh.dQG0MD-iJd0ZNeOVbr6_UseoIwld8K92xtTvuK1yipk
https://example.com/cord-redirect?original-page=home&cord_notifications=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.TWF5IGFsbCB5b3VyIHdpbGRlc3QgZHJlYW1zIGNvbWUgdHJ1ZSEh.dQG0MD-iJd0ZNeOVbr6_UseoIwld8K92xtTvuK1yipk
Copy

The extra parameter has information about the notification. The parameter's value will be a JWT, signed with your project's secret, so that you know the redirect is coming from us.

You can see examples of the payload content for each notification type in the following steps.

Verify the JWT #

Always start by verifying the cord_notification JWT. See our authentication guide for more detail.

Handle requests #

For new users, your redirect URI can serve a sign-up flow that is personalized using the data from the cord_notifications payload.

For existing users, your redirect URI can simply redirect the user to the conversation. The URL of the conversation is always part of the cord_notifications payload as shown in the examples below.

Example | Mention notification via email #

Alice mentions Bob and Bob clicks on the link in his email notification. Bob is taken to<redirect_uri>?cord_notifications=<data> where data is a JWT with the following payload:

JSON:
{
  notificationInfo: {
    type: "email",
    sharerDetails: {
      userType: "Type of user the Alice is", // 'platform'
      userID: "Alice's ID",
      groupID: "Alice's group ID",
      name: "Alice",
      email: "Alice's email address", // could be null
      profilePictureURL: "url to Alice's profile picture", // could be null
    },
    targetDetails: {
      userType: "Type of user the Bob is", // 'platform' or 'slack'
      userID: "Bob's ID",
      groupID: "Bob's group ID",
      name: "Bob",
      email: "Bob's email address", // could be null
      profilePictureURL: "url to Bob's profile picture", //could be null
    },
    messageID: "Cord ID of the message that mentions Bob",
    threadID: "Cord ID of the thread that mentions Bob",
    url: "page URL where Bob was mentioned",
    timestamp: "time when Bob was mentioned",
  },
}
{
  notificationInfo: {
    type: "email",
    sharerDetails: {
      userType: "Type of user the Alice is", // 'platform'
      userID: "Alice's ID",
      groupID: "Alice's group ID",
      name: "Alice",
      email: "Alice's email address", // could be null
      profilePictureURL: "url to Alice's profile picture", // could be null
    },
    targetDetails: {
      userType: "Type of user the Bob is", // 'platform' or 'slack'
      userID: "Bob's ID",
      groupID: "Bob's group ID",
      name: "Bob",
      email: "Bob's email address", // could be null
      profilePictureURL: "url to Bob's profile picture", //could be null
    },
    messageID: "Cord ID of the message that mentions Bob",
    threadID: "Cord ID of the thread that mentions Bob",
    url: "page URL where Bob was mentioned",
    timestamp: "time when Bob was mentioned",
  },
}
Copy

Example | Mention notification via Slack #

Alice mentions Bob and Bob clicks on the link in his Slack notification. Bob is taken to<redirect_uri>?cord_notifications=<data> where data is a JWT with the payload below. Because Bob might not be a user of your product yet, we provide Bob's Slack user ID and Slack workspace ID.

JSON:
{
  notificationInfo: {
    type: 'slack',
    sharerDetails: {
      userType: "Type of user the Alice is", // 'platform'
      userID: "Alice's ID",
      groupID: "Alice's group ID",
      name: "Alice",
      email: "Alice's email address", // could be null
      profilePictureURL: "url to Alice's profile picture", // could be null
    },
    targetDetails: {
      userType: "Type of user the Bob is", // 'platform' or 'slack'
      userID: "Bob's ID",
      groupID: "Bob's group ID",
      name: "Bob",
      email: "Bob's email address", // could be null
      profilePictureURL: "url to Bob's profile picture", //could be null
    },
    messageID: "Cord ID of the message that mentions Bob",
    threadID: "Cord ID of the thread that mentions Bob",
    url: "page URL where Bob was mentioned",
    timestamp: "time when Bob was mentioned",
  },
}
{
  notificationInfo: {
    type: 'slack',
    sharerDetails: {
      userType: "Type of user the Alice is", // 'platform'
      userID: "Alice's ID",
      groupID: "Alice's group ID",
      name: "Alice",
      email: "Alice's email address", // could be null
      profilePictureURL: "url to Alice's profile picture", // could be null
    },
    targetDetails: {
      userType: "Type of user the Bob is", // 'platform' or 'slack'
      userID: "Bob's ID",
      groupID: "Bob's group ID",
      name: "Bob",
      email: "Bob's email address", // could be null
      profilePictureURL: "url to Bob's profile picture", //could be null
    },
    messageID: "Cord ID of the message that mentions Bob",
    threadID: "Cord ID of the thread that mentions Bob",
    url: "page URL where Bob was mentioned",
    timestamp: "time when Bob was mentioned",
  },
}
Copy

Example | Thread shared to a Slack channel #

Alice shares a Cord thread to a Slack channel. The URL of the thread in Slack will take users to <redirect_uri>?cord_notifications=<data> where data is a JWT with the following payload:

JSON:
{
  notificationInfo: {
    type: 'sharedToSlackChannel',
    sharerDetails: {
      userType: "Type of user the Alice is", // 'platform'
      userID: "Alice's ID",
      groupID: "Alice's group ID",
      name: "Alice",
      email: "Alice's email address", // could be null
      profilePictureURL: "url to Alice's profile picture", // could be null
    },
    targetDetails: {
      userType: "slack",
      groupID: "Slack ID of the channel's group",
      slackChannelID: "Slack ID of the channel",
    },
    threadID: "Cord ID of the shared thread",
    url: "page URL where Cord thread was created",
    timestamp: "time when Cord thread was shared to Slack",
  },
}
{
  notificationInfo: {
    type: 'sharedToSlackChannel',
    sharerDetails: {
      userType: "Type of user the Alice is", // 'platform'
      userID: "Alice's ID",
      groupID: "Alice's group ID",
      name: "Alice",
      email: "Alice's email address", // could be null
      profilePictureURL: "url to Alice's profile picture", // could be null
    },
    targetDetails: {
      userType: "slack",
      groupID: "Slack ID of the channel's group",
      slackChannelID: "Slack ID of the channel",
    },
    threadID: "Cord ID of the shared thread",
    url: "page URL where Cord thread was created",
    timestamp: "time when Cord thread was shared to Slack",
  },
}
Copy

Example | Thread shared to an email #

Alice shares a Cord thread to bob@mail.com. The URL in Bob's email will take Bob to <redirect_uri>?cord_notifications=<data> where data is a JWT with the following payload:

JSON:
{
  notificationInfo: {
    type: 'sharedToEmail',
    sharerDetails: {
      userType: "Type of user the Alice is", // 'platform'
      userID: "Alice's ID",
      groupID: "Alice's group ID",
      name: "Alice",
      email: "Alice's email address", // could be null
      profilePictureURL: "url to Alice's profile picture", // could be null
    },
    targetDetails: {
      userType: null,
      email: "bob@mail.com",
    },
    threadID: "Cord ID of the shared thread",
    url: "page URL where Cord thread was created",
    timestamp: "time when Cord thread was shared to email",
  },
}
{
  notificationInfo: {
    type: 'sharedToEmail',
    sharerDetails: {
      userType: "Type of user the Alice is", // 'platform'
      userID: "Alice's ID",
      groupID: "Alice's group ID",
      name: "Alice",
      email: "Alice's email address", // could be null
      profilePictureURL: "url to Alice's profile picture", // could be null
    },
    targetDetails: {
      userType: null,
      email: "bob@mail.com",
    },
    threadID: "Cord ID of the shared thread",
    url: "page URL where Cord thread was created",
    timestamp: "time when Cord thread was shared to email",
  },
}
Copy

Ready! #

With your redirect URI configured in the Cord console, and your server ready to handle requests, you're all done.


Not finding the answer you need? Ask our Developer Community

Ask Cordy