Insert text in the chat input

Hello. I trying to do this. But i need it in firefox extension. I'm including:

and do this:

require('chat', function(chat) {

So, iframe.min.js say me this:

Error: See almond README: incorrect module build, no module name.

Could anyone give me full code (outside the HipChat ext) or say what i missed? Thanks.

4 answers

0 vote

You have to use the AP. prefix in front of require... like so:

AP.require('chat', function(chat) {

BTW, aui.js and jquery aren't required for that to work.

ReferenceError: AP is not defined

        function() {
                function() {
                    AP.require('chat', function(chat) {

Seems i missed some js libs to include.

Why are you loading the script via ajax? Just add it to your <head>.

It's not about html, it's about my firefox plugin. This example - only for clarity

So, where is AP? How i can to include it?

I'm injecting this code direct to room chat.

And after including iframe.min.js i have: Uncaught Error: See almond README: incorrect module build, no module name I googled many times, but could not fix it. It want i define some name


Would you mind explaining what it is you're trying to build? The HipChat Connect framework is meant to be used for addons that run within HipChat, and will not work outside that scope.

So for example, if you're building an extension for Firefox, you won't be able to use HipChat Connect.

Generally, i'm writing firefox plugin which must send some message via chat input. Couldn't do it via javascript button pressing emulation and etc, so, i noticed to api. Ideally i want just set text to input.

Ah... why don't you just access the chat input element directly and update the value then? The iframe.min.js you're including is specifically for use with HipChat Connect add-ons, not browser add-ons.

Scratch that... use the `HC.api.appendMessage({text:"TEXT"})` js api to append text to the chat input. Assuming you'll be able to execute you JS directly on the page.

Rich, u are my savior! But where i can read about this api? Considering full task, i need to catch message sending, change message and send. It's real via hacks although...

I have tryed to foreach HC.api, but it haven't any interisting things :( Can i register message-catch event or clear the input?

Found! webpack://./src/js/app/api.js. It haven't input clearer but.. it have sendMessage smile

Suggest an answer

Log in or Join to answer
Community showcase
Maarten Cautreels
Published Oct 07, 2017 in Hipchat

Bringing Structure to your HipChat Instance

...have mention name FirstnameLastname. Fe.: @MaartenCautreels This certainly helps to know who is being mentioned in a conversation. Imagine your colleague sends the following message...

458 views 1 4
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot