@mentions through API

Rafał Rataj
Tera Contributor

Hi, 

I have the @mentions notification enabled on my instance and can properly use the mentions on tickets if done manually . 

 

However we have some automations in place raising tickets from eg monitoring tools. the requirement is to have the @mentions pushed from API also sending an email. 

 

Now it seems while in auto-suggesting users ServiceNow does some magic to trigger the mentions. as it the journal fields the mentions are only text that does not differ from the text from the API. 

 

So is anyone able to help me, even with explaining in technical detail the mentions mechanizm? 
how it is pushed from the task tables to the live_notification table?  

Thank You!

2 REPLIES 2

Rafał Rataj
Tera Contributor

ok in the end it works with @ [sys_id:user_name] message through the API 

 

exactly this way it is stored in the [live_mention] table 

 

if someone needs more detailed steps those are following:

  • An '@' is typed in a mention-integrated text area
  • Fire a request from the REST back end at "/now/v1/form/mention" (not a public api).
  • As more characters are typed after the '@' step 2 is called with more data
  • The REST service checks the permissions of the first 5 active users
  • The REST service returns these first 5 users
  • The mention popup displays the list of the first 5 users
  • The user chooses one of these users
  • An "at mention" readable code is added to the message
  • The message is posted
  • The message is parsed for the at mentioned text
  • A live_message record is created
  • A live_mention record is created
  • The "Broadcast Chat APNS" (f110e602d710020023c84f80de610360) BR on insert for live_mention is fired
  • new GlideLiveMessagePushNotifier().broadcastMentionFromRecord(current) with the new insert is called
  • the at mention user is looked up
  • the at mention user permissions are check
  • a broadcast message is sent
  • The Event manager queues the at mention
  • An entry is made in the sysevent table
  • low-level event batching happens
  • "Activity Stream @Mention Email" or " Live Message Mention" email is sent

scottl
Kilo Sage

Good work in detailing your findings. I will add that the second parameter in the brackets is a plain text output, shown in the comment, and would generally be the user's name.  

Thanks.