Git Product home page Git Product logo

Comments (10)

ndemir avatar ndemir commented on June 2, 2024 1

Thank you very much, it worked now.

from kommunicate-android-chat-sdk.

devashishmamgain avatar devashishmamgain commented on June 2, 2024

@ndemir can you try setting it to user object
https://docs.kommunicate.io/docs/android-authentication#passing-on-additional-details-as-metadata

from kommunicate-android-chat-sdk.

ndemir avatar ndemir commented on June 2, 2024

@devashishmamgain , thanks for your comment.
I tested it and it is not working.
I verified that I am passing the information correctly because I can see the details on Kommunicate UI correctly. I attached the screenshot.
The problem is; this metadata is not passed to the webhook that is configured in dialogflow.
screenshot

from kommunicate-android-chat-sdk.

devashishmamgain avatar devashishmamgain commented on June 2, 2024

Got it, let me check and get back to you

from kommunicate-android-chat-sdk.

Sunilkumarr avatar Sunilkumarr commented on June 2, 2024

@ndemir You can set the key KM_CHAT_CONTEXT as below use setting and pass the meta data this data will go in each and every message users sends in chat :

  Map<String,String> metadata1 = new HashMap<>();
  metadata.put("KM_CHAT_CONTEXT","Value");
  ApplozicClient.getInstance(MainActivity.this).setMessageMetaData(metadata1);

from kommunicate-android-chat-sdk.

devashishmamgain avatar devashishmamgain commented on June 2, 2024

@ndemir can you share the logs coming when you send a message?

from kommunicate-android-chat-sdk.

ndemir avatar ndemir commented on June 2, 2024

Hi @Sunilkumarr and @devashishmamgain ,

Here is the log I see on Android Studio, as you can see, it seems the metadata is being sent from the device:

I/MessageClientService: Sending message to server: {"applicationId":"xxx","attDownloadInProgress":false,"canceled":false,"clientGroupId":"xxx-lftqz","connected":false,"contactIds":"","contentType":0,"createdAtTime":1570542204146,"delivered":false,"deviceKey":"xxx-8ea6-4d8e-99e2-1a4890308412","groupId":xxx,"hidden":false,"key":"xxxxx-xxx","message":"xxx","metadata":{"a":"b","userId":"[email protected]","KM_CHAT_CONTEXT":"Value"},"read":true,"replyMessage":0,"sendToDevice":false,"sent":true,"sentMessageTimeAtServer":0,"sentToServer":true,"shared":false,"source":2,"status":1,"storeOnDevice":true,"type":5,"userKey":"xxx-xxxx"}

And, here is the log I see on webhook, and I don't see the metadata in the payload:
"payload": {\n "botId": "xxx-lftqz",\n "groupId": "xxxx",\n "messageSource": "2",\n "applicationId": "xxxxxxx",\n "attachments": []\n }

from kommunicate-android-chat-sdk.

devashishmamgain avatar devashishmamgain commented on June 2, 2024

Are you checking it in originalDetectIntentRequest?

https://docs.kommunicate.io/docs/bot-dialogflow-integration#pass-custom-data-to-bot-platform

from kommunicate-android-chat-sdk.

ndemir avatar ndemir commented on June 2, 2024

@devashishmamgain, yes.
here it is:
"originalDetectIntentRequest": {\n "payload": {\n "botId": "xxx-lftqz",\n "groupId": "xxx",\n "messageSource": "2",\n "applicationId": "xxxx",\n "attachments": []\n }\n },\n

from kommunicate-android-chat-sdk.

Sunilkumarr avatar Sunilkumarr commented on June 2, 2024

@ndemir You can use the below code to send the data to dialogflow and let us know if you face any issue.

import org.json.JSONObject;

     // JSON object key value pass the details here 

    JSONObject object = new JSONObject();
            try {
                object.put("key","value1");
                object.put("key1","value2");
                object.put("key2","value3");

            } catch (JSONException e) {
                e.printStackTrace();
            }

            Map<String,String> metadata = new HashMap<>();
            metadata.put("KM_CHAT_CONTEXT",object.toString()); // Converted to json object to string and passed 

            if (KMUser.isLoggedIn(this.activityContext)) {
                ApplozicClient.getInstance(this.activityContext).setMessageMetaData(metadata);
            }

            new KmConversationBuilder(this.activityContext)
                    .setSkipConversationList(true)
                    .setSingleConversation(true)
                    .setBotIds(null)
                    .setKmUser(user)
                    **.setMessageMetadata(metadata)**
                    .launchConversation(new KmCallback() {
                        @Override
                        public void onSuccess(Object message) {
                            System.out.println("onSuccess");
                            System.out.println(message);
                        }

                        @Override
                        public void onFailure(Object error) {
                            System.out.println("onFailure");
                            System.out.println(error);
                        }
                    });

from kommunicate-android-chat-sdk.

Related Issues (18)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.