Figma
Overview of the Figma provider and registering webhooks
Overview
There are three ways to interact with the Figma API through our platform:
Figma API Quirks
Every Figma REST API request requires a team ID
. This is a unique identifier for your Figma team. Webhooks are created at the team level, so you/your users will need to provide this value when creating a webhook. We provide a helper function to retrieve the team ID
for you. See below.
Creating a Webhook for a User
The SDK
is strongly typed and uses Classes
in the background to provide the easiest experience possible. Here’s how to create a webhook:
Step 1:
Team ID Retrieval: Figma’s REST API
doesn’t support retrieving the team ID
programmatically. You will need this value to interact with the API. The team ID
can be found in the URL of your Figma team. Use our hook to redirect the user to obtain the teamID value.
Have your customers choose (physicaly click on the team they want) the team they want to integrate with. Then have them copy the URL at the top of the browser and paste it into your application.
Step 2:
Use the SDK to create a new webook for a user. If you don’t provide an external user, the webhook will be created for the user who the access token belongs to.
Example:
Now you are done in a couple lines of code. You can head over to the dashboard to see the logs and webhook bodies.
Updating a Webhook for a User
If you don’t want to create a new webhook, you can update an existing one. This is useful if you want to change the callbackUrl
or eventType
. The resulting webhook will be under the same project and endpointID so you don’t need to worry about updating things in your database/storage.
Example Payloads
With each provider we have example payloads so you can test the webhook events. This can be useful for debugging and testing your application.
To import, each payload example starts with the provider name and then the event name. For example, figmaFileCommentEventExamplePayload
. Use intelligent auto-complete in your IDE to find the payload you need.
Here’s an example of the Figma File Comment Example Payload
(you can import as figmaFileCommentEventExamplePayload
):
Types
We also provide types for all supported event payloads. This can be helpful when you are consuming webhooks on your endpoint. Instead of the payload body being an any
type, now you can do something like this:
Here is what the type looks like if you hover over it:
Zod Schemas - Coming Soon
This will allow you to validate the incoming webhook body against a schema. This can be useful for ensuring the body is correct before processing it.
Internal company webhooks
If you want to use Syncd as an internal webhook sending, regestration, and managment service, the dashboard has you covered. We handle and mange the access tokens with one click.