> For the complete documentation index, see [llms.txt](https://help.recart.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.recart.com/developers/public-api/webhook/create-a-new-webhook.md).

# Create a new webhook

Create a new webhook

```json
{"openapi":"3.1.0","info":{"title":"Recart API","version":"2023-12"},"tags":[{"name":"Webhook","description":"Webhooks"}],"servers":[{"url":"https://api.recart.com/app-integrations/2023-12","description":"Production"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"X-Recart-API-Key","description":"It can be obtained in Recart account after contacting Support"}},"schemas":{"Webhook":{"type":"object","required":["type","attributes"],"properties":{"type":{"type":"string","enum":["webhooks"]},"attributes":{"type":"object","required":["topic","address"],"properties":{"topic":{"type":"string","description":"Event type, messages/incoming, messages/outgoing, subscribers/unsubscribe, subscribers/subscribe"},"address":{"type":"string","format":"uri","description":"Destination URL for webhook delivery"}}}}},"HttpErrorBody":{"type":"object","required":["errors"],"properties":{"errors":{"type":"array","items":{"type":"object","required":["id","code","title","detail"],"properties":{"id":{"type":"string"},"code":{"type":"string"},"title":{"type":"string"},"detail":{"type":"string"}}}}}},"IncomingMessage":{"type":"object","required":["type","attributes"],"properties":{"type":{"type":"string","enum":["messages"]},"attributes":{"type":"object","properties":{"id":{"type":"string","description":"Id"},"body":{"type":"string","description":"Content of the message"},"hasAttachment":{"type":"boolean","description":"Returns true if the message has an attachment"},"from":{"type":"string","description":"from"},"to":{"type":"string","description":"to"},"receivedAt":{"type":"string","description":"UTC Date and time in ISO 8601 format"}}}}},"OutgoingMessage":{"type":"object","required":["type","attributes"],"properties":{"type":{"type":"string","enum":["messages"]},"attributes":{"type":"object","properties":{"id":{"type":"string","description":"Id"},"status":{"type":"string","description":"Status of the message. It can be processing, sent or error"},"body":{"type":"string","description":"Content of the message"},"sentAt":{"type":"string","description":"UTC Date and time in ISO 8601 format"},"from":{"type":"string","description":"Phone number of the sender in E.164 format"},"to":{"type":"string","description":"Phone number of the recipient in E.164 format"}}}}},"SubscribersUnsubscribe":{"type":"object","required":["type","attributes"],"properties":{"type":{"type":"string","enum":["subscriptions"]},"attributes":{"type":"object","properties":{"subscriberId":{"type":"string","description":"Recart identifier of the subscriber"},"phoneNumber":{"type":"string","description":"Preferably E.164 format"}}}}},"SubscribersSubscribe":{"type":"object","required":["type","attributes"],"properties":{"type":{"type":"string","enum":["subscriptions"]},"attributes":{"type":"object","properties":{"subscriberId":{"type":"string","description":"Recart identifier of the subscriber"},"phoneNumber":{"type":"string","description":"Preferably E.164 format"},"source":{"type":"string","description":"Source of the subscription"},"sourceId":{"type":"string","description":"Recart identifier of the source"},"subscribedAt":{"type":"string","description":"UTC Date and time in ISO 8601 format"},"optinType":{"type":"string","description":"Subscription optin level"}}}}}},"responses":{"HttpError":{"description":"HTTP Error response","content":{"application/vnd.api+json":{"schema":{"$ref":"#/components/schemas/HttpErrorBody"}}}}}},"paths":{"/webhooks":{"post":{"summary":"Create a new webhook","tags":["Webhook"],"operationId":"createWebhook","description":"Create a new webhook","requestBody":{"required":true,"content":{"application/vnd.api+json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Webhook"}}}}}},"responses":{"201":{"description":"Created"},"4XX":{"$ref":"#/components/responses/HttpError"},"5XX":{"$ref":"#/components/responses/HttpError"}},"callbacks":{"Incoming message":{"{$request.body#/data/attributes/address}":{"post":{"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/IncomingMessage"}}}}}},"responses":{"200":{"description":"Your server returns this code if it accepts the callback"}}}}},"Outgoing message":{"{$request.body#/data/attributes/address}":{"post":{"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/OutgoingMessage"}}}}}},"responses":{"200":{"description":"Your server returns this code if it accepts the callback"}}}}},"Subscribers unsubscribe":{"{$request.body#/data/attributes/address}":{"post":{"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/SubscribersUnsubscribe"}}}}}},"responses":{"200":{"description":"Your server returns this code if it accepts the callback"}}}}},"Subscribers subscribe":{"{$request.body#/data/attributes/address}":{"post":{"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/SubscribersSubscribe"}}}}}},"responses":{"200":{"description":"Your server returns this code if it accepts the callback"}}}}}}}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://help.recart.com/developers/public-api/webhook/create-a-new-webhook.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
