title: RTM:ERROR Error Code 102: sendMessage failed with args: {"messageType":"TEXT"}
body: <p>I am developing a chat service using channel messaging of Agora RTM WebSDK. I would like to call the sendMessage method and to send the input message (input element with id is &quot;message&quot;) when the send button is pushed. However, RTM ERROR has occurred and the sendMessage method did not work when the sendMessage method is called. I confirmed the token was generated and the login was succeeded.  The script and the error are as follows.</p>
  <pre><code>&lt;template&gt;
      &lt;div&gt;
          &lt;table class=&quot;comment-sender-box&quot;&gt;
              &lt;tr&gt;
                  &lt;td colspan=&quot;3&quot;&gt;
                      &lt;textarea id=&quot;chatBox&quot; rows=&quot;4&quot; cols=&quot;40&quot;&gt;{{ messages }}&lt;/textarea&gt;
                  &lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                  &lt;td colspan=&quot;2&quot; class=&quot;message-wrapper&quot;&gt;
                      &lt;input id=&quot;message&quot; v-model=&quot;message&quot;&gt;
                  &lt;/td&gt;
                  &lt;td class=&quot;btnSendMessage-wrapper&quot;&gt;
                      &lt;button id=&quot;btnSendMessage&quot;&gt;
                          &lt;font-awesome-icon icon=&quot;paper-plane&quot; /&gt;
                      &lt;/button&gt;
                  &lt;/td&gt;            
              &lt;/tr&gt;
          &lt;/table&gt;
          
      &lt;/div&gt;
  &lt;/template&gt;
  
  &lt;script&gt;
      import Vue from 'vue';
      import {RtcTokenBuilder, RtmTokenBuilder, RtcRole, RtmRole} from 'agora-access-token';
      import AgoraRTM from 'agora-rtm-sdk';
      import { library } from '@fortawesome/fontawesome-svg-core';
      import { fas } from '@fortawesome/free-solid-svg-icons';
      import { fab } from '@fortawesome/free-brands-svg-icons';
      import { far } from '@fortawesome/free-regular-svg-icons';
      import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
      library.add(fas, far, fab);
      Vue.component('font-awesome-icon', FontAwesomeIcon);
  
      export default Vue.extend({
          data: {
              name: '',
              messages: '',
              message: ''
          },
          async created() {
              this.name = this.$route.query.user;
              var user_id = this.name;
              const appID = &quot;**********&quot;;
              const channelName = &quot;**********&quot;;
  
              const chat_token = await function(){
                  const appCertificate = &quot;**********&quot;;
                  const role = RtmRole.Rtm_User;
                  const expirationTimeInSeconds = 36000;
                  const currentTimestamp = Math.floor(Date.now() / 1000);
                  const privilegeExpiredTs = currentTimestamp + expirationTimeInSeconds;
                  const token = RtmTokenBuilder.buildToken(appID, appCertificate, user_id, role, privilegeExpiredTs);
                  console.log(&quot;RTM Token : &quot; + token);
                  return token
              };
  
              const chat_client = AgoraRTM.createInstance(appID);
              chat_client.on('ConnectionStateChanged', (newState, reason) =&gt; {
                  console.log('on connection state changed to ' + newState + ' reason: ' + reason);
              });
              chat_client.login({ token: chat_token(), uid: user_id }).then(() =&gt; {
                  console.log('AgoraRTM client login success');
              }).catch(err =&gt; {
                  console.log('AgoraRTM client login failure', err);
              });
              const chat_channel = chat_client.createChannel(channelName);
              chat_channel.join().then(() =&gt; {}).catch(error =&gt; {});
              chat_channel.on('ChannelMessage', ({ text }, senderId) =&gt; {
                  this.messages = this.messages + &quot;\n&quot; + text;
              });
  
              document.getElementById(&quot;btnSendMessage&quot;).addEventListener(&quot;click&quot;, ()=&gt;{
                  chat_channel.sendMessage({text: 'test message'}).then(() =&gt; {
                      this.messages = this.messages + &quot;\n&quot; + this.message;
                  }).catch(error =&gt; {});
              })
          }
      })
  
  &lt;/script&gt;
  </code></pre>
  <pre><code>RTM:ERROR Error Code 102: sendMessage failed with args: {&quot;messageType&quot;:&quot;TEXT&quot;}.
  </code></pre>