Swrve’s single Push and Batch Push APIs enable you to send a push notification to a single user or a group of users that is triggered by an external event from a third-party system. You can configure the notification to include predefined content or create a custom message by triggering an external call to the Push API. For more information about configuring your request to the Push API, see the Swrve push API guide and the Swrve batch push API.
Create a push API campaign
To create a push API campaign and get the campaign-specific Push API key:
Step 1: On the Campaigns menu, select Create campaign.
Step 2: On the Choose your marketing channel screen, select Push as the marketing channel, then Push via API as the notification type, and then select Continue.
Step 3: On the Overview screen, enter the notification Name, Description and Platform, and then select Next: Default Content.
Step 4: On the Default Content screen, add the default content of your push notification (for example, text, emoji, media, buttons, alert sound, custom parameters), if required. This step is optional—if the API call includes custom parameters, it overwrites the default content. Select Next: Campaign Goals to proceed.
Step 5: On the Campaign Goals screen, specify the campaign goals and then select Save as Draft: Preview & Test.
Step 6: The Preview & Test screen displays your Push API Key, the Push API URL, and a summary of the campaign. To QA test the Push API campaign:
- Select the Select a QA Device to test with list and select the QA device to which you want to send the test message.
- After you select a QA device, the screen displays sample curl and HTTP POST commands relevant to this campaign and the selected QA device. Run the curl command in the terminal to send a test message to the device. Alternatively, copy the HTTP POST command to a REST client service like Insomnia or Postman (remembering to use POST, not GET). You can edit the message content as required.
Step 7: If the QA test is successful, to start the campaign, select Make Active.
After you make the campaign active, you can use the Push API key and URL to trigger push notifications to individual users from a third-party system. This may be via webhooks in another marketing package (for example, Marketo) or using your own custom code. For more information on the API call method, URL parameter, expected responses and possible error codes, see the Swrve push API guide and Swrve batch push API guide.
Viewing push API results
To view details and results for a particular campaign, select the push notification from the push campaigns listed on the Campaigns screen to display the Campaign Summary screen. For campaigns in any status other than Draft, the individual campaign screen displays a detailed report of your campaign results. The results reflect any users who engage with the push notifications triggered via the Push API key associated with this campaign. For more information on the individual campaign screen, see Managing push notifications.
- Use the campaign-specific Push API key to send calls to the single user Push API or to a group of users via the Swrve Batch Push API. For more information, see the Swrve push API guide or Swrve batch push API guide.
- View results or reports for your single user Push API campaign or change the status. For more information, see Managing push notifications.