{"command":{"effect":"write","timeoutSeconds":30,"inputSchema":{"type":"object","description":"You can create a message that has been initiated by an admin. The conversation can be either an in-app message, an email or whatsapp.\n\n> \uD83D\uDEA7 Sending for visitors\n>\n> There can be a short delay between when a contact is created and when a contact becomes available to be messaged through the API. A 404 Not Found error will be returned in this case.\n\nThis will return the Message model that has been created.\n\n> \uD83D\uDEA7 Retrieving Associated Conversations\n>\n> As this is a message, there will be no conversation present until the contact responds. Once they do, you will have to search for a contact's conversations with the id of the message.\n\n{% admonition type=\"warning\" name=\"Messages from contacts\" %}\n`from` should be an admin. A request with a user or lead as `from` is not rejected: it creates a conversation initiated by that contact, as the Create a conversation endpoint (`POST /conversations`) does, and the `to`, `cc` and `bcc` fields are ignored. To create a conversation initiated by a contact, use `POST /conversations`.\n{% /admonition %}\n","properties":{"headers":{"type":"object","properties":{"Intercom-Version":{"$ref":"#/definitions/intercom_version","enum":["2.17"]}},"required":[],"additionalProperties":false},"body":{"$ref":"#/definitions/create_message_request","examples":[{"from":{"type":"user","id":"6762f2341bb69f9f2193bc17"},"body":"heyy","referer":"https://twitter.com/bob"}]}},"required":[],"additionalProperties":false,"definitions":{"intercom_version":{"description":"Intercom API version.</br>If you omit the header, the API uses the version set in your app package, and 1.0 if none is set.","type":"string","enum":["1.0","1.1","1.2","1.3","1.4","2.0","2.1","2.2","2.3","2.4","2.5","2.6","2.7","2.8","2.9","2.10","2.11","2.12","2.13","2.14","2.15","2.16","2.17"],"examples":["2.17"]},"create_message_request":{"description":"You can create a message","type":["object","null"],"title":"Create Message Request Payload","properties":{"message_type":{"type":"string","description":"The kind of message being created. Values: `in_app`, `email` or `whatsapp`. `inapp` is also accepted for in-app messages, and responses always show in-app messages as `inapp`.","enum":["in_app","inapp","email","whatsapp"],"examples":["in_app"]},"subject":{"type":"string","description":"The title of the email.","examples":["Thanks for everything"]},"body":{"type":"string","description":"The content of the message. HTML and plaintext are supported.","examples":["Hello there"]},"template":{"type":"string","description":"The style of the outgoing message. Possible values `plain` or `personal`.","examples":["plain"]},"from":{"type":"object","description":"The sender of the message. If not provided, the default sender will be used.","properties":{"type":{"type":"string","description":"Always `admin`.","enum":["admin"],"examples":["admin"]},"id":{"type":"integer","description":"The identifier for the admin which is given by Intercom.","examples":[394051]}},"required":["type","id"]},"to":{"oneOf":[{"$ref":"#/definitions/recipient"},{"type":"array","description":"The recipients of the message.","items":{"$ref":"#/definitions/recipient"},"examples":[[{"type":"user","id":"536e564f316c83104c000020"},{"type":"lead","id":"536e564f316c83104c000021"}]]},{"type":"object","title":"WhatsApp recipient","description":"The recipient of a `whatsapp` message, identified by phone number. Required form for `whatsapp` messages. A contact is created for the number if there isn't one.","properties":{"phone":{"type":"string","description":"The recipient's phone number, in international format.","examples":["+5547999998888"]},"name":{"type":"string","description":"The name to give the contact if one is created.","examples":["John Doe"]}},"required":["phone"]}]},"cc":{"oneOf":[{"$ref":"#/definitions/recipient"},{"type":"array","description":"The CC recipients of the message.","items":{"$ref":"#/definitions/recipient"},"examples":[[{"type":"user","id":"536e564f316c83104c000023"}]]}]},"bcc":{"oneOf":[{"$ref":"#/definitions/recipient"},{"type":"array","description":"The BCC recipients of the message.","items":{"$ref":"#/definitions/recipient"},"examples":[[{"type":"user","id":"536e564f316c83104c000022"}]]}]},"created_at":{"type":"integer","description":"The time the message was created. If not provided, the current time will be used.","examples":[1590000000]},"create_conversation_without_contact_reply":{"type":"boolean","description":"Whether a conversation should be opened in the inbox for the message without the contact replying. Defaults to false if not provided.","default":false,"examples":[true]},"components":{"type":"array","description":"The components of the WhatsApp template, with the values for its variables. Required for `whatsapp` messages.","items":{"type":"object","additionalProperties":true},"examples":[[{"type":"BODY","parameters":[{"type":"text","text":"Username 123"}]}]]},"locale":{"type":"string","description":"The locale of the WhatsApp template to send, such as `en`. If you leave it out, the contact's messenger locale is used, then the workspace locale. A template that isn't available in the locale returns a `400` error.","examples":["en"]},"brand_id":{"type":"string","description":"The id of the brand to send the message from. Not used for `whatsapp` messages. A brand that doesn't exist returns a `400` error.","examples":["1234"]}},"anyOf":[{"title":"message_type: `email`.","required":["message_type","subject","body","template","from","to"]},{"title":"message_type: `inapp`.","required":["message_type","body","from","to"]},{"title":"message_type: `whatsapp`.","required":["message_type","template","components","from","to"]}]},"recipient":{"type":"object","title":"Recipient","description":"A recipient of a message","properties":{"type":{"type":"string","description":"The role associated to the contact - `user` or `lead`.","enum":["user","lead"],"examples":["user"]},"id":{"type":"string","description":"The identifier for the contact which is given by Intercom.","examples":["536e564f316c83104c000020"]}},"required":["type","id"]}}},"name":"Create a message","id":"intercom.createmessage","example":{},"maxRequests":1,"summary":false}}