Slack: Get Slack Id By Questetra Account User
Retrieves the ID from the Slack user profile. The user profile is identified using the Questetra account email address as the key. You can post a message with mentions using your ID.
  • C1: OAuth2 Setting *
  • C2: Select QUSER Data for Questetra Account User *
  • C3: Select STRING DATA for Slack ID *
Script (click to open)

function main() {
  const oauth2 = configs.get("conf_OAuth2");
  let text = "";
  if (configs.get("Text") !== "" && configs.get("Text") !== null){
    text = configs.get("Text");
  const quserNum = configs.get("conf_Quser");
  const email = engine.findDataByNumber( quserNum ).getEmail();
  const slackIdNum = configs.get("conf_SlackId");
  engine.log("email: " + email);
  const id = usersLookupByEmail(oauth2, email);
  engine.setDataByNumber( slackIdNum, id );
  * users.lookupByEmail
  * @param {String} oauth2 
  * @param {String} email
function usersLookupByEmail(oauth2, email) {

  let getUri = "";
  let request = httpClient.begin()
  if (oauth2 !== "" && oauth2 !== null){
    request = request.authSetting(oauth2);
  request = request.queryParam( "email", email );
  const response = request.get( getUri );
  const status = response.getStatusCode();
  const responseTxt = response.getResponseAsString();

  let responseJson;
  try {
    responseJson = JSON.parse(responseTxt);
  } catch(e) {
    engine.log("failed to parse as json");
    engine.log(`status: ${status}`);
    throw `Failed to users lookup By email. status: ${status}`;

  if (responseJson.ok !== true ) {
    const error = `Failed to send`;
    engine.log(`status: ${status}`);
    throw error;
  engine.log('Slack Id:' +;


2022-03-14 (C) Questetra, Inc. (MIT License)
The Add-on import feature is available with Professional edition.
Freely modifiable JavaScript (ECMAScript) code. No warranty of any kind.


  • Gets an ID from the user profile on Slack, the business communication tool
    • You can use the retrieved ID when posting a mentioned message to Slack
    • Example of specifying a mention: “<@XXXXXXXX>” (“XXXXXXXX” should be the ID)
  • You need to create a “Slack app” in advance
    • For creating a new app click Create New App in [Settings & administration] > [Manage apps] > [Build]
    • Setting example
      • (Wizard)
        • App Name: BPMS Notification
        • Pick a workspace to develop your app in: (Select your workspace)
      • Basic Information
        • Make a note of the “Client ID” and “Client Secret” in App Credentials
        • (These will be used HTTP Authorization Setting in Questetra)
      • OAuth & Permissions
        • Bot Token Scopes: Add “users:read”, “”
      • Redirect URLs: Add “”



See also

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: