Comments (10)
Thank you very much, it worked now.
from kommunicate-android-chat-sdk.
@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.
@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.
from kommunicate-android-chat-sdk.
Got it, let me check and get back to you
from kommunicate-android-chat-sdk.
@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.
@ndemir can you share the logs coming when you send a message?
from kommunicate-android-chat-sdk.
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.
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.
@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.
@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)
- speech to text by Google Cloud Platform HOT 1
- java.security.ProviderException: Failed to load generated key pair from keystore HOT 2
- Disable location permission HOT 2
- How to set parent activity for conversation activity? HOT 2
- Issue while launching conversation HOT 16
- Meta data's parameters are not received on server side HOT 9
- Wrong storage permission request on API version 10+ HOT 15
- Android 12 Support HOT 1
- Crash on Android 12 HOT 3
- enter_message_hint is never used HOT 4
- Update HOT 1
- Regarding Custom View for Registering the user to kommunicate HOT 2
- java.lang.NoClassDefFoundError: java.nio.charset.StandardCharsets in Android API < 19 HOT 3
- Unsafe cipher mode error
- Zendesk authentication always fails HOT 4
- Image problem on Android 10 OS HOT 5
- Kommunicate giving exception when logging in in Release Build but working good in Debug Build HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kommunicate-android-chat-sdk.