Report rules
Report rules (the logo, colors, and templates applied to an issuer's invoice PDFs) let you customize your brand identity (or your customers') in invoice reports. Each report rule is linked to an RFC (Mexico's taxpayer ID, Registro Federal de Contribuyentes), and every condition in the rule applies to the invoices whose issuer RFC matches.
Report rules let you customize these elements in invoice reports:
- Logo: Your company's logo, shown at the top of the invoice.
- Band color: The color of the bands shown at the top of each section of the invoice.
- Band text color: The color of the text shown in the report's bands.
This way, the styles of a report rule apply automatically every time you generate an invoice whose issuer RFC matches the rule's RFC. They apply to every invoicing operation: for example, when you generate an invoice, retrieve it, generate its PDF, view it in the dashboard, retrieve it through the API, and so on.
The message model
Report rules have these attributes:
Properties
- Name
id- Type
- string?
- Description
Unique identifier for the message.
- Name
conversation_id- Type
- string?
- Description
Unique identifier for the conversation the message belongs to.
- Name
contact- Type
- object?
- Description
The contact object for the contact who sent the message.
- Name
message- Type
- string?
- Description
The message content.
- Name
reactions- Type
- array?
- Description
An array of reaction objects associated with the message.
- Name
attachments- Type
- array?
- Description
An array of attachment objects associated with the message.
- Name
read_at- Type
- timestamp?
- Description
Timestamp of when the message was read.
- Name
created_at- Type
- timestamp?
- Description
Timestamp of when the message was created.
- Name
updated_at- Type
- timestamp?
- Description
Timestamp of when the message was last updated.
List all messages
This endpoint allows you to retrieve a paginated list of all your messages (in a conversation if a conversation id is provided). By default, a maximum of ten messages are shown per page.
Optional attributes
- Name
conversation_id- Type
- string?
- Description
Limit to messages from a given conversation.
- Name
limit- Type
- integer?
- Description
Limit the number of messages returned.
Request
curl -G https://api.protocol.chat/v1/messages \
-H "Authorization: Bearer {token}" \
-d conversation_id=xgQQXg3hrtjh7AvZ \
-d limit=10
Response
{
"has_more": false,
"data": [
{
"id": "SIuAFUNKdSYHZF2w",
"conversation_id": "xgQQXg3hrtjh7AvZ",
"contact": {
"id": "WAz8eIbvDR60rouK",
"username": "KevinMcCallister",
"phone_number": "1-800-759-3000",
"avatar_url": "https://assets.protocol.chat/avatars/buzzboy.jpg",
"last_active_at": 705103200,
"created_at": 692233200
},
"message": "It’s a nice night for a neck injury.",
"reactions": [],
"attachments": [],
"read_at": 705103200,
"created_at": 692233200,
"updated_at": 692233200
},
{
"id": "hSIhXBhNe8X1d8Et",
// ..
}
]
}
Send a message
This endpoint allows you to send a new message to one of your conversations.
Required attributes
- Name
conversation_id- Type
- string?
- Description
Unique identifier for the conversation the message belongs to.
- Name
message- Type
- string?
- Description
The message content.
Optional attributes
- Name
attachments- Type
- array?
- Description
An array of attachment objects associated with the message.
Request
curl https://api.protocol.chat/v1/messages \
-H "Authorization: Bearer {token}" \
-d conversation_id="xgQQXg3hrtjh7AvZ" \
-d message="You’re what the French call ‘les incompetents.’"
Response
{
"id": "gWqY86BMFRiH5o11",
"conversation_id": "xgQQXg3hrtjh7AvZ",
"contact": {
"id": "inEIRvzjC6YLMX3o",
"username": "LinnieMcCallister",
"phone_number": "1-800-759-3000",
"avatar_url": "https://assets.protocol.chat/avatars/linnie.jpg",
"last_active_at": 705103200,
"created_at": 692233200
},
"message": "You’re what the French call ‘les incompetents.’",
"reactions": [],
"attachments": [],
"read_at": null,
"created_at": 692233200,
"updated_at": null
}
Retrieve a message
This endpoint allows you to retrieve a message by providing the message id. Refer to the list at the top of this page to see which properties are included with message objects.
Request
curl https://api.protocol.chat/v1/messages/SIuAFUNKdSYHZF2w \
-H "Authorization: Bearer {token}"
Response
{
"id": "SIuAFUNKdSYHZF2w",
"conversation_id": "xgQQXg3hrtjh7AvZ",
"contact": {
"id": "WAz8eIbvDR60rouK",
"username": "KevinMcCallister",
"phone_number": "1-800-759-3000",
"avatar_url": "https://assets.protocol.chat/avatars/kevin.jpg",
"last_active_at": 705103200,
"created_at": 692233200
},
"message": "I’m traveling with my dad. He’s at a meeting. I hate meetings.",
"reactions": [],
"attachments": [],
"read_at": 705103200,
"created_at": 692233200,
"updated_at": 692233200
}
Update a message
This endpoint allows you to perform an update on a message. Examples of updates are adding a reaction, editing the message, or adding an attachment.
Optional attributes
- Name
message- Type
- string?
- Description
The message content.
- Name
reactions- Type
- array?
- Description
An array of reaction objects associated with the message.
- Name
attachments- Type
- array?
- Description
An array of attachment objects associated with the message.
Request
curl -X PUT https://api.protocol.chat/v1/messages/SIuAFUNKdSYHZF2w \
-H "Authorization: Bearer {token}" \
-d reactions[red_angry_face][]="KateMcCallister"
Response
{
"id": "SIuAFUNKdSYHZF2w",
"conversation_id": "xgQQXg3hrtjh7AvZ",
"contact": {
"id": "WAz8eIbvDR60rouK",
"username": "KevinMcCallister",
"phone_number": "1-800-759-3000",
"avatar_url": "https://assets.protocol.chat/avatars/buzzboy.jpg",
"last_active_at": 705103200,
"created_at": 692233200
},
"message": "I'm not apologizing. I'd rather kiss a toilet seat.",
"reactions": [
{
"red_angry_face": [
"KateMcCallister"
]
}
],
"attachments": [],
"read_at": 705103200,
"created_at": 692233200,
"updated_at": 692233200
}
Delete a message
This endpoint allows you to delete messages from your conversations. Note: This will permanently delete the message.
Request
curl -X DELETE https://api.protocol.chat/v1/messages/SIuAFUNKdSYHZF2w \
-H "Authorization: Bearer {token}"