As a temporary workaround for not being able to send push messages from within a Flutter app, you can add a web service block that allows app users with a certain role to send push messages. We'll show you how to set this up for "Boss" type users in this simple and basic tutorial.
Prerequisites:
- Pro subscription
- It helps when you have some experience with using web services in AppMachine, but it is not a strict requirement.
- Start by adding a new web service block to your app:
- Select the "Custom web service" option from the list after adding the block:
- In the next screen, select the "POST" from the dropdown:
- As URL enter the following URL: https://api.appmachine.com/v1/pushnotification
- Select the "AppMachine API" option from the Authorization provider dropdown:
- Add the following parameters in the Body tab:
message isEnabledIOS: true isEnabledAndroid: true
Like this:
Don't forget to set the "message" field to "required". Click next, name your web service and then click next again:
Name your block and you're done with adding the block:
Remove the "IsEnabledIOS" and "IsEnabledAndroid" fields from your layout so your left with this:
Change the button text if you want:
Add a Lock block with the following lock type:
And the following settings:Place the Push web service block nested below the Lock block:
You're done!
Notes: There is no way of displaying the amount of characters the user has left to type. There is a limit of 140, so you may want to add a label to inform the user about this. They'll have to keep an eye on the length of the message themselves.