Search code examples
quickblox

QuickBlox Chat. Send custom data with message


I successfully can send and receive messages with my JS implementation of QuickBlox Chat SDK. But I can't add custom data to any message.

      QB.chat.send(opponentId, {
        type: 'chat',
        custom: 'doesnt_work',
        body: currentMessage,
        extension: {
          save_to_history: 1,
        }
      });

Since this are 1-1 chat I didn't create a dialog. Dialog automatically created after first message sent.

Documentation telling me that this should work


Solution

  • Found answer by myself. Maybe this will be useful for somebody. Correct format:

      QB.chat.send(opponentId, {
        type: 'chat',
        body: currentMessage,
        extension: {
          save_to_history: 1,
          custom: 'it works'
        }
      });