Cord can send Slack and email notifications whenever a user is mentioned or when a Cord thread is shared either to a Slack channel or to an email address.
Each notification contains a URI which by default takes a user to the page
where the conversation happened. You have the option to instead redirect
users to your custom URI. Cord will include a special query parameter
cord_notifications
in the redirect with information about the
notification. The value of the cord_notifications
query parameter will be
a JWT signed with your secret so that you know the redirect is coming from
us. The payload of the JWT depends on the notification type. You can see an
example of the payload content for each notification type in the code
examples.
The most common way to use the custom redirect URI is as follows. Always
start by verifying the cord_notifications
is a JWT signed with your
<SECRET>
. Then 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 on the side.
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 computed as below:
import jwt from 'jsonwebtoken';
const data = jwt.sign(
{
notificationInfo: {
type: "email",
sharerDetails: {
userType: "Type of user the Alice is", // 'platform'
userID: "Alice's ID",
orgID: "Alice's organization 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",
orgID: "Bob's organization 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",
},
},
<SECRET>,
);
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 computed as below. Because Bob might not be yet a user of your product, we provide Bob’s Slack user ID and Slack organization ID.
import jwt from 'jsonwebtoken';
const data = jwt.sign(
{
notificationInfo: {
type: 'slack',
sharerDetails: {
userType: "Type of user the Alice is", // 'platform'
userID: "Alice's ID",
orgID: "Alice's organization 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",
orgID: "Bob's organization 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",
},
},
<SECRET>,
);
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 computed as below:
import jwt from 'jsonwebtoken';
const data = jwt.sign(
{
notificationInfo: {
type: 'sharedToSlackChannel',
sharerDetails: {
userType: "Type of user the Alice is", // 'platform'
userID: "Alice's ID",
orgID: "Alice's organization ID",
name: "Alice",
email: "Alice's email address", // could be null
profilePictureURL: "url to Alice's profile picture", // could be null
},
targetDetails: {
userType: "slack",
orgID: "Slack ID of the channel's organization",
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",
},
},
<SECRET>,
);
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
computed as below:
import jwt from 'jsonwebtoken';
const data = jwt.sign(
{
notificationInfo: {
type: 'sharedToEmail',
sharerDetails: {
userType: "Type of user the Alice is", // 'platform'
userID: "Alice's ID",
orgID: "Alice's organization 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: "pageURL where Cord thread was created",
timestamp: "time when Cord thread was sent to Bob",
},
},
<SECRET>,
);