Integrate between Mobilize and Slack, enabling you to sync new members from your Mobilize community to Slack.
The suggested solution supports the requested flow in which, new members who were approved to join your community on Mobilize, automatically get an invitation to join the corresponding Slack community.
Here's how:
You will need to build a small webapp that communicates with both Mobilize and Slack through an API.
The webapp will be in charge of listening to whenever a new member is approved to join your community on MObilize and then call Slack in order to send an invitation to the new members.
There are 3 steps in the webapp flow:
- Listen to the “Member Approved” webhook
- Get member’s info
- Send invitation to Slack
Accessing Mobilize’s API
To use Mobilize’s API, you will have to generate a token using the following guide.
https://mobilize.readme.io/docs/getting-started
Listen to “Member Approved” webhook
Subscribe to a “Member Approved” webhook, and get notified whenever a user is approved in the community.
You will be notified with:
- User ID
- Group ID
Get Member Info
Once the user is created, you can get all the necessary info including email address and group joined using this API call.
https://mobilize.readme.io/docs/get-a-single-user
Integration with Slack
Go here and generate a token to your app. Make sure that you have admin privileges for the app to be able to access to all API.
https://api.slack.com/docs/oauth-test-tokens
Invite a new member to Slack
Use the following API call to slack in order to invite the new member using email address.
curl -X POST 'https://YOUR-SLACK-TEAM.slack.com/api/users.admin.invite' \
--data 'email=EMAIL&token=TOKEN&set_active=true' \
--compressed