JavaScript
async function shareAlert(alertId, userId, message, email) { const url = `/api/social/v4/alerts/${alertId}/share`; const payload = { userMessage: message, alertSubscriptions: [{ subscriberId: userId, type: 'USER' }], sendEmail, metaData: {}, }; const response = await fetch(url, { body: JSON.stringify(payload), }); return await response.json();}
"{ \"userMessage\": \"I think you'll find this alert useful\", \"alertSubscriptions\": [{ \"subscriberId\": 12345, \"type\": \"USER\" }], \"sendEmail\": true, \"metaData\": {}}"
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Bearer <token>
<token>
The alertId
The message you want to send to the person
The entities you want to share the alert with. See above for entity params.
Whether or not to send an email to the person once the alert is shared
Returns the parameter of success or error based on the alert id being valid.
The response is of type object.
object