Rocket.chat: Telegram integration (Sticker attachments)

Created on 21 Dec 2016  路  7Comments  路  Source: RocketChat/Rocket.Chat

Hi we like to integrate Telegram,
The documented way is pure text to text. But Sticker Attachments etc are the real deal for any integration. Do you think its possible?

Thanks

All 7 comments

+1

Would you please read what i have written? The Problem is that the solution from rocket.chat/docs is just a text to text way. We need a way to transfer attachments and Stickers

HI there:
The following worked for me @Againstreality:

class Script {
    process_incoming_request({ request }) {
        // COMMENT THE BELOW LINE THE AFTER YOU RUN THE INTEGRATION SUCCESSFULLY
        console.log(request.content);
        if ('edited_message' in request.content) {
            request.content.message = request.content.edited_message;
        }
        let who = request.content.message.from.username
        if(!who)  {
          who = `${request.content.message.from.first_name} ${request.content.message.from.last_name}`
        }
        let body = request.content.message.text

        if(!body) {
          if(request.content.message.sticker.emoji) {
            // It's a sticker
            body = request.content.message.sticker.emoji            
        } else {
           return {}
          }
        }

        return {
            content: {
                username: who,
                icon_url: '/avatar/' + request.content.message.from.username + '.jpg',
                text: body
            }
        };
    }
}

you are awsome !! Thx have you found a way to transfer attachments?

@Againstreality if you look at the sample code, I updated it to what I'm using right now.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mattlin picture mattlin  路  3Comments

Kiran-Rao picture Kiran-Rao  路  3Comments

lunitic picture lunitic  路  3Comments

marceloschmidt picture marceloschmidt  路  3Comments

antn89 picture antn89  路  3Comments