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
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'
}
});
Related
I'm sending images and pdf through gifted chat with twilio messaging. After sending I'm having trouble to show documents in gifted-chat ui.
Here is the message object which gifted chat will accept:
{
_id: 1,
text: 'My message',
createdAt: new Date(Date.UTC(2016, 5, 11, 17, 20, 0)),
user: {
_id: 2,
name: 'React Native',
avatar: 'https://facebook.github.io/react/img/logo_og.png',
},
image: 'https://facebook.github.io/react/img/logo_og.png',
// You can also add a video prop:
video: 'http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4',
// Mark the message as sent, using one tick
sent: true,
// Mark the message as received, using two tick
received: true,
// Mark the message as pending with a clock loader
pending: true,
// Any additional custom parameters are passed through
}
How can i attach pdf(document) link in here,
Currently am attaching pdf url with key of image and it is returning blank coz it is recognising that url as an image.
How can i show pdf instead of blank their?
Here is the current result
I think you can define "document" in your message object rather than using "image".
Then you can customize your document message in the props renderCustomView like this:
// Custom render message
const renderCustomView = (props) => {
// Custom document message
if (props.currentMessage.document) {
// Your custom pdf message
}
}
I'm trying to send a text message to a WhatsApp contact from a react-native apps , i found that i can do it through Linking
Linking.openURL('whatsapp://send?text=hello');
the above code opens whatsapp. I would like to send message without opening whatsapp
you can do it using Share.shareSingle from react-native-share package
const shareOptions = {
title: 'Share via',
message: 'some message',
url: 'some share url',
social: Share.Social.WHATSAPP,
whatsAppNumber: "9199999999", // country code + phone number
filename: 'test' , // only for base64 file in Android
};
Share.shareSingle(shareOptions)
.then((res) => { console.log(res) })
.catch((err) => { err && console.log(err); });
The shareSingle() method allows a user to share a premade message via
a single prechosen social medium. In other words, code specifies both
the message that will be sent and the social medium through which the
message will be sent. The user chooses only to whom the message is
sent. This shared message may contain text, one or more files, or
both.
Checkout - https://react-native-share.github.io/react-native-share/docs/share-single
also i've given working example to share multiple or single images using react-native-share as answer to a question about how to do it. might be useful.
Checkout Here
I am implementing it .
react-native-google-pay
It is installed and showing a login popup as expected but i am not able to get how can i test it. As there is no way to test it.
this is my code
const requestData = {
cardPaymentMethod: {
tokenizationSpecification: {
type: 'PAYMENT_GATEWAY',
gateway: 'stripe',
gatewayMerchantId: '',
stripe: {
publishableKey: '',
version: '2018-11-08',
}
},
allowedCardNetworks,
allowedCardAuthMethods,
},
transaction: {
totalPrice: amount_to_add,
totalPriceStatus: 'FINAL',
currencyCode: 'USD',
},
merchantName: 'Merchant',
};
In this what is the value of gatewayMerchantId,type.
And Let me know if someone have dummy cards or a way to test it. As it is showing error, as well as no trasaction response of 200 or rejection.
I haven't done a Google Pay integration with Stripe, but react-native-google-pay looks like a thin wrapper around the Google Pay API. I'd suggest looking at Google Pay's documentation to supplement the holes in the library's documentation.
In this case, I'd suggest changing the values in the tokenizationSpecification to match Google Pay's docs:
const requestData = {
cardPaymentMethod: {
tokenizationSpecification: {
type: 'PAYMENT_GATEWAY',
parameters: {
gateway: "stripe"
"stripe:version": "2018-10-31"
"stripe:publishableKey": "YOUR_PUBLIC_STRIPE_KEY"
}
},
allowedCardNetworks,
allowedCardAuthMethods,
},
transaction: {
totalPrice: amount_to_add,
totalPriceStatus: 'FINAL',
currencyCode: 'USD',
},
merchantName: 'Merchant',
};
When I integrated to Google Pay, I used my real credit card number (I was unable to get anything fake into Google Pay) and enabled test mode. The library seems to support that test mode like this:
// Set the environment before the payment request
GooglePay.setEnvironment(GooglePay.ENVIRONMENT_TEST);
SDK Version: 37
Platforms(Android/iOS/web/all): Android (Expo Client)
I’m using useAuthRequest from expo-auth-session to fetch an authentication code for itsme, a Belgian OpenID Connect authentication provider. I'm using the Expo client on Android.
The code looks like this:
export default function SignUpScreen() {
const discovery = useAutoDiscovery('https://e2emerchant.itsme.be/oidc');
const [request, response, promptAsync] = useAuthRequest(
{
clientId: Itsme.CLIENT_ID,
redirectUri: makeRedirectUri(),
scopes: [
'openid',
'service:CURVO_TEST_SHAREDATA',
'profile',
'email',
'phone',
'address'
],
extraParams: {
claims: JSON.stringify({
userinfo: {
'tag:sixdots.be,2016-06:claim_nationality': null,
'tag:sixdots.be,2016-06:claim_city_of_birth': null,
'tag:sixdots.be,2016-06:claim_eid': null,
'tag:sixdots.be,2017-05:claim_photo': null
}
})
}
},
discovery
);
return (
<TouchableOpacity onPress={promptAsync}>Log in</TouchableOpacity>
);
When the “Log in” button is pressed, the following happens:
(OK) The itsme application is correctly opened. I can tell that the scopes have also been correctly communicated.
(OK) I can authenticate within the itsme application with my itsme PIN code.
(OK) The itsme application then closes, which is expected.
(OK) My app is re-opened.
(NOT OK) The response variable becomes equal to { type: 'dismiss' }.
Whatever I do, the response is always “dismiss”. I find it strange because the docs say:
If the authentication is dismissed manually with AuthSession.dismiss() , the result is { type: 'dismiss' } .
However, I never call AuthSession.dismiss().
It looks like it’s failing right at the last step, when it’s supposed to parse the authorization code out of the response URL.
I tried several things:
starting Expo in all three modes: tunnel, lan, localhost
adding a path to the redirect URI, like makeRedirectUri({ path: '/itsme' })
the AppState.currentState “trick” described in a (related?) GitHub issue.
None of these tries worked and I’m out of ideas. Any thoughts or suggestions? Or maybe how to debug inside `expo-auth-session to see what’s going on?
Thank you in advance.
I am struggling to find the correct syntax and specific payload keys to achieve collapsable and non-collapsable notifications on iOS, and non-callapsable notifications on Android. I've got collapsable working on Android, so I know I'm moving in the right direction.
I am using the admin.messaging().send(payload) function in my Node.js Cloud Functions file.
My collapsable payload example:
{
notification: {
title: `${userName}`,
body: `${message.msg}`
},
data: {
click_action: "FLUTTER_NOTIFICATION_CLICK",
v_type: 'chatMsg',
v_uid: uid,
v_cid: cid,
},
android: {
collapse_key: cid,
},
apns: {
headers: {
'apns-collapse-id': cid,
}
},
token: tokenDoc.data().notificationToken,
}
For non collapsable messages I use the 'apns-id' key instead of 'apns-collapse-id'. I'm not sure what the equivalent is for android. The documentation on Firebase covers these keys, but there is no example of how the payload structure should look.
Firebase documentation states that messages are non collapsable by default, but how does the device know when to replace an existing notification related to the same information? I assume I have to set an id for the device to know to overwrite an existing notification.