the problem I have is that when a user logs in to the Backendless app, I need to run JS code to pass the user ID to Intercom so the user can be identified and logged in to Intercom using the Intercom SDK.
If I understood you correctly, you can use the afterLogin event handler in the Cloud Code section for this purpose. This hook (event handler) will be called automatically by the Backendless after each successful login into Backendless, and there you’ll be able to run a request for login into a third-party service.
This doesn’t help as it doesn’t get the data passing between the Backendless code and the native SDKs in Flutter. With Intercom there is a requirement for the two to be able to pass data back and forth.
So for this case, the Intercom login wouldn’t be associated with the mobile phone user.
There is a way to do this. I’ll give an example below of how it works:
For example I need login user in JS code, then I need to pass it into Flutter code. Perform some actions with it and return some answer back into JS. This is code in Codeless:
When you click on this button, flutter receives a request to execute the “your_custom_func” method, in order to process this request, I will add this code to the bridge_manager class(58-65 into switch block):
case 'your_custom_func':
{
//something code
//For example intercom api
return buildResponse(
data: requestContainer,
response: 'Completed'); //maybe result of intercom api
}
The buildRequest() method then returns the response to the JS code.
If you have any questions, please ask, I will gladly try to help you.
Unfortunately, this is a new feature and is currently under development, so it has not yet been documented. So you can find out about the functionality of this feature only here
Please provide the custom code or codeless blocks you are calling to build and send this request.
I missed this nuance. The bridge is only available from the native app shell FOR MOBILE DEVICES. As far as I can tell, are you trying to run in a regular browser from a PC? It won’t work.
I was able to reproduce your error and find a solution.
If you pass a whole user object, then everything works without problems. It looks like a bug, we will look into this problem.
Can you try?