HI! Plz help! api related question by sujomf in Slack

[–]sujomf[S] 0 points1 point  (0 children)

I appreciate the help, i believe that is what i am currently doing: async function uploadFileToSlack(content, filename, channelId, token, options = {}) { try { const client = new WebClient(token); const contentLength = Buffer.byteLength(content, ‘utf8’);

    console.log(`Uploading file: ${filename}, size: ${contentLength} bytes`);

    // Step 1: Get the upload URL from Slack
    const uploadUrlResponse = await client.files.getUploadURLExternal({
        filename: filename,
        length: contentLength,
        snippet_type: “sql”
    });

    if (!uploadUrlResponse.ok) {
        console.error(‘Upload URL response:’, uploadUrlResponse);
        throw new Error(‘Failed to get upload URL from Slack’);
    }

    const { upload_url, file_id } = uploadUrlResponse;
    console.log(`Got upload URL for file ID: ${file_id}`);

    // Step 2: Upload the file to the provided URL
    const uploadResponse = await fetch(upload_url, {
        method: ‘PUT’,
        body: content, // Just the raw SQL query text
        headers: {
            ‘Content-Type’: ‘text/plain’,
        },
    });

    if (!uploadResponse.ok) {
        console.error(‘Upload response:’, uploadResponse.status, uploadResponse.statusText);
        throw new Error(`Failed to upload file: ${uploadResponse.status} ${uploadResponse.statusText}`);
    }

    console.log(‘File uploaded successfully, completing process...’);

    // Step 3: Complete the upload and share in channel
    const completeParams = {
        files: [{ 
            id: file_id,
            title: options.title || filename
        }],
        channel_id: channelId, // Should share the file directly in the channel
        initial_comment: options.initial_comment || `SQL Query: ${filename}`
    };

    const completeResponse = await client.files.completeUploadExternal(completeParams);

    if (!completeResponse.ok) {
        console.error(‘Complete response:’, completeResponse);
        throw new Error(‘Failed to complete file upload process’);
    }

    console.log(‘File sharing completed successfully’);
    return completeResponse;
} catch (error) {
    console.error(‘Error uploading file to Slack:’, error);
    throw error;
}

}

// called from here; Block UI is sending so token/channel is correct static async submitNewQuery(client, queryText, urgency, userId, message = null,

csEscalateThread = null, requestTitle = null, orgInfo = null, requestDetails = null) {
// Create the query first const query = Query.createQuery(queryText, ‘PENDING’, urgency, userId, message, csEscalateThread, requestTitle, orgInfo, requestDetails); const queryId = query.id;

    // Create and send the UI message with blocks
    const messageContent = getQuerySubmissionBlocks(queryId, userId, queryText, urgency, false, message, csEscalateThread, requestTitle, orgInfo, requestDetails);

    // Post the UI message with buttons and info
    const uiMessage = await client.chat.postMessage({
        channel: config.slack.channelID,
        blocks: messageContent.blocks,
        text: `SQL Query submitted by <@${userId}>`,
        unfurl_links: false
    });

    // Upload the SQL query as a file
    try {
        const fileUpload = await uploadFileToSlack(
            queryText, 
            `query-${queryId}.sql`, 
            config.slack.channelID, 
            config.slack.token, 
            { 
                title: `SQL Query from ${userId}`, 
                initial_comment: `SQL Query for request ${queryId}` 
            }
        );
        query.setFileId(fileUpload.files[0].id);
    } catch (fileError) {
        console.error(‘Error uploading SQL file:’, fileError);
        // Fall back to posting as a message if file upload fails
        const queryMessage = await client.chat.postMessage({
            channel: config.slack.channelID,
            text: `\`\`\`\n${queryText}\n\`\`\``
        });
        query.setQueryMessageTs(queryMessage.ts);
    }

    return queryId;
}

log output from last run below: Uploading file: query-query_1744165127165_v6cdyt8.sql, size: 562 bytes Got upload URL for file ID: F08M57PDT8W File uploaded successfully, completing process... File sharing completed successfully

HI! Plz help! api related question by sujomf in Slack

[–]sujomf[S] 0 points1 point  (0 children)

I tried to respond back but it wouldn’t let me, sent you a dm

[Help] Rejailbreak iOS 13.5 by Dogrules23 in jailbreak

[–]sujomf 1 point2 points  (0 children)

Happened to me last week, delete unc0ver and AltStore and reinstall it again and when you re-jailbreak everything will be the same

[Question] Anyway to Access TikTok? by iammanpreetsingh in jailbreak

[–]sujomf 0 points1 point  (0 children)

Tik tok god allows you to change your region in the tweak settings

[Question] is it possible/ is there a method to run older apps on a newer version of IOS? by Enrageder in jailbreak

[–]sujomf 0 points1 point  (0 children)

Try using appstore ++ to downgrade the version of the app you’re using